diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ext4_fs.h | 25 | ||||
-rw-r--r-- | include/linux/ext4_fs_i.h | 6 |
2 files changed, 7 insertions, 24 deletions
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h index 583049c1d366..300cc5a5adb9 100644 --- a/include/linux/ext4_fs.h +++ b/include/linux/ext4_fs.h | |||
@@ -1107,27 +1107,10 @@ extern void ext4_ext_init(struct super_block *); | |||
1107 | extern void ext4_ext_release(struct super_block *); | 1107 | extern void ext4_ext_release(struct super_block *); |
1108 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, | 1108 | extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, |
1109 | loff_t len); | 1109 | loff_t len); |
1110 | static inline int | 1110 | extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, |
1111 | ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, | 1111 | sector_t block, unsigned long max_blocks, |
1112 | unsigned long max_blocks, struct buffer_head *bh, | 1112 | struct buffer_head *bh, int create, |
1113 | int create, int extend_disksize) | 1113 | int extend_disksize); |
1114 | { | ||
1115 | int retval; | ||
1116 | mutex_lock(&EXT4_I(inode)->truncate_mutex); | ||
1117 | if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) { | ||
1118 | retval = ext4_ext_get_blocks(handle, inode, | ||
1119 | (ext4_lblk_t)block, max_blocks, | ||
1120 | bh, create, extend_disksize); | ||
1121 | } else { | ||
1122 | retval = ext4_get_blocks_handle(handle, inode, | ||
1123 | (ext4_lblk_t)block, max_blocks, | ||
1124 | bh, create, extend_disksize); | ||
1125 | } | ||
1126 | mutex_unlock(&EXT4_I(inode)->truncate_mutex); | ||
1127 | return retval; | ||
1128 | } | ||
1129 | |||
1130 | |||
1131 | #endif /* __KERNEL__ */ | 1114 | #endif /* __KERNEL__ */ |
1132 | 1115 | ||
1133 | #endif /* _LINUX_EXT4_FS_H */ | 1116 | #endif /* _LINUX_EXT4_FS_H */ |
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h index f1cd4934e46f..4377d249d378 100644 --- a/include/linux/ext4_fs_i.h +++ b/include/linux/ext4_fs_i.h | |||
@@ -139,16 +139,16 @@ struct ext4_inode_info { | |||
139 | __u16 i_extra_isize; | 139 | __u16 i_extra_isize; |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * truncate_mutex is for serialising ext4_truncate() against | 142 | * i_data_sem is for serialising ext4_truncate() against |
143 | * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's | 143 | * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's |
144 | * data tree are chopped off during truncate. We can't do that in | 144 | * data tree are chopped off during truncate. We can't do that in |
145 | * ext4 because whenever we perform intermediate commits during | 145 | * ext4 because whenever we perform intermediate commits during |
146 | * truncate, the inode and all the metadata blocks *must* be in a | 146 | * truncate, the inode and all the metadata blocks *must* be in a |
147 | * consistent state which allows truncation of the orphans to restart | 147 | * consistent state which allows truncation of the orphans to restart |
148 | * during recovery. Hence we must fix the get_block-vs-truncate race | 148 | * during recovery. Hence we must fix the get_block-vs-truncate race |
149 | * by other means, so we have truncate_mutex. | 149 | * by other means, so we have i_data_sem. |
150 | */ | 150 | */ |
151 | struct mutex truncate_mutex; | 151 | struct rw_semaphore i_data_sem; |
152 | struct inode vfs_inode; | 152 | struct inode vfs_inode; |
153 | 153 | ||
154 | unsigned long i_ext_generation; | 154 | unsigned long i_ext_generation; |