summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_inode.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-02-29 13:53:49 +0400
committerBen Myers <bpm@sgi.com>2012-03-05 21:19:26 +0400
commit6923e686f19cb7017fc9777a10e06c2e2b2a2936 (patch)
tree14398306804485fd7c0f04538d76f042f5cec6d9 /fs/xfs/xfs_inode.h
parentaa6bf01d391935a8929333bc2e243084ea0c58db (diff)
downloadlinux-6923e686f19cb7017fc9777a10e06c2e2b2a2936.tar.xz
xfs: do not require an ioend for new EOF calculation
Replace xfs_ioend_new_eof with a new inline xfs_new_eof helper that doesn't require and ioend, and is available also outside of xfs_aops.c. Also make the code a bit more clear by using a normal if statement instead of a slightly misleading MIN(). Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.h')
-rw-r--r--fs/xfs/xfs_inode.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index eda493780395..7f90469141d7 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -275,6 +275,20 @@ static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
}
/*
+ * If this I/O goes past the on-disk inode size update it unless it would
+ * be past the current in-core inode size.
+ */
+static inline xfs_fsize_t
+xfs_new_eof(struct xfs_inode *ip, xfs_fsize_t new_size)
+{
+ xfs_fsize_t i_size = i_size_read(VFS_I(ip));
+
+ if (new_size > i_size)
+ new_size = i_size;
+ return new_size > ip->i_d.di_size ? new_size : 0;
+}
+
+/*
* i_flags helper functions
*/
static inline void