diff options
-rw-r--r-- | fs/ceph/ioctl.c | 5 | ||||
-rw-r--r-- | include/linux/ceph/osd_client.h | 1 | ||||
-rw-r--r-- | include/linux/ceph/osdmap.h | 2 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 11 | ||||
-rw-r--r-- | net/ceph/osdmap.c | 18 |
5 files changed, 15 insertions, 22 deletions
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index fb036ed3e129..7d85991fd647 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c | |||
@@ -185,7 +185,6 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg) | |||
185 | &ceph_sb_to_client(inode->i_sb)->client->osdc; | 185 | &ceph_sb_to_client(inode->i_sb)->client->osdc; |
186 | u64 len = 1, olen; | 186 | u64 len = 1, olen; |
187 | u64 tmp; | 187 | u64 tmp; |
188 | struct ceph_object_layout ol; | ||
189 | struct ceph_pg pgid; | 188 | struct ceph_pg pgid; |
190 | int r; | 189 | int r; |
191 | 190 | ||
@@ -209,11 +208,9 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg) | |||
209 | 208 | ||
210 | snprintf(dl.object_name, sizeof(dl.object_name), "%llx.%08llx", | 209 | snprintf(dl.object_name, sizeof(dl.object_name), "%llx.%08llx", |
211 | ceph_ino(inode), dl.object_no); | 210 | ceph_ino(inode), dl.object_no); |
212 | ceph_calc_object_layout(&ol, dl.object_name, &ci->i_layout, | 211 | ceph_calc_object_layout(&pgid, dl.object_name, &ci->i_layout, |
213 | osdc->osdmap); | 212 | osdc->osdmap); |
214 | 213 | ||
215 | pgid.pool = le32_to_cpu(ol.ol_pgid.pool); | ||
216 | pgid.seed = le16_to_cpu(ol.ol_pgid.ps); | ||
217 | dl.osd = ceph_calc_pg_primary(osdc->osdmap, pgid); | 214 | dl.osd = ceph_calc_pg_primary(osdc->osdmap, pgid); |
218 | if (dl.osd >= 0) { | 215 | if (dl.osd >= 0) { |
219 | struct ceph_entity_addr *a = | 216 | struct ceph_entity_addr *a = |
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index 388158ff0cbc..ad8899fc3157 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
@@ -82,6 +82,7 @@ struct ceph_osd_request { | |||
82 | 82 | ||
83 | char r_oid[MAX_OBJ_NAME_SIZE]; /* object name */ | 83 | char r_oid[MAX_OBJ_NAME_SIZE]; /* object name */ |
84 | int r_oid_len; | 84 | int r_oid_len; |
85 | u64 r_snapid; | ||
85 | unsigned long r_stamp; /* send OR check time */ | 86 | unsigned long r_stamp; /* send OR check time */ |
86 | 87 | ||
87 | struct ceph_file_layout r_file_layout; | 88 | struct ceph_file_layout r_file_layout; |
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h index 8587746b7f0e..35985125f118 100644 --- a/include/linux/ceph/osdmap.h +++ b/include/linux/ceph/osdmap.h | |||
@@ -129,7 +129,7 @@ extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | |||
129 | u64 *bno, u64 *oxoff, u64 *oxlen); | 129 | u64 *bno, u64 *oxoff, u64 *oxlen); |
130 | 130 | ||
131 | /* calculate mapping of object to a placement group */ | 131 | /* calculate mapping of object to a placement group */ |
132 | extern int ceph_calc_object_layout(struct ceph_object_layout *ol, | 132 | extern int ceph_calc_object_layout(struct ceph_pg *pg, |
133 | const char *oid, | 133 | const char *oid, |
134 | struct ceph_file_layout *fl, | 134 | struct ceph_file_layout *fl, |
135 | struct ceph_osdmap *osdmap); | 135 | struct ceph_osdmap *osdmap); |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 1990834e518b..5584f0a08e28 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -913,21 +913,18 @@ EXPORT_SYMBOL(ceph_osdc_set_request_linger); | |||
913 | static int __map_request(struct ceph_osd_client *osdc, | 913 | static int __map_request(struct ceph_osd_client *osdc, |
914 | struct ceph_osd_request *req, int force_resend) | 914 | struct ceph_osd_request *req, int force_resend) |
915 | { | 915 | { |
916 | struct ceph_osd_request_head *reqhead = req->r_request->front.iov_base; | ||
917 | struct ceph_pg pgid; | 916 | struct ceph_pg pgid; |
918 | int acting[CEPH_PG_MAX_SIZE]; | 917 | int acting[CEPH_PG_MAX_SIZE]; |
919 | int o = -1, num = 0; | 918 | int o = -1, num = 0; |
920 | int err; | 919 | int err; |
921 | 920 | ||
922 | dout("map_request %p tid %lld\n", req, req->r_tid); | 921 | dout("map_request %p tid %lld\n", req, req->r_tid); |
923 | err = ceph_calc_object_layout(&reqhead->layout, req->r_oid, | 922 | err = ceph_calc_object_layout(&pgid, req->r_oid, |
924 | &req->r_file_layout, osdc->osdmap); | 923 | &req->r_file_layout, osdc->osdmap); |
925 | if (err) { | 924 | if (err) { |
926 | list_move(&req->r_req_lru_item, &osdc->req_notarget); | 925 | list_move(&req->r_req_lru_item, &osdc->req_notarget); |
927 | return err; | 926 | return err; |
928 | } | 927 | } |
929 | pgid.pool = le32_to_cpu(reqhead->layout.ol_pgid.pool); | ||
930 | pgid.seed = le16_to_cpu(reqhead->layout.ol_pgid.ps); | ||
931 | req->r_pgid = pgid; | 928 | req->r_pgid = pgid; |
932 | 929 | ||
933 | err = ceph_calc_pg_acting(osdc->osdmap, pgid, acting); | 930 | err = ceph_calc_pg_acting(osdc->osdmap, pgid, acting); |
@@ -1000,10 +997,16 @@ static void __send_request(struct ceph_osd_client *osdc, | |||
1000 | req, req->r_tid, req->r_osd->o_osd, req->r_flags); | 997 | req, req->r_tid, req->r_osd->o_osd, req->r_flags); |
1001 | 998 | ||
1002 | reqhead = req->r_request->front.iov_base; | 999 | reqhead = req->r_request->front.iov_base; |
1000 | reqhead->snapid = cpu_to_le64(req->r_snapid); | ||
1003 | reqhead->osdmap_epoch = cpu_to_le32(osdc->osdmap->epoch); | 1001 | reqhead->osdmap_epoch = cpu_to_le32(osdc->osdmap->epoch); |
1004 | reqhead->flags |= cpu_to_le32(req->r_flags); /* e.g., RETRY */ | 1002 | reqhead->flags |= cpu_to_le32(req->r_flags); /* e.g., RETRY */ |
1005 | reqhead->reassert_version = req->r_reassert_version; | 1003 | reqhead->reassert_version = req->r_reassert_version; |
1006 | 1004 | ||
1005 | reqhead->layout.ol_pgid.ps = cpu_to_le16(req->r_pgid.seed); | ||
1006 | reqhead->layout.ol_pgid.pool = cpu_to_le32(req->r_pgid.pool); | ||
1007 | reqhead->layout.ol_pgid.preferred = cpu_to_le16(-1); | ||
1008 | reqhead->layout.ol_stripe_unit = 0; | ||
1009 | |||
1007 | req->r_stamp = jiffies; | 1010 | req->r_stamp = jiffies; |
1008 | list_move_tail(&req->r_req_lru_item, &osdc->req_lru); | 1011 | list_move_tail(&req->r_req_lru_item, &osdc->req_lru); |
1009 | 1012 | ||
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 911919320d2e..378471644501 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
@@ -1095,32 +1095,24 @@ EXPORT_SYMBOL(ceph_calc_file_object_mapping); | |||
1095 | * calculate an object layout (i.e. pgid) from an oid, | 1095 | * calculate an object layout (i.e. pgid) from an oid, |
1096 | * file_layout, and osdmap | 1096 | * file_layout, and osdmap |
1097 | */ | 1097 | */ |
1098 | int ceph_calc_object_layout(struct ceph_object_layout *ol, | 1098 | int ceph_calc_object_layout(struct ceph_pg *pg, |
1099 | const char *oid, | 1099 | const char *oid, |
1100 | struct ceph_file_layout *fl, | 1100 | struct ceph_file_layout *fl, |
1101 | struct ceph_osdmap *osdmap) | 1101 | struct ceph_osdmap *osdmap) |
1102 | { | 1102 | { |
1103 | unsigned int num, num_mask; | 1103 | unsigned int num, num_mask; |
1104 | struct ceph_pg pgid; | ||
1105 | struct ceph_pg_pool_info *pool; | 1104 | struct ceph_pg_pool_info *pool; |
1106 | 1105 | ||
1107 | BUG_ON(!osdmap); | 1106 | BUG_ON(!osdmap); |
1108 | 1107 | pg->pool = le32_to_cpu(fl->fl_pg_pool); | |
1109 | pgid.pool = le32_to_cpu(fl->fl_pg_pool); | 1108 | pool = __lookup_pg_pool(&osdmap->pg_pools, pg->pool); |
1110 | pool = __lookup_pg_pool(&osdmap->pg_pools, pgid.pool); | ||
1111 | if (!pool) | 1109 | if (!pool) |
1112 | return -EIO; | 1110 | return -EIO; |
1113 | pgid.seed = ceph_str_hash(pool->object_hash, oid, strlen(oid)); | 1111 | pg->seed = ceph_str_hash(pool->object_hash, oid, strlen(oid)); |
1114 | num = pool->pg_num; | 1112 | num = pool->pg_num; |
1115 | num_mask = pool->pg_num_mask; | 1113 | num_mask = pool->pg_num_mask; |
1116 | 1114 | ||
1117 | dout("calc_object_layout '%s' pgid %lld.%x\n", oid, pgid.pool, | 1115 | dout("calc_object_layout '%s' pgid %lld.%x\n", oid, pg->pool, pg->seed); |
1118 | pgid.seed); | ||
1119 | |||
1120 | ol->ol_pgid.ps = cpu_to_le16(pgid.seed); | ||
1121 | ol->ol_pgid.pool = fl->fl_pg_pool; | ||
1122 | ol->ol_pgid.preferred = cpu_to_le16(-1); | ||
1123 | ol->ol_stripe_unit = fl->fl_object_stripe_unit; | ||
1124 | return 0; | 1116 | return 0; |
1125 | } | 1117 | } |
1126 | EXPORT_SYMBOL(ceph_calc_object_layout); | 1118 | EXPORT_SYMBOL(ceph_calc_object_layout); |