diff options
author | Fred Isaman <iisaman@netapp.com> | 2012-04-20 14:47:57 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-04-27 14:10:39 -0400 |
commit | 1763da1234cba663b849476d451bdccac5147859 (patch) | |
tree | b2b4bf3e1ce8624217c78508054fc620aac79a55 /fs/nfs/nfs4filelayout.c | |
parent | 56f9cd684d25f1bae901c5a872b8427f8b417c3f (diff) |
NFS: rewrite directio write to use async coalesce code
This also has the advantage that it allows directio to use pnfs.
Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4filelayout.c')
-rw-r--r-- | fs/nfs/nfs4filelayout.c | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index 26d1da486761..806a55f513d9 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -996,12 +996,9 @@ static int filelayout_initiate_commit(struct nfs_commit_data *data, int how) | |||
996 | } | 996 | } |
997 | 997 | ||
998 | static int | 998 | static int |
999 | filelayout_scan_ds_commit_list(struct pnfs_commit_bucket *bucket, | 999 | transfer_commit_list(struct list_head *src, struct list_head *dst, |
1000 | struct nfs_commit_info *cinfo, | 1000 | struct nfs_commit_info *cinfo, int max) |
1001 | int max) | ||
1002 | { | 1001 | { |
1003 | struct list_head *src = &bucket->written; | ||
1004 | struct list_head *dst = &bucket->committing; | ||
1005 | struct nfs_page *req, *tmp; | 1002 | struct nfs_page *req, *tmp; |
1006 | int ret = 0; | 1003 | int ret = 0; |
1007 | 1004 | ||
@@ -1014,9 +1011,22 @@ filelayout_scan_ds_commit_list(struct pnfs_commit_bucket *bucket, | |||
1014 | clear_bit(PG_COMMIT_TO_DS, &req->wb_flags); | 1011 | clear_bit(PG_COMMIT_TO_DS, &req->wb_flags); |
1015 | nfs_list_add_request(req, dst); | 1012 | nfs_list_add_request(req, dst); |
1016 | ret++; | 1013 | ret++; |
1017 | if (ret == max) | 1014 | if ((ret == max) && !cinfo->dreq) |
1018 | break; | 1015 | break; |
1019 | } | 1016 | } |
1017 | return ret; | ||
1018 | } | ||
1019 | |||
1020 | static int | ||
1021 | filelayout_scan_ds_commit_list(struct pnfs_commit_bucket *bucket, | ||
1022 | struct nfs_commit_info *cinfo, | ||
1023 | int max) | ||
1024 | { | ||
1025 | struct list_head *src = &bucket->written; | ||
1026 | struct list_head *dst = &bucket->committing; | ||
1027 | int ret; | ||
1028 | |||
1029 | ret = transfer_commit_list(src, dst, cinfo, max); | ||
1020 | if (ret) { | 1030 | if (ret) { |
1021 | cinfo->ds->nwritten -= ret; | 1031 | cinfo->ds->nwritten -= ret; |
1022 | cinfo->ds->ncommitting += ret; | 1032 | cinfo->ds->ncommitting += ret; |
@@ -1046,6 +1056,27 @@ static int filelayout_scan_commit_lists(struct nfs_commit_info *cinfo, | |||
1046 | return rv; | 1056 | return rv; |
1047 | } | 1057 | } |
1048 | 1058 | ||
1059 | /* Pull everything off the committing lists and dump into @dst */ | ||
1060 | static void filelayout_recover_commit_reqs(struct list_head *dst, | ||
1061 | struct nfs_commit_info *cinfo) | ||
1062 | { | ||
1063 | struct pnfs_commit_bucket *b; | ||
1064 | int i; | ||
1065 | |||
1066 | /* NOTE cinfo->lock is NOT held, relying on fact that this is | ||
1067 | * only called on single thread per dreq. | ||
1068 | * Can't take the lock because need to do put_lseg | ||
1069 | */ | ||
1070 | for (i = 0, b = cinfo->ds->buckets; i < cinfo->ds->nbuckets; i++, b++) { | ||
1071 | if (transfer_commit_list(&b->written, dst, cinfo, 0)) { | ||
1072 | BUG_ON(!list_empty(&b->written)); | ||
1073 | put_lseg(b->wlseg); | ||
1074 | b->wlseg = NULL; | ||
1075 | } | ||
1076 | } | ||
1077 | cinfo->ds->nwritten = 0; | ||
1078 | } | ||
1079 | |||
1049 | static unsigned int | 1080 | static unsigned int |
1050 | alloc_ds_commits(struct nfs_commit_info *cinfo, struct list_head *list) | 1081 | alloc_ds_commits(struct nfs_commit_info *cinfo, struct list_head *list) |
1051 | { | 1082 | { |
@@ -1170,6 +1201,7 @@ static struct pnfs_layoutdriver_type filelayout_type = { | |||
1170 | .mark_request_commit = filelayout_mark_request_commit, | 1201 | .mark_request_commit = filelayout_mark_request_commit, |
1171 | .clear_request_commit = filelayout_clear_request_commit, | 1202 | .clear_request_commit = filelayout_clear_request_commit, |
1172 | .scan_commit_lists = filelayout_scan_commit_lists, | 1203 | .scan_commit_lists = filelayout_scan_commit_lists, |
1204 | .recover_commit_reqs = filelayout_recover_commit_reqs, | ||
1173 | .commit_pagelist = filelayout_commit_pagelist, | 1205 | .commit_pagelist = filelayout_commit_pagelist, |
1174 | .read_pagelist = filelayout_read_pagelist, | 1206 | .read_pagelist = filelayout_read_pagelist, |
1175 | .write_pagelist = filelayout_write_pagelist, | 1207 | .write_pagelist = filelayout_write_pagelist, |