From 0762ed2ced40bfe648378ef0e1635cf4d3a6fb76 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Tue, 25 Aug 2015 17:38:25 -0400 Subject: 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 --- fs/nfs/pnfs.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'fs/nfs/pnfs.h') 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 -- cgit v1.2.3