summaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs.h
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2015-08-25 17:38:25 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-08-25 19:42:43 -0400
commit0762ed2ced40bfe648378ef0e1635cf4d3a6fb76 (patch)
tree53329ba229bf0d7bc73c433a664ea551828444c9 /fs/nfs/pnfs.h
parent03772d2f00313bb22d91b2019cb8e6e91b415653 (diff)
downloadop-kernel-dev-0762ed2ced40bfe648378ef0e1635cf4d3a6fb76.zip
op-kernel-dev-0762ed2ced40bfe648378ef0e1635cf4d3a6fb76.tar.gz
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 869069d..78c9351 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
OpenPOWER on IntegriCloud