aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/rbd.c1
-rw-r--r--fs/ceph/file.c1
-rw-r--r--fs/ceph/ioctl.c15
-rw-r--r--fs/ceph/xattr.c9
-rw-r--r--include/linux/ceph/ceph_fs.h4
-rw-r--r--include/linux/ceph/osdmap.h2
-rw-r--r--net/ceph/osdmap.c47
7 files changed, 17 insertions, 62 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index c1f770131654..a67fa63a966b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -935,7 +935,6 @@ static int rbd_do_request(struct request *rq,
935 layout->fl_stripe_unit = cpu_to_le32(1 << RBD_MAX_OBJ_ORDER); 935 layout->fl_stripe_unit = cpu_to_le32(1 << RBD_MAX_OBJ_ORDER);
936 layout->fl_stripe_count = cpu_to_le32(1); 936 layout->fl_stripe_count = cpu_to_le32(1);
937 layout->fl_object_size = cpu_to_le32(1 << RBD_MAX_OBJ_ORDER); 937 layout->fl_object_size = cpu_to_le32(1 << RBD_MAX_OBJ_ORDER);
938 layout->fl_pg_preferred = cpu_to_le32(-1);
939 layout->fl_pg_pool = cpu_to_le32(dev->poolid); 938 layout->fl_pg_pool = cpu_to_le32(dev->poolid);
940 ceph_calc_raw_layout(osdc, layout, snapid, ofs, &len, &bno, 939 ceph_calc_raw_layout(osdc, layout, snapid, ofs, &len, &bno,
941 req, ops); 940 req, ops);
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index ed72428d9c75..988d4f302e48 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -54,7 +54,6 @@ prepare_open_request(struct super_block *sb, int flags, int create_mode)
54 req->r_fmode = ceph_flags_to_mode(flags); 54 req->r_fmode = ceph_flags_to_mode(flags);
55 req->r_args.open.flags = cpu_to_le32(flags); 55 req->r_args.open.flags = cpu_to_le32(flags);
56 req->r_args.open.mode = cpu_to_le32(create_mode); 56 req->r_args.open.mode = cpu_to_le32(create_mode);
57 req->r_args.open.preferred = cpu_to_le32(-1);
58out: 57out:
59 return req; 58 return req;
60} 59}
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
index 790914a598dd..4feab52c5bff 100644
--- a/fs/ceph/ioctl.c
+++ b/fs/ceph/ioctl.c
@@ -26,8 +26,7 @@ static long ceph_ioctl_get_layout(struct file *file, void __user *arg)
26 l.stripe_count = ceph_file_layout_stripe_count(ci->i_layout); 26 l.stripe_count = ceph_file_layout_stripe_count(ci->i_layout);
27 l.object_size = ceph_file_layout_object_size(ci->i_layout); 27 l.object_size = ceph_file_layout_object_size(ci->i_layout);
28 l.data_pool = le32_to_cpu(ci->i_layout.fl_pg_pool); 28 l.data_pool = le32_to_cpu(ci->i_layout.fl_pg_pool);
29 l.preferred_osd = 29 l.preferred_osd = (s32)-1;
30 (s32)le32_to_cpu(ci->i_layout.fl_pg_preferred);
31 if (copy_to_user(arg, &l, sizeof(l))) 30 if (copy_to_user(arg, &l, sizeof(l)))
32 return -EFAULT; 31 return -EFAULT;
33 } 32 }
@@ -49,6 +48,10 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
49 if (copy_from_user(&l, arg, sizeof(l))) 48 if (copy_from_user(&l, arg, sizeof(l)))
50 return -EFAULT; 49 return -EFAULT;
51 50
51 /* preferred_osd is no longer supported */
52 if (l.preferred_osd != -1)
53 return -EINVAL;
54
52 /* validate changed params against current layout */ 55 /* validate changed params against current layout */
53 err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT); 56 err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT);
54 if (!err) { 57 if (!err) {
@@ -56,8 +59,6 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
56 nl.stripe_count = ceph_file_layout_stripe_count(ci->i_layout); 59 nl.stripe_count = ceph_file_layout_stripe_count(ci->i_layout);
57 nl.object_size = ceph_file_layout_object_size(ci->i_layout); 60 nl.object_size = ceph_file_layout_object_size(ci->i_layout);
58 nl.data_pool = le32_to_cpu(ci->i_layout.fl_pg_pool); 61 nl.data_pool = le32_to_cpu(ci->i_layout.fl_pg_pool);
59 nl.preferred_osd =
60 (s32)le32_to_cpu(ci->i_layout.fl_pg_preferred);
61 } else 62 } else
62 return err; 63 return err;
63 64
@@ -69,8 +70,6 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
69 nl.object_size = l.object_size; 70 nl.object_size = l.object_size;
70 if (l.data_pool) 71 if (l.data_pool)
71 nl.data_pool = l.data_pool; 72 nl.data_pool = l.data_pool;
72 if (l.preferred_osd)
73 nl.preferred_osd = l.preferred_osd;
74 73
75 if ((nl.object_size & ~PAGE_MASK) || 74 if ((nl.object_size & ~PAGE_MASK) ||
76 (nl.stripe_unit & ~PAGE_MASK) || 75 (nl.stripe_unit & ~PAGE_MASK) ||
@@ -106,8 +105,6 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
106 req->r_args.setlayout.layout.fl_object_size = 105 req->r_args.setlayout.layout.fl_object_size =
107 cpu_to_le32(l.object_size); 106 cpu_to_le32(l.object_size);
108 req->r_args.setlayout.layout.fl_pg_pool = cpu_to_le32(l.data_pool); 107 req->r_args.setlayout.layout.fl_pg_pool = cpu_to_le32(l.data_pool);
109 req->r_args.setlayout.layout.fl_pg_preferred =
110 cpu_to_le32(l.preferred_osd);
111 108
112 parent_inode = ceph_get_dentry_parent_inode(file->f_dentry); 109 parent_inode = ceph_get_dentry_parent_inode(file->f_dentry);
113 err = ceph_mdsc_do_request(mdsc, parent_inode, req); 110 err = ceph_mdsc_do_request(mdsc, parent_inode, req);
@@ -171,8 +168,6 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
171 cpu_to_le32(l.object_size); 168 cpu_to_le32(l.object_size);
172 req->r_args.setlayout.layout.fl_pg_pool = 169 req->r_args.setlayout.layout.fl_pg_pool =
173 cpu_to_le32(l.data_pool); 170 cpu_to_le32(l.data_pool);
174 req->r_args.setlayout.layout.fl_pg_preferred =
175 cpu_to_le32(l.preferred_osd);
176 171
177 err = ceph_mdsc_do_request(mdsc, inode, req); 172 err = ceph_mdsc_do_request(mdsc, inode, req);
178 ceph_mdsc_put_request(req); 173 ceph_mdsc_put_request(req);
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 35b86331d8a5..785cb3057c95 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -118,15 +118,6 @@ static size_t ceph_vxattrcb_file_layout(struct ceph_inode_info *ci, char *val,
118 (unsigned long long)ceph_file_layout_su(ci->i_layout), 118 (unsigned long long)ceph_file_layout_su(ci->i_layout),
119 (unsigned long long)ceph_file_layout_stripe_count(ci->i_layout), 119 (unsigned long long)ceph_file_layout_stripe_count(ci->i_layout),
120 (unsigned long long)ceph_file_layout_object_size(ci->i_layout)); 120 (unsigned long long)ceph_file_layout_object_size(ci->i_layout));
121
122 if (ceph_file_layout_pg_preferred(ci->i_layout) >= 0) {
123 val += ret;
124 size -= ret;
125 ret += snprintf(val, size, "preferred_osd=%lld\n",
126 (unsigned long long)ceph_file_layout_pg_preferred(
127 ci->i_layout));
128 }
129
130 return ret; 121 return ret;
131} 122}
132 123
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index b8c60694b2b0..e81ab30d4896 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -65,7 +65,7 @@ struct ceph_file_layout {
65 __le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */ 65 __le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */
66 66
67 /* object -> pg layout */ 67 /* object -> pg layout */
68 __le32 fl_pg_preferred; /* preferred primary for pg (-1 for none) */ 68 __le32 fl_unused; /* unused; used to be preferred primary (-1) */
69 __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */ 69 __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */
70} __attribute__ ((packed)); 70} __attribute__ ((packed));
71 71
@@ -384,7 +384,7 @@ union ceph_mds_request_args {
384 __le32 stripe_count; /* ... */ 384 __le32 stripe_count; /* ... */
385 __le32 object_size; 385 __le32 object_size;
386 __le32 file_replication; 386 __le32 file_replication;
387 __le32 preferred; 387 __le32 unused; /* used to be preferred osd */
388 } __attribute__ ((packed)) open; 388 } __attribute__ ((packed)) open;
389 struct { 389 struct {
390 __le32 flags; 390 __le32 flags;
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index ba4c205cbb01..311ef8d6aa9e 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -65,8 +65,6 @@ struct ceph_osdmap {
65#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash)) 65#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash))
66#define ceph_file_layout_object_su(l) \ 66#define ceph_file_layout_object_su(l) \
67 ((__s32)le32_to_cpu((l).fl_object_stripe_unit)) 67 ((__s32)le32_to_cpu((l).fl_object_stripe_unit))
68#define ceph_file_layout_pg_preferred(l) \
69 ((__s32)le32_to_cpu((l).fl_pg_preferred))
70#define ceph_file_layout_pg_pool(l) \ 68#define ceph_file_layout_pg_pool(l) \
71 ((__s32)le32_to_cpu((l).fl_pg_pool)) 69 ((__s32)le32_to_cpu((l).fl_pg_pool))
72 70
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index 29ad46ec9dcf..7d39f3cb4947 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -1000,7 +1000,6 @@ int ceph_calc_object_layout(struct ceph_object_layout *ol,
1000{ 1000{
1001 unsigned num, num_mask; 1001 unsigned num, num_mask;
1002 struct ceph_pg pgid; 1002 struct ceph_pg pgid;
1003 s32 preferred = (s32)le32_to_cpu(fl->fl_pg_preferred);
1004 int poolid = le32_to_cpu(fl->fl_pg_pool); 1003 int poolid = le32_to_cpu(fl->fl_pg_pool);
1005 struct ceph_pg_pool_info *pool; 1004 struct ceph_pg_pool_info *pool;
1006 unsigned ps; 1005 unsigned ps;
@@ -1011,23 +1010,13 @@ int ceph_calc_object_layout(struct ceph_object_layout *ol,
1011 if (!pool) 1010 if (!pool)
1012 return -EIO; 1011 return -EIO;
1013 ps = ceph_str_hash(pool->v.object_hash, oid, strlen(oid)); 1012 ps = ceph_str_hash(pool->v.object_hash, oid, strlen(oid));
1014 if (preferred >= 0) { 1013 num = le32_to_cpu(pool->v.pg_num);
1015 ps += preferred; 1014 num_mask = pool->pg_num_mask;
1016 num = le32_to_cpu(pool->v.lpg_num);
1017 num_mask = pool->lpg_num_mask;
1018 } else {
1019 num = le32_to_cpu(pool->v.pg_num);
1020 num_mask = pool->pg_num_mask;
1021 }
1022 1015
1023 pgid.ps = cpu_to_le16(ps); 1016 pgid.ps = cpu_to_le16(ps);
1024 pgid.preferred = cpu_to_le16(preferred); 1017 pgid.preferred = cpu_to_le16(-1);
1025 pgid.pool = fl->fl_pg_pool; 1018 pgid.pool = fl->fl_pg_pool;
1026 if (preferred >= 0) 1019 dout("calc_object_layout '%s' pgid %d.%x\n", oid, poolid, ps);
1027 dout("calc_object_layout '%s' pgid %d.%xp%d\n", oid, poolid, ps,
1028 (int)preferred);
1029 else
1030 dout("calc_object_layout '%s' pgid %d.%x\n", oid, poolid, ps);
1031 1020
1032 ol->ol_pgid = pgid; 1021 ol->ol_pgid = pgid;
1033 ol->ol_stripe_unit = fl->fl_object_stripe_unit; 1022 ol->ol_stripe_unit = fl->fl_object_stripe_unit;
@@ -1046,23 +1035,17 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
1046 struct ceph_pg_pool_info *pool; 1035 struct ceph_pg_pool_info *pool;
1047 int ruleno; 1036 int ruleno;
1048 unsigned poolid, ps, pps, t; 1037 unsigned poolid, ps, pps, t;
1049 int preferred;
1050 1038
1051 poolid = le32_to_cpu(pgid.pool); 1039 poolid = le32_to_cpu(pgid.pool);
1052 ps = le16_to_cpu(pgid.ps); 1040 ps = le16_to_cpu(pgid.ps);
1053 preferred = (s16)le16_to_cpu(pgid.preferred);
1054 1041
1055 pool = __lookup_pg_pool(&osdmap->pg_pools, poolid); 1042 pool = __lookup_pg_pool(&osdmap->pg_pools, poolid);
1056 if (!pool) 1043 if (!pool)
1057 return NULL; 1044 return NULL;
1058 1045
1059 /* pg_temp? */ 1046 /* pg_temp? */
1060 if (preferred >= 0) 1047 t = ceph_stable_mod(ps, le32_to_cpu(pool->v.pg_num),
1061 t = ceph_stable_mod(ps, le32_to_cpu(pool->v.lpg_num), 1048 pool->pgp_num_mask);
1062 pool->lpgp_num_mask);
1063 else
1064 t = ceph_stable_mod(ps, le32_to_cpu(pool->v.pg_num),
1065 pool->pgp_num_mask);
1066 pgid.ps = cpu_to_le16(t); 1049 pgid.ps = cpu_to_le16(t);
1067 pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid); 1050 pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid);
1068 if (pg) { 1051 if (pg) {
@@ -1080,23 +1063,13 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
1080 return NULL; 1063 return NULL;
1081 } 1064 }
1082 1065
1083 /* don't forcefeed bad device ids to crush */ 1066 pps = ceph_stable_mod(ps,
1084 if (preferred >= osdmap->max_osd || 1067 le32_to_cpu(pool->v.pgp_num),
1085 preferred >= osdmap->crush->max_devices) 1068 pool->pgp_num_mask);
1086 preferred = -1;
1087
1088 if (preferred >= 0)
1089 pps = ceph_stable_mod(ps,
1090 le32_to_cpu(pool->v.lpgp_num),
1091 pool->lpgp_num_mask);
1092 else
1093 pps = ceph_stable_mod(ps,
1094 le32_to_cpu(pool->v.pgp_num),
1095 pool->pgp_num_mask);
1096 pps += poolid; 1069 pps += poolid;
1097 *num = crush_do_rule(osdmap->crush, ruleno, pps, osds, 1070 *num = crush_do_rule(osdmap->crush, ruleno, pps, osds,
1098 min_t(int, pool->v.size, *num), 1071 min_t(int, pool->v.size, *num),
1099 preferred, osdmap->osd_weight); 1072 -1, osdmap->osd_weight);
1100 return osds; 1073 return osds;
1101} 1074}
1102 1075