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/filelayout | |
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/filelayout')
-rw-r--r-- | fs/nfs/filelayout/filelayout.c | 48 |
1 files changed, 10 insertions, 38 deletions
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c index e1e5ea262a13..91e88a7ecef0 100644 --- a/fs/nfs/filelayout/filelayout.c +++ b/fs/nfs/filelayout/filelayout.c | |||
@@ -960,48 +960,20 @@ filelayout_mark_request_commit(struct nfs_page *req, | |||
960 | { | 960 | { |
961 | struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg); | 961 | struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg); |
962 | u32 i, j; | 962 | u32 i, j; |
963 | struct list_head *list; | ||
964 | struct pnfs_commit_bucket *buckets; | ||
965 | 963 | ||
966 | if (fl->commit_through_mds) { | 964 | if (fl->commit_through_mds) { |
967 | list = &cinfo->mds->list; | 965 | nfs_request_add_commit_list(req, &cinfo->mds->list, cinfo); |
968 | spin_lock(cinfo->lock); | 966 | } else { |
969 | goto mds_commit; | 967 | /* Note that we are calling nfs4_fl_calc_j_index on each page |
970 | } | 968 | * that ends up being committed to a data server. An attractive |
971 | 969 | * alternative is to add a field to nfs_write_data and nfs_page | |
972 | /* Note that we are calling nfs4_fl_calc_j_index on each page | 970 | * to store the value calculated in filelayout_write_pagelist |
973 | * that ends up being committed to a data server. An attractive | 971 | * and just use that here. |
974 | * alternative is to add a field to nfs_write_data and nfs_page | ||
975 | * to store the value calculated in filelayout_write_pagelist | ||
976 | * and just use that here. | ||
977 | */ | ||
978 | j = nfs4_fl_calc_j_index(lseg, req_offset(req)); | ||
979 | i = select_bucket_index(fl, j); | ||
980 | spin_lock(cinfo->lock); | ||
981 | buckets = cinfo->ds->buckets; | ||
982 | list = &buckets[i].written; | ||
983 | if (list_empty(list)) { | ||
984 | /* Non-empty buckets hold a reference on the lseg. That ref | ||
985 | * is normally transferred to the COMMIT call and released | ||
986 | * there. It could also be released if the last req is pulled | ||
987 | * off due to a rewrite, in which case it will be done in | ||
988 | * pnfs_generic_clear_request_commit | ||
989 | */ | 972 | */ |
990 | buckets[i].wlseg = pnfs_get_lseg(lseg); | 973 | j = nfs4_fl_calc_j_index(lseg, req_offset(req)); |
974 | i = select_bucket_index(fl, j); | ||
975 | pnfs_layout_mark_request_commit(req, lseg, cinfo, i); | ||
991 | } | 976 | } |
992 | set_bit(PG_COMMIT_TO_DS, &req->wb_flags); | ||
993 | cinfo->ds->nwritten++; | ||
994 | |||
995 | mds_commit: | ||
996 | /* nfs_request_add_commit_list(). We need to add req to list without | ||
997 | * dropping cinfo lock. | ||
998 | */ | ||
999 | set_bit(PG_CLEAN, &(req)->wb_flags); | ||
1000 | nfs_list_add_request(req, list); | ||
1001 | cinfo->mds->ncommit++; | ||
1002 | spin_unlock(cinfo->lock); | ||
1003 | if (!cinfo->dreq) | ||
1004 | nfs_mark_page_unstable(req->wb_page); | ||
1005 | } | 977 | } |
1006 | 978 | ||
1007 | static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i) | 979 | static u32 calc_ds_index_from_commit(struct pnfs_layout_segment *lseg, u32 i) |