diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-04-28 14:55:16 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-01 15:42:45 -0400 |
commit | 5a37f85131c526ed7a3991d4dc2845498f81c1de (patch) | |
tree | 47163949a691aa8353f41539003f7371f232e22c /fs/nfs/nfs4proc.c | |
parent | 778d28172f710184855bcfeadcdd6b46997c4de2 (diff) |
NFSv4: Don't request cache consistency attributes on some writes
We don't need cache consistency information when we're doing O_DIRECT
writes. Ditto for the case of delegated writes.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index c746b0cab49..64b67f353ed 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3370,7 +3370,7 @@ static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_write_data *data | |||
3370 | } | 3370 | } |
3371 | if (task->tk_status >= 0) { | 3371 | if (task->tk_status >= 0) { |
3372 | renew_lease(NFS_SERVER(inode), data->timestamp); | 3372 | renew_lease(NFS_SERVER(inode), data->timestamp); |
3373 | nfs_post_op_update_inode_force_wcc(inode, data->res.fattr); | 3373 | nfs_post_op_update_inode_force_wcc(inode, &data->fattr); |
3374 | } | 3374 | } |
3375 | return 0; | 3375 | return 0; |
3376 | } | 3376 | } |
@@ -3401,15 +3401,30 @@ void nfs4_reset_write(struct rpc_task *task, struct nfs_write_data *data) | |||
3401 | } | 3401 | } |
3402 | EXPORT_SYMBOL_GPL(nfs4_reset_write); | 3402 | EXPORT_SYMBOL_GPL(nfs4_reset_write); |
3403 | 3403 | ||
3404 | static | ||
3405 | bool nfs4_write_need_cache_consistency_data(const struct nfs_write_data *data) | ||
3406 | { | ||
3407 | const struct nfs_pgio_header *hdr = data->header; | ||
3408 | |||
3409 | /* Don't request attributes for pNFS or O_DIRECT writes */ | ||
3410 | if (data->ds_clp != NULL || hdr->dreq != NULL) | ||
3411 | return false; | ||
3412 | /* Otherwise, request attributes if and only if we don't hold | ||
3413 | * a delegation | ||
3414 | */ | ||
3415 | return nfs_have_delegation(hdr->inode, FMODE_READ) == 0; | ||
3416 | } | ||
3417 | |||
3404 | static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_message *msg) | 3418 | static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_message *msg) |
3405 | { | 3419 | { |
3406 | struct nfs_server *server = NFS_SERVER(data->header->inode); | 3420 | struct nfs_server *server = NFS_SERVER(data->header->inode); |
3407 | 3421 | ||
3408 | if (data->ds_clp) { | 3422 | if (!nfs4_write_need_cache_consistency_data(data)) { |
3409 | data->args.bitmask = NULL; | 3423 | data->args.bitmask = NULL; |
3410 | data->res.fattr = NULL; | 3424 | data->res.fattr = NULL; |
3411 | } else | 3425 | } else |
3412 | data->args.bitmask = server->cache_consistency_bitmask; | 3426 | data->args.bitmask = server->cache_consistency_bitmask; |
3427 | |||
3413 | if (!data->write_done_cb) | 3428 | if (!data->write_done_cb) |
3414 | data->write_done_cb = nfs4_write_done_cb; | 3429 | data->write_done_cb = nfs4_write_done_cb; |
3415 | data->res.server = server; | 3430 | data->res.server = server; |