]> Pileus Git - ~andy/linux/commitdiff
libceph: don't set flags in ceph_osdc_alloc_request()
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)
The only thing ceph_osdc_alloc_request() really does with the
flags value it is passed is assign it to the newly-created
osd request structure.  Do that in the caller instead.

Both callers subsequently call ceph_osdc_build_request(), so have
that function (instead of ceph_osdc_alloc_request()) issue a warning
if a request comes through with neither the read nor write flags set.

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 ac8fd385650967a2d25d22ceded371a08a00e3da..bdbaa4cfd9d3df88e17e3dd03a5212fbbdd987b5 100644 (file)
@@ -1148,13 +1148,14 @@ static int rbd_do_request(struct request *rq,
                (unsigned long long) len, coll, coll_index);
 
        osdc = &rbd_dev->rbd_client->client->osdc;
-       osd_req = ceph_osdc_alloc_request(osdc, flags, snapc, ops,
+       osd_req = ceph_osdc_alloc_request(osdc, snapc, ops,
                                        false, GFP_NOIO, pages, bio);
        if (!osd_req) {
                ret = -ENOMEM;
                goto done_pages;
        }
 
+       osd_req->r_flags = flags;
        osd_req->r_callback = rbd_cb;
 
        rbd_req->rq = rq;
index fe3a6e8db1f900c406f0a847023c2a86aa23960f..6ddda5bbd1a62741d248f5c3c583efa34dfa9a38 100644 (file)
@@ -213,7 +213,6 @@ extern int ceph_calc_raw_layout(struct ceph_file_layout *layout,
                        struct ceph_osd_req_op *op);
 
 extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
-                                              int flags,
                                               struct ceph_snap_context *snapc,
                                               struct ceph_osd_req_op *ops,
                                               bool use_mempool,
index cd9c28387de32f41f0a933745f539c42535f1b6e..77ce1edaa07db88800415e83337d956ee955032c 100644 (file)
@@ -171,7 +171,6 @@ static int get_num_ops(struct ceph_osd_req_op *ops)
 }
 
 struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
-                                              int flags,
                                               struct ceph_snap_context *snapc,
                                               struct ceph_osd_req_op *ops,
                                               bool use_mempool,
@@ -208,10 +207,6 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
        INIT_LIST_HEAD(&req->r_req_lru_item);
        INIT_LIST_HEAD(&req->r_osd_item);
 
-       req->r_flags = flags;
-
-       WARN_ON((flags & (CEPH_OSD_FLAG_READ|CEPH_OSD_FLAG_WRITE)) == 0);
-
        /* create reply message */
        if (use_mempool)
                msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0);
@@ -347,6 +342,8 @@ void ceph_osdc_build_request(struct ceph_osd_request *req,
        u64 data_len = 0;
        int i;
 
+       WARN_ON((flags & (CEPH_OSD_FLAG_READ|CEPH_OSD_FLAG_WRITE)) == 0);
+
        head = msg->front.iov_base;
        head->snapid = cpu_to_le64(snap_id);
        op = (void *)(head + 1);
@@ -442,12 +439,12 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
        } else
                ops[1].op = 0;
 
-       req = ceph_osdc_alloc_request(osdc, flags,
-                                        snapc, ops,
+       req = ceph_osdc_alloc_request(osdc, snapc, ops,
                                         use_mempool,
                                         GFP_NOFS, NULL, NULL);
        if (!req)
                return ERR_PTR(-ENOMEM);
+       req->r_flags = flags;
 
        /* calculate max write size */
        r = calc_layout(vino, layout, off, plen, req, ops);