diff options
author | Sage Weil <sage@inktank.com> | 2013-02-25 19:13:08 -0500 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-02-26 18:02:37 -0500 |
commit | 2169aea649c08374bec7d220a3b8f64712275356 (patch) | |
tree | 8a287c8239a5e1fc47afae4fbec530a467825706 /net/ceph/osd_client.c | |
parent | 4f6a7e5ee1393ec4b243b39dac9f36992d161540 (diff) |
libceph: calculate placement based on the internal data types
Instead of using the old ceph_object_layout struct, update our internal
ceph_calc_object_layout method to use the ceph_pg type. This allows us to
pass the full 32-bit precision of the pgid.seed to the callers. It also
allows some callers to avoid reaching into the request structures for the
struct ceph_object_layout fields.
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'net/ceph/osd_client.c')
-rw-r--r-- | net/ceph/osd_client.c | 11 |
1 files changed, 7 insertions, 4 deletions
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 | ||