]> Pileus Git - ~andy/linux/commitdiff
libceph: drop snapid in ceph_calc_raw_layout()
authorAlex Elder <elder@inktank.com>
Wed, 14 Nov 2012 03:11:15 +0000 (21:11 -0600)
committerAlex Elder <elder@inktank.com>
Thu, 17 Jan 2013 21:52:05 +0000 (15:52 -0600)
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>
drivers/block/rbd.c
include/linux/ceph/osd_client.h
net/ceph/osd_client.c

index c1b135b6cb97cce9ecb2d4893442b3ddf8715756..fa371868e9b0b5f5f5819f788b934cf9691ecea6 100644 (file)
@@ -1169,10 +1169,10 @@ static int rbd_do_request(struct request *rq,
 
        rbd_layout_init(&osd_req->r_file_layout, rbd_dev->spec->pool_id);
        ret = ceph_calc_raw_layout(osdc, &osd_req->r_file_layout,
-                               snapid, ofs, &len, &bno, osd_req, ops);
+                               ofs, &len, &bno, osd_req, ops);
        rbd_assert(ret == 0);
 
-       ceph_osdc_build_request(osd_req, ofs, len, ops, snapc, &mtime);
+       ceph_osdc_build_request(osd_req, ofs, len, ops, snapc, snapid, &mtime);
 
        if (linger_req) {
                ceph_osdc_set_request_linger(osdc, osd_req);
index 4bfb4582439a4503ace8bf9d0dee1b5b7259e3d1..0e82a0a967ef87780496cc0dcb2c0897e7e052ee 100644 (file)
@@ -209,7 +209,6 @@ extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
 
 extern int ceph_calc_raw_layout(struct ceph_osd_client *osdc,
                        struct ceph_file_layout *layout,
-                       u64 snapid,
                        u64 off, u64 *plen, u64 *bno,
                        struct ceph_osd_request *req,
                        struct ceph_osd_req_op *op);
@@ -227,6 +226,7 @@ extern void ceph_osdc_build_request(struct ceph_osd_request *req,
                                    u64 off, u64 len,
                                    struct ceph_osd_req_op *src_ops,
                                    struct ceph_snap_context *snapc,
+                                   u64 snap_id,
                                    struct timespec *mtime);
 
 extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
index 47e5f5b1f94cf63e5bed553aa55d55edb424d486..b5a4b2875e8ac175f3a8981c1f2152370499df66 100644 (file)
@@ -40,18 +40,14 @@ static int op_has_extent(int op)
 
 int ceph_calc_raw_layout(struct ceph_osd_client *osdc,
                        struct ceph_file_layout *layout,
-                       u64 snapid,
                        u64 off, u64 *plen, u64 *bno,
                        struct ceph_osd_request *req,
                        struct ceph_osd_req_op *op)
 {
-       struct ceph_osd_request_head *reqhead = req->r_request->front.iov_base;
        u64 orig_len = *plen;
        u64 objoff, objlen;    /* extent in object */
        int r;
 
-       reqhead->snapid = cpu_to_le64(snapid);
-
        /* object extent? */
        r = ceph_calc_file_object_mapping(layout, off, orig_len, bno,
                                          &objoff, &objlen);
@@ -121,8 +117,7 @@ static int calc_layout(struct ceph_osd_client *osdc,
        u64 bno;
        int r;
 
-       r = ceph_calc_raw_layout(osdc, layout, vino.snap, off,
-                                plen, &bno, req, op);
+       r = ceph_calc_raw_layout(osdc, layout, off, plen, &bno, req, op);
        if (r < 0)
                return r;
 
@@ -340,7 +335,7 @@ static void osd_req_encode_op(struct ceph_osd_request *req,
 void ceph_osdc_build_request(struct ceph_osd_request *req,
                             u64 off, u64 len,
                             struct ceph_osd_req_op *src_ops,
-                            struct ceph_snap_context *snapc,
+                            struct ceph_snap_context *snapc, u64 snap_id,
                             struct timespec *mtime)
 {
        struct ceph_msg *msg = req->r_request;
@@ -355,6 +350,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req,
        int i;
 
        head = msg->front.iov_base;
+       head->snapid = cpu_to_le64(snap_id);
        op = (void *)(head + 1);
        p = (void *)(op + num_op);
 
@@ -466,9 +462,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
        req->r_num_pages = calc_pages_for(page_align, *plen);
        req->r_page_alignment = page_align;
 
-       ceph_osdc_build_request(req, off, *plen, ops,
-                               snapc,
-                               mtime);
+       ceph_osdc_build_request(req, off, *plen, ops, snapc, vino.snap, mtime);
 
        return req;
 }