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>
This commit is contained in:
Alex Elder
2013-04-03 01:28:57 -05:00
committed by Sage Weil
parent 9fc6e06471
commit 43bfe5de9f
5 changed files with 63 additions and 40 deletions

View File

@@ -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,