summaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs.h
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2015-08-25 23:38:25 +0200
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-08-26 01:42:43 +0200
commit0762ed2ced40bfe648378ef0e1635cf4d3a6fb76 (patch)
tree53329ba229bf0d7bc73c433a664ea551828444c9 /fs/nfs/pnfs.h
parentNFSv4.1/pnfs: Allow pNFS device drivers to customise layout segment insertion (diff)
downloadlinux-0762ed2ced40bfe648378ef0e1635cf4d3a6fb76.tar.xz
linux-0762ed2ced40bfe648378ef0e1635cf4d3a6fb76.zip
NFSv4.1/flexfiles: Allow coalescing of new layout segments and existing ones
In order to ensure atomicity of updates, we merge the old layout segments into the new ones, and then invalidate the old ones. Also ensure that we order the list of layout segments so that RO segments are preferred over RW. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs.h')
-rw-r--r--fs/nfs/pnfs.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 869069d8b996..78c9351ff117 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -539,6 +539,22 @@ pnfs_use_threshold(struct nfs4_threshold **dst, struct nfs4_threshold *src,
nfss->pnfs_curr_ld->id == src->l_type);
}
+static inline u64
+pnfs_calc_offset_end(u64 offset, u64 len)
+{
+ if (len == NFS4_MAX_UINT64 || len >= NFS4_MAX_UINT64 - offset)
+ return NFS4_MAX_UINT64;
+ return offset + len - 1;
+}
+
+static inline u64
+pnfs_calc_offset_length(u64 offset, u64 end)
+{
+ if (end == NFS4_MAX_UINT64 || end <= offset)
+ return NFS4_MAX_UINT64;
+ return 1 + end - offset;
+}
+
extern unsigned int layoutstats_timer;
#ifdef NFS_DEBUG