diff options
author | Tom Haynes <thomas.haynes@primarydata.com> | 2015-02-17 17:58:15 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-02-18 10:20:35 -0500 |
commit | 338d00cfef07d74a072f96821c64b20f98517d72 (patch) | |
tree | 6c08180ef0e965862675a33a53ccffb8f0d59114 /fs/nfs/pnfs_nfs.c | |
parent | 487b9b8afde60986b606b3ee05169fb893adc153 (diff) |
pnfs: Refactor the *_layout_mark_request_commit to use pnfs_layout_mark_request_commit
The File Layout's filelayout_mark_request_commit() is almost the
Flex File Layout's ff_layout_mark_request_commit(). And that can
be reduced by calling into nfs_request_add_commit_list().
Signed-off-by: Tom Haynes <loghyr@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs_nfs.c')
-rw-r--r-- | fs/nfs/pnfs_nfs.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c index fdc4f6562bb7..54e36b38fb5f 100644 --- a/fs/nfs/pnfs_nfs.c +++ b/fs/nfs/pnfs_nfs.c | |||
@@ -838,3 +838,33 @@ out_err: | |||
838 | return NULL; | 838 | return NULL; |
839 | } | 839 | } |
840 | EXPORT_SYMBOL_GPL(nfs4_decode_mp_ds_addr); | 840 | EXPORT_SYMBOL_GPL(nfs4_decode_mp_ds_addr); |
841 | |||
842 | void | ||
843 | pnfs_layout_mark_request_commit(struct nfs_page *req, | ||
844 | struct pnfs_layout_segment *lseg, | ||
845 | struct nfs_commit_info *cinfo, | ||
846 | u32 ds_commit_idx) | ||
847 | { | ||
848 | struct list_head *list; | ||
849 | struct pnfs_commit_bucket *buckets; | ||
850 | |||
851 | spin_lock(cinfo->lock); | ||
852 | buckets = cinfo->ds->buckets; | ||
853 | list = &buckets[ds_commit_idx].written; | ||
854 | if (list_empty(list)) { | ||
855 | /* Non-empty buckets hold a reference on the lseg. That ref | ||
856 | * is normally transferred to the COMMIT call and released | ||
857 | * there. It could also be released if the last req is pulled | ||
858 | * off due to a rewrite, in which case it will be done in | ||
859 | * pnfs_common_clear_request_commit | ||
860 | */ | ||
861 | WARN_ON_ONCE(buckets[ds_commit_idx].wlseg != NULL); | ||
862 | buckets[ds_commit_idx].wlseg = pnfs_get_lseg(lseg); | ||
863 | } | ||
864 | set_bit(PG_COMMIT_TO_DS, &req->wb_flags); | ||
865 | cinfo->ds->nwritten++; | ||
866 | spin_unlock(cinfo->lock); | ||
867 | |||
868 | nfs_request_add_commit_list(req, list, cinfo); | ||
869 | } | ||
870 | EXPORT_SYMBOL_GPL(pnfs_layout_mark_request_commit); | ||