Commit 94fe8420bf519acd641ecbd442a0a79c1a024212
Committed by
Sage Weil
1 parent
acead002b2
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 24 additions and 10 deletions Side-by-side Diff
fs/ceph/addr.c
... | ... | @@ -654,6 +654,26 @@ |
654 | 654 | } |
655 | 655 | } |
656 | 656 | |
657 | +static struct ceph_osd_request * | |
658 | +ceph_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 | 678 | * initiate async writeback |
659 | 679 | */ |
... | ... | @@ -835,16 +855,9 @@ |
835 | 855 | /* prepare async write request */ |
836 | 856 | offset = (u64) page_offset(page); |
837 | 857 | len = wsize; |
838 | - vino = ceph_vino(inode); | |
839 | - /* BUG_ON(vino.snap != CEPH_NOSNAP); */ | |
840 | - req = ceph_osdc_new_request(&fsc->client->osdc, | |
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); | |
858 | + req = ceph_writepages_osd_request(inode, | |
859 | + offset, &len, snapc, | |
860 | + num_ops, ops); | |
848 | 861 | |
849 | 862 | if (IS_ERR(req)) { |
850 | 863 | rc = PTR_ERR(req); |
... | ... | @@ -852,6 +865,7 @@ |
852 | 865 | break; |
853 | 866 | } |
854 | 867 | |
868 | + vino = ceph_vino(inode); | |
855 | 869 | ceph_osdc_build_request(req, offset, |
856 | 870 | num_ops, ops, snapc, vino.snap, |
857 | 871 | &inode->i_mtime); |