aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-03-14 15:09:05 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:17:59 -0400
commit94fe8420bf519acd641ecbd442a0a79c1a024212 (patch)
tree71c979e66f4865841c347a5ccaf4b6e484569d5a /fs/ceph
parentacead002b200569273bed331c93c4a91d25e10b8 (diff)
ceph: define ceph_writepages_osd_request()
Mostly for readability, define ceph_writepages_osd_request() and use it to allocate the osd request for ceph_writepages_start(). 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.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 681463d5459b..f2de9ec27db3 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -654,6 +654,26 @@ static void alloc_page_vec(struct ceph_fs_client *fsc,
654 } 654 }
655} 655}
656 656
657static struct ceph_osd_request *
658ceph_writepages_osd_request(struct inode *inode, u64 offset, u64 *len,
659 struct ceph_snap_context *snapc,
660 int num_ops, struct ceph_osd_req_op *ops)
661{
662 struct ceph_fs_client *fsc;
663 struct ceph_inode_info *ci;
664 struct ceph_vino vino;
665
666 fsc = ceph_inode_to_client(inode);
667 ci = ceph_inode(inode);
668 vino = ceph_vino(inode);
669 /* BUG_ON(vino.snap != CEPH_NOSNAP); */
670
671 return ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
672 vino, offset, len, num_ops, ops, CEPH_OSD_OP_WRITE,
673 CEPH_OSD_FLAG_WRITE|CEPH_OSD_FLAG_ONDISK,
674 snapc, ci->i_truncate_seq, ci->i_truncate_size, true);
675}
676
657/* 677/*
658 * initiate async writeback 678 * initiate async writeback
659 */ 679 */
@@ -835,16 +855,9 @@ get_more_pages:
835 /* prepare async write request */ 855 /* prepare async write request */
836 offset = (u64) page_offset(page); 856 offset = (u64) page_offset(page);
837 len = wsize; 857 len = wsize;
838 vino = ceph_vino(inode); 858 req = ceph_writepages_osd_request(inode,
839 /* BUG_ON(vino.snap != CEPH_NOSNAP); */ 859 offset, &len, snapc,
840 req = ceph_osdc_new_request(&fsc->client->osdc, 860 num_ops, ops);
841 &ci->i_layout, vino, offset, &len,
842 num_ops, ops,
843 CEPH_OSD_OP_WRITE,
844 CEPH_OSD_FLAG_WRITE |
845 CEPH_OSD_FLAG_ONDISK,
846 snapc, ci->i_truncate_seq,
847 ci->i_truncate_size, true);
848 861
849 if (IS_ERR(req)) { 862 if (IS_ERR(req)) {
850 rc = PTR_ERR(req); 863 rc = PTR_ERR(req);
@@ -852,6 +865,7 @@ get_more_pages:
852 break; 865 break;
853 } 866 }
854 867
868 vino = ceph_vino(inode);
855 ceph_osdc_build_request(req, offset, 869 ceph_osdc_build_request(req, offset,
856 num_ops, ops, snapc, vino.snap, 870 num_ops, ops, snapc, vino.snap,
857 &inode->i_mtime); 871 &inode->i_mtime);