summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-04-03 01:28:57 -0500
committerSage Weil <sage@inktank.com>2013-05-01 21:18:06 -0700
commit43bfe5de9fa78e07248b70992ce50321efec622c (patch)
tree8aa7ce9ad14551bdfcb1bf166a90b65a3dab7c02 /fs
parent9fc6e0647180f72392f03a29863b6602e22aa024 (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')
-rw-r--r--fs/ceph/addr.c13
-rw-r--r--fs/ceph/file.c10
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)
}
pages[i] = page;
}
- req->r_data_in.type = CEPH_OSD_DATA_TYPE_PAGES;
- req->r_data_in.pages = pages;
- req->r_data_in.length = len;
- req->r_data_in.alignment = 0;
+ ceph_osd_data_pages_init(&req->r_data_in, pages, len, 0,
+ false, false);
req->r_callback = finish_read;
req->r_inode = inode;
@@ -917,11 +915,8 @@ get_more_pages:
dout("writepages got %d pages at %llu~%llu\n",
locked_pages, offset, len);
- req->r_data_out.type = CEPH_OSD_DATA_TYPE_PAGES;
- req->r_data_out.pages = pages;
- req->r_data_out.length = len;
- req->r_data_out.alignment = 0;
- req->r_data_out.pages_from_pool = !!pool;
+ ceph_osd_data_pages_init(&req->r_data_out, pages, len, 0,
+ !!pool, false);
pages = NULL; /* request message now owns the pages array */
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,
unsigned long buf_align;
int ret;
struct timespec mtime = CURRENT_TIME;
+ bool own_pages = false;
if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
return -EROFS;
@@ -571,14 +572,11 @@ more:
if ((file->f_flags & O_SYNC) == 0) {
/* get a second commit callback */
req->r_safe_callback = sync_write_commit;
- req->r_data_out.own_pages = 1;
+ own_pages = true;
}
}
- req->r_data_out.type = CEPH_OSD_DATA_TYPE_PAGES;
- req->r_data_out.pages = pages;
- req->r_data_out.length = len;
- req->r_data_out.alignment = page_align;
- req->r_inode = inode;
+ ceph_osd_data_pages_init(&req->r_data_out, pages, len, page_align,
+ false, own_pages);
/* BUG_ON(vino.snap != CEPH_NOSNAP); */
ceph_osdc_build_request(req, pos, num_ops, ops,