diff options
author | Alex Elder <elder@inktank.com> | 2013-04-03 02:28:57 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:18:06 -0400 |
commit | 43bfe5de9fa78e07248b70992ce50321efec622c (patch) | |
tree | 8aa7ce9ad14551bdfcb1bf166a90b65a3dab7c02 /fs/ceph | |
parent | 9fc6e0647180f72392f03a29863b6602e22aa024 (diff) |
libceph: define osd data initialization helpers
Define and use functions that encapsulate the initializion of a
ceph_osd_data structure.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/addr.c | 13 | ||||
-rw-r--r-- | fs/ceph/file.c | 10 |
2 files changed, 8 insertions, 15 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 5d8ce79385ed..cf9032abc8f5 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -342,10 +342,8 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) | |||
342 | } | 342 | } |
343 | pages[i] = page; | 343 | pages[i] = page; |
344 | } | 344 | } |
345 | req->r_data_in.type = CEPH_OSD_DATA_TYPE_PAGES; | 345 | ceph_osd_data_pages_init(&req->r_data_in, pages, len, 0, |
346 | req->r_data_in.pages = pages; | 346 | false, false); |
347 | req->r_data_in.length = len; | ||
348 | req->r_data_in.alignment = 0; | ||
349 | req->r_callback = finish_read; | 347 | req->r_callback = finish_read; |
350 | req->r_inode = inode; | 348 | req->r_inode = inode; |
351 | 349 | ||
@@ -917,11 +915,8 @@ get_more_pages: | |||
917 | dout("writepages got %d pages at %llu~%llu\n", | 915 | dout("writepages got %d pages at %llu~%llu\n", |
918 | locked_pages, offset, len); | 916 | locked_pages, offset, len); |
919 | 917 | ||
920 | req->r_data_out.type = CEPH_OSD_DATA_TYPE_PAGES; | 918 | ceph_osd_data_pages_init(&req->r_data_out, pages, len, 0, |
921 | req->r_data_out.pages = pages; | 919 | !!pool, false); |
922 | req->r_data_out.length = len; | ||
923 | req->r_data_out.alignment = 0; | ||
924 | req->r_data_out.pages_from_pool = !!pool; | ||
925 | 920 | ||
926 | pages = NULL; /* request message now owns the pages array */ | 921 | pages = NULL; /* request message now owns the pages array */ |
927 | pool = NULL; | 922 | pool = NULL; |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 47826c2ef511..da642af14a28 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -491,6 +491,7 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data, | |||
491 | unsigned long buf_align; | 491 | unsigned long buf_align; |
492 | int ret; | 492 | int ret; |
493 | struct timespec mtime = CURRENT_TIME; | 493 | struct timespec mtime = CURRENT_TIME; |
494 | bool own_pages = false; | ||
494 | 495 | ||
495 | if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) | 496 | if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) |
496 | return -EROFS; | 497 | return -EROFS; |
@@ -571,14 +572,11 @@ more: | |||
571 | if ((file->f_flags & O_SYNC) == 0) { | 572 | if ((file->f_flags & O_SYNC) == 0) { |
572 | /* get a second commit callback */ | 573 | /* get a second commit callback */ |
573 | req->r_safe_callback = sync_write_commit; | 574 | req->r_safe_callback = sync_write_commit; |
574 | req->r_data_out.own_pages = 1; | 575 | own_pages = true; |
575 | } | 576 | } |
576 | } | 577 | } |
577 | req->r_data_out.type = CEPH_OSD_DATA_TYPE_PAGES; | 578 | ceph_osd_data_pages_init(&req->r_data_out, pages, len, page_align, |
578 | req->r_data_out.pages = pages; | 579 | false, own_pages); |
579 | req->r_data_out.length = len; | ||
580 | req->r_data_out.alignment = page_align; | ||
581 | req->r_inode = inode; | ||
582 | 580 | ||
583 | /* BUG_ON(vino.snap != CEPH_NOSNAP); */ | 581 | /* BUG_ON(vino.snap != CEPH_NOSNAP); */ |
584 | ceph_osdc_build_request(req, pos, num_ops, ops, | 582 | ceph_osdc_build_request(req, pos, num_ops, ops, |