diff options
author | Alex Elder <elder@inktank.com> | 2012-11-13 22:11:15 -0500 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2013-01-17 16:52:05 -0500 |
commit | 4d6b250bf18d44571d69a0f4afec4b6a1969729f (patch) | |
tree | 8f357c6f3a8871ff678cb6a9e024d1282f8c5dfb /net | |
parent | e8afad656cbcd06d02a7bacd4b318fa0e2907de0 (diff) |
libceph: drop snapid in ceph_calc_raw_layout()
A snapshot id must be provided to ceph_calc_raw_layout() even though
it is not needed at all for calculating the layout.
Where the snapshot id *is* needed is when building the request
message for an osd operation.
Drop the snapid parameter from ceph_calc_raw_layout() and pass
that value instead in ceph_osdc_build_request().
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/osd_client.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 47e5f5b1f94c..b5a4b2875e8a 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -40,18 +40,14 @@ static int op_has_extent(int op) | |||
40 | 40 | ||
41 | int ceph_calc_raw_layout(struct ceph_osd_client *osdc, | 41 | int ceph_calc_raw_layout(struct ceph_osd_client *osdc, |
42 | struct ceph_file_layout *layout, | 42 | struct ceph_file_layout *layout, |
43 | u64 snapid, | ||
44 | u64 off, u64 *plen, u64 *bno, | 43 | u64 off, u64 *plen, u64 *bno, |
45 | struct ceph_osd_request *req, | 44 | struct ceph_osd_request *req, |
46 | struct ceph_osd_req_op *op) | 45 | struct ceph_osd_req_op *op) |
47 | { | 46 | { |
48 | struct ceph_osd_request_head *reqhead = req->r_request->front.iov_base; | ||
49 | u64 orig_len = *plen; | 47 | u64 orig_len = *plen; |
50 | u64 objoff, objlen; /* extent in object */ | 48 | u64 objoff, objlen; /* extent in object */ |
51 | int r; | 49 | int r; |
52 | 50 | ||
53 | reqhead->snapid = cpu_to_le64(snapid); | ||
54 | |||
55 | /* object extent? */ | 51 | /* object extent? */ |
56 | r = ceph_calc_file_object_mapping(layout, off, orig_len, bno, | 52 | r = ceph_calc_file_object_mapping(layout, off, orig_len, bno, |
57 | &objoff, &objlen); | 53 | &objoff, &objlen); |
@@ -121,8 +117,7 @@ static int calc_layout(struct ceph_osd_client *osdc, | |||
121 | u64 bno; | 117 | u64 bno; |
122 | int r; | 118 | int r; |
123 | 119 | ||
124 | r = ceph_calc_raw_layout(osdc, layout, vino.snap, off, | 120 | r = ceph_calc_raw_layout(osdc, layout, off, plen, &bno, req, op); |
125 | plen, &bno, req, op); | ||
126 | if (r < 0) | 121 | if (r < 0) |
127 | return r; | 122 | return r; |
128 | 123 | ||
@@ -340,7 +335,7 @@ static void osd_req_encode_op(struct ceph_osd_request *req, | |||
340 | void ceph_osdc_build_request(struct ceph_osd_request *req, | 335 | void ceph_osdc_build_request(struct ceph_osd_request *req, |
341 | u64 off, u64 len, | 336 | u64 off, u64 len, |
342 | struct ceph_osd_req_op *src_ops, | 337 | struct ceph_osd_req_op *src_ops, |
343 | struct ceph_snap_context *snapc, | 338 | struct ceph_snap_context *snapc, u64 snap_id, |
344 | struct timespec *mtime) | 339 | struct timespec *mtime) |
345 | { | 340 | { |
346 | struct ceph_msg *msg = req->r_request; | 341 | struct ceph_msg *msg = req->r_request; |
@@ -355,6 +350,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req, | |||
355 | int i; | 350 | int i; |
356 | 351 | ||
357 | head = msg->front.iov_base; | 352 | head = msg->front.iov_base; |
353 | head->snapid = cpu_to_le64(snap_id); | ||
358 | op = (void *)(head + 1); | 354 | op = (void *)(head + 1); |
359 | p = (void *)(op + num_op); | 355 | p = (void *)(op + num_op); |
360 | 356 | ||
@@ -466,9 +462,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, | |||
466 | req->r_num_pages = calc_pages_for(page_align, *plen); | 462 | req->r_num_pages = calc_pages_for(page_align, *plen); |
467 | req->r_page_alignment = page_align; | 463 | req->r_page_alignment = page_align; |
468 | 464 | ||
469 | ceph_osdc_build_request(req, off, *plen, ops, | 465 | ceph_osdc_build_request(req, off, *plen, ops, snapc, vino.snap, mtime); |
470 | snapc, | ||
471 | mtime); | ||
472 | 466 | ||
473 | return req; | 467 | return req; |
474 | } | 468 | } |