summaryrefslogtreecommitdiffstats
path: root/net/ceph/osd_client.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-03-01 18:00:15 -0600
committerSage Weil <sage@inktank.com>2013-05-01 21:16:23 -0700
commit153e5167e0e237faaefb7adf82db5748c1452d73 (patch)
treefa0e5ec90ef466cb7100f64ee4d2b9bf7c4ad69d /net/ceph/osd_client.c
parent3a42b6c43e4ef65d0edd7d9e5c4366002b4e951d (diff)
downloadblackbird-op-linux-153e5167e0e237faaefb7adf82db5748c1452d73.tar.gz
blackbird-op-linux-153e5167e0e237faaefb7adf82db5748c1452d73.zip
libceph: don't assign page info in ceph_osdc_new_request()
Currently ceph_osdc_new_request() assigns an osd request's r_num_pages and r_alignment fields. The only thing it does after that is call ceph_osdc_build_request(), and that doesn't need those fields to be assigned. Move the assignment of those fields out of ceph_osdc_new_request() and into its caller. As a result, the page_align parameter is no longer used, so get rid of it. Note that in ceph_sync_write(), the value for req->r_num_pages had already been calculated earlier (as num_pages, and fortunately it was computed the same way). So don't bother recomputing it, but because it's not needed earlier, move that calculation after the call to ceph_osdc_new_request(). Hold off making the assignment to r_alignment, doing it instead r_pages and r_num_pages are getting set. Similarly, in start_read(), nr_pages already holds the number of pages in the array (and is calculated the same way), so there's no need to recompute it. Move the assignment of the page alignment down with the others there as well. This and the next few patches are preparation work for: http://tracker.ceph.com/issues/4127 Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net/ceph/osd_client.c')
-rw-r--r--net/ceph/osd_client.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 38d09d13bb15..de427cc7f6d0 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -432,8 +432,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
u32 truncate_seq,
u64 truncate_size,
struct timespec *mtime,
- bool use_mempool,
- int page_align)
+ bool use_mempool)
{
struct ceph_osd_req_op ops[2];
struct ceph_osd_request *req;
@@ -470,11 +469,6 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, bno);
req->r_oid_len = strlen(req->r_oid);
- /* The alignment may differ from the natural (file) alignment */
-
- req->r_num_pages = calc_pages_for(page_align, *plen);
- req->r_page_alignment = page_align;
-
ceph_osdc_build_request(req, off, *plen, num_op, ops,
snapc, vino.snap, mtime);
@@ -1945,12 +1939,14 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc,
req = ceph_osdc_new_request(osdc, layout, vino, off, plen,
CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ,
NULL, 0, truncate_seq, truncate_size, NULL,
- false, page_align);
+ false);
if (IS_ERR(req))
return PTR_ERR(req);
/* it may be a short read due to an object boundary */
req->r_pages = pages;
+ req->r_num_pages = calc_pages_for(page_align, *plen);
+ req->r_page_alignment = page_align;
dout("readpages final extent is %llu~%llu (%d pages align %d)\n",
off, *plen, req->r_num_pages, page_align);
@@ -1986,14 +1982,15 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
CEPH_OSD_FLAG_ONDISK | CEPH_OSD_FLAG_WRITE,
snapc, 0,
truncate_seq, truncate_size, mtime,
- true, page_align);
+ true);
if (IS_ERR(req))
return PTR_ERR(req);
/* it may be a short write due to an object boundary */
req->r_pages = pages;
- dout("writepages %llu~%llu (%d pages)\n", off, len,
- req->r_num_pages);
+ req->r_num_pages = calc_pages_for(page_align, len);
+ req->r_page_alignment = page_align;
+ dout("writepages %llu~%llu (%d pages)\n", off, len, req->r_num_pages);
rc = ceph_osdc_start_request(osdc, req, true);
if (!rc)
OpenPOWER on IntegriCloud