summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-05-08NFS: nfs_inode_return_delegation() should always flush dirty dataTrond Myklebust
The assumption is that if you are in a situation where you need to return the delegation, then you should probably stop caching the data anyway. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-08NFS: Don't do a full flush to disk on close() if we hold a delegationTrond Myklebust
If we hold a delegation then we know that it should be safe to continue to cache the data beyond the close(). However since the process that wrote the data may die after close(), we may still want to send the data to server before those RPCSEC_GSS credentials expire. We therefore compromise by starting writeback to the server, but don't wait for completion. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-04NFS: Fix sparse warningsTrond Myklebust
Fix the following sparse warnings: fs/nfs/direct.c:221:6: warning: symbol 'nfs_direct_readpage_release' was not declared. Should it be static? fs/nfs/read.c:38:43: warning: non-ANSI function declaration of function 'nfs_readhdr_alloc' fs/nfs/objlayout/objio_osd.c:214:5: warning: symbol '__alloc_objio_seg' was not declared. Should it be static? Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com> Cc: Boaz Harrosh <bharrosh@panasas.com>
2012-05-04NFS: Fix O_DIRECT compile warningsTrond Myklebust
Fix the following compile warnings: fs/nfs/direct.c: In function 'nfs_direct_read_schedule_segment': fs/nfs/direct.c:325:11: warning: comparison of distinct pointer types lacks a cast [enabled by default] fs/nfs/direct.c:325:11: warning: comparison of distinct pointer types lacks a cast [enabled by default] fs/nfs/direct.c:325:11: warning: comparison of distinct pointer types lacks a cast [enabled by default] fs/nfs/direct.c:352:27: warning: comparison of distinct pointer types lacks a cast [enabled by default] fs/nfs/direct.c: In function 'nfs_direct_write_schedule_segment': fs/nfs/direct.c:622:11: warning: comparison of distinct pointer types lacks a cast [enabled by default] fs/nfs/direct.c:622:11: warning: comparison of distinct pointer types lacks a cast [enabled by default] fs/nfs/direct.c:622:11: warning: comparison of distinct pointer types lacks a cast [enabled by default] fs/nfs/direct.c:650:27: warning: comparison of distinct pointer types lacks a cast [enabled by default] Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au>
2012-05-01NFS: Adapt readdirplus to application usage patternsTrond Myklebust
While the use of READDIRPLUS is significantly more efficient than READDIR followed by many LOOKUP calls, it is still less efficient than just READDIR if the attributes are not required. This patch tracks when lookups are attempted on the directory, and uses that information to selectively disable READDIRPLUS on that directory. The first 'readdir' call is always served using READDIRPLUS. Subsequent calls only use READDIRPLUS if there was a successful lookup or revalidation on a child in the mean time. Credit for the original idea should go to Neil Brown. See: http://www.spinics.net/lists/linux-nfs/msg19996.html However, the implementation in this patch differs from Neil's in that it focuses on tracking lookups rather than calls to stat(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Neil Brown <neilb@suse.de>
2012-05-01NFSv4: COMMIT does not need post-op attributesTrond Myklebust
No attributes are supposed to change during a COMMIT call, so there is no need to request post-op attributes. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFSv4: Don't request cache consistency attributes on some writesTrond Myklebust
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>
2012-05-01NFSv4: Simplify the NFSv4 REMOVE, LINK and RENAME compoundsTrond Myklebust
Get rid of the post-op GETATTR on the directory in order to reduce the amount of processing done on the server. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFSv4: Simplify the NFSv4 CREATE compoundTrond Myklebust
Get rid of the post-op GETATTR on the directory in order to reduce the amount of processing done on the server. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFSv4: Simplify the NFSv4 OPEN compoundTrond Myklebust
Get rid of the post-op GETATTR on the directory in order to reduce the amount of processing done on the server. The cost is that if we later need to stat() the directory, then we know that the ctime and mtime are likely to be invalid. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFS: Simplify the cache invalidation codeTrond Myklebust
Now that NFSv2 and NFSv3 have simulated change attributes, instead of using all three of mtime, ctime and change attribute to manage data cache consistency, we can simplify the code to just use the change attribute. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFSv2/v3: Simulate the change attributeTrond Myklebust
Use the ctime to simulate a change attribute for NFSv2 and NFSv3. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFS: Change attribute updates should set NFS_INO_REVAL_PAGECACHETrond Myklebust
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFS: Simplify nfs_fhget()Trond Myklebust
If the inode is being initialised, there is no point in setting flags such as NFS_INO_INVALID_ACCESS, NFS_INO_INVALID_ACL or NFS_INO_INVALID_DATA since there are no cached access calls, acls or data caches to invalidate. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFS: Always trust the PageUptodate flag when we have a delegationTrond Myklebust
We can always use the optimal full page write if we know that we hold a delegation. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFS: Optimise away nfs_check_inode_attributes() when holding a delegationTrond Myklebust
We already know that the attribute cache is valid. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFS: Don't force page cache revalidations when holding a delegationTrond Myklebust
If we're holding a delegation, then we already know that our page cache is valid. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFSv4: Retrieve attributes _before_ calling delegreturnTrond Myklebust
In order to retrieve cache consistency attributes before anyone else has a chance to change the inode, we need to put the GETATTR op _before_ the DELEGRETURN op. We can then use that as part of a 'nfs_post_op_update_inode_force_wcc()' call, to ensure that we update the attributes without clearing our cached data. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFSv4: Delegreturn only needs the cache consistency bitmaskTrond Myklebust
In order to do close-to-open cache consistency checking after a delegreturn, we don't need to retrieve the full set of attributes. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFSv4: Fix a typo in NFS4_enc_link_szTrond Myklebust
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-05-01NFS: Simplify the nfs_read_completion functionsTrond Myklebust
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
2012-05-01NFS: Clean up nfs read and write error pathsTrond Myklebust
Move the error handling for nfs_generic_pagein() into a single function. Ditto for nfs_generic_flush(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
2012-05-01NFS: Read cleanupsTrond Myklebust
Remove unused variables, and reformat some code. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
2012-04-30NFS: Fix a compile issue when CONFIG_NFS_V4_1 is undefinedTrond Myklebust
struct nfs_direct_req can't compile when struct pnfs_ds_commit_info is undefined. Reported-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
2012-04-30NFS: Use kmem_cache_zalloc() in nfs_direct_req_allocTrond Myklebust
Simplify the initialisation of O_DIRECT requests. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
2012-04-30NFS: Simplify O_DIRECT page referencingTrond Myklebust
The O_DIRECT code shouldn't need to hold 2 references to each page. The reference held by the struct nfs_page should suffice. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
2012-04-30NFS: O_DIRECT pgio_completion_ops error_cleanup must unlock the requestTrond Myklebust
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
2012-04-30NFS: Ensure that we break out of read/write_schedule_segment on errorTrond Myklebust
Currently we do break out of the for() loop, but we also need to break out of the enclosing do {} while()... Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Fred Isaman <iisaman@netapp.com>
2012-04-30NFS: Define dummy nfs_init_cinfo() and nfs_init_cinfo_from_inode()Bryan Schumaker
These are needed when v3 and v4 are not enabled. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-30NFS: Define nfs_direct_write_schedule_work() when v3 and v4 are disabledBryan Schumaker
v2 doesn't have commits, so this function can be a no-op. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-30NFS: pnfs_pageio_init_read() and init_write() need an extra argumentBryan Schumaker
This is only when CONFIG_NFS_V4_1 isn't enabled. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Acked-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: Fix a use-before-initialised warning in fs/nfs/write.c and fs/nfs/pnfs.cTrond Myklebust
If the allocation of nfs_write_header fails, the list of nfs_pages that needs to be cleaned up is still on desc->pg_list... Reported-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Acked-by: Fred Isaman <iisaman@netapp.com>
2012-04-27NFS: Remove extra rpc_clnt argument to proc_lookupBryan Schumaker
Now that I'm doing secinfo automatically in the v4 code this extra argument isn't needed. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: Create a submount rpc_opBryan Schumaker
This simplifies the code for v2 and v3 and gives v4 a chance to decide on referrals without needing to modify the generic client. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: Remove secinfo knowledge out of the generic clientBryan Schumaker
And also remove the unneeded rpc_op. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: Prevent garbage cinfo->ds from leaking outFred Isaman
This is a bugfix that applies on top of the previous directio patches, that fixes a bug introduced in "NFS: create struct nfs_commit_info". Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: rewrite directio write to use async coalesce codeFred Isaman
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>
2012-04-27NFS: avoid some stat gathering for direct ioFred Isaman
Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: add dreq to nfs_commit_infoFred Isaman
Need this to pass into nfs_commitdata_init, in order to keep data->dreq accurate. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: create nfs_commit_completion_opsFred Isaman
Factors out the code that needs to change when directio starts using these code paths. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: create struct nfs_commit_infoFred Isaman
It is COMMIT that is handled the most differently between the paged and direct paths. Create a structure that encapsulates everything either path needs to know about the commit state. We could use void to hide some of the layout driver stuff, but Trond suggests pulling it out to ensure type checking, given the huge changes being made, and the fact that it doesn't interfere with other drivers. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: create nfs_generic_commit_listFred Isaman
Simple refactoring. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: rewrite directio read to use async coalesce codeFred Isaman
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>
2012-04-27NFS: prepare coalesce testing for directioFred Isaman
The coalesce code made assumptions that will no longer be true once non-page aligned io occurs. This introduces no change in current behavior, but allows for more general situations to come. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: remove unused wb_complete field from struct nfs_pageFred Isaman
Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: create completion structure to pass into page_init functionsFred Isaman
Factors out the code that will need to change when directio starts using these code paths. This will allow directio to use the generic pagein and flush routines Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: merge _full and _partial write rpc_opsFred Isaman
Decouple nfs_pgio_header and nfs_write_data, and have (possibly multiple) nfs_write_datas each take a refcount on nfs_pgio_header. For the moment keeps nfs_write_header as a way to preallocate a single nfs_write_data with the nfs_pgio_header. The code doesn't need this, and would be prettier without, but given the amount of churn I am already introducing I didn't want to play with tuning new mempools. This also fixes bug in pnfs_ld_handle_write_error. In the case of desc->pg_bsize < PAGE_CACHE_SIZE, the pages list was empty, causing replay attempt to do nothing. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: merge _full and _partial read rpc_opsFred Isaman
Decouple nfs_pgio_header and nfs_read_data, and have (possibly multiple) nfs_read_datas each take a refcount on nfs_pgio_header. For the moment keeps nfs_read_header as a way to preallocate a single nfs_read_data with the nfs_pgio_header. The code doesn't need this, and would be prettier without, but given the amount of churn I am already introducing I didn't want to play with tuning new mempools. This also fixes bug in pnfs_ld_handle_read_error. In the case of desc->pg_bsize < PAGE_CACHE_SIZE, the pages list was empty, causing replay attempt to do nothing. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: create struct nfs_page_arrayFred Isaman
Both nfs_read_data and nfs_write_data devote several fields which can be combined into a single shared struct. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2012-04-27NFS: create common nfs_pgio_header for both read and writeFred Isaman
In order to avoid duplicating all the data in nfs_read_data whenever we split it up into multiple RPC calls (either due to a short read result or due to rsize < PAGE_SIZE), we split out the bits that are the same per RPC call into a separate "header" structure. The goal this patch moves towards is to have a single header refcounted by several rpc_data structures. Thus, want to always refer from rpc_data to the header, and not the other way. This patch comes close to that ideal, but the directio code currently needs some special casing, isolated in the nfs_direct_[read_write]hdr_release() functions. This will be dealt with in a future patch. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>