summaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2014-08-23 17:48:28 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-08-23 17:48:28 -0400
commit4631dbf677ded0419fee35ca7408285dabfaef1a (patch)
tree80976bb3bff717dbe00fb3d916deab9e237d1c37 /fs/ext4/ext4.h
parentc99d1e6e83b06744c75d9f5e491ed495a7086b7b (diff)
downloadop-kernel-dev-4631dbf677ded0419fee35ca7408285dabfaef1a.zip
op-kernel-dev-4631dbf677ded0419fee35ca7408285dabfaef1a.tar.gz
ext4: move i_size,i_disksize update routines to helper function
Cc: stable@vger.kernel.org # needed for bug fix patches Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r--fs/ext4/ext4.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 4d95c33..b0c225c 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2454,6 +2454,22 @@ static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize)
up_write(&EXT4_I(inode)->i_data_sem);
}
+/* Update i_size, i_disksize. Requires i_mutex to avoid races with truncate */
+static inline int ext4_update_inode_size(struct inode *inode, loff_t newsize)
+{
+ int changed = 0;
+
+ if (newsize > inode->i_size) {
+ i_size_write(inode, newsize);
+ changed = 1;
+ }
+ if (newsize > EXT4_I(inode)->i_disksize) {
+ ext4_update_i_disksize(inode, newsize);
+ changed |= 2;
+ }
+ return changed;
+}
+
struct ext4_group_info {
unsigned long bb_state;
struct rb_root bb_free_root;
OpenPOWER on IntegriCloud