ext4: Properly update i_disksize.
[safe/jmp/linux-2.6] / fs / ext4 / ext4.h
index e13b9de..3e47b99 100644 (file)
@@ -1218,6 +1218,17 @@ do {                                                             \
 #define EXT4_FREEBLOCKS_WATERMARK 0
 #endif
 
+static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize)
+{
+       /*
+        * XXX: replace with spinlock if seen contended -bzzz
+        */
+       down_write(&EXT4_I(inode)->i_data_sem);
+       if (newsize > EXT4_I(inode)->i_disksize)
+               EXT4_I(inode)->i_disksize = newsize;
+       up_write(&EXT4_I(inode)->i_data_sem);
+       return ;
+}
 
 /*
  * Inodes and files operations