diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 13:26:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 13:26:37 -0400 |
commit | e4ce30f3779c2ddaa7dfaa4042209e5dbacbada5 (patch) | |
tree | cc64c1dcd16b5dbf71ebc8338b339e6fb04abaee /fs/ext4/ialloc.c | |
parent | b899ebeb05da4287ce845976727e3e83dadd25d5 (diff) | |
parent | 14ece1028b3ed53ffec1b1213ffc6acaf79ad77c (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (40 commits)
ext4: Make fsync sync new parent directories in no-journal mode
ext4: Drop whitespace at end of lines
ext4: Fix compat EXT4_IOC_ADD_GROUP
ext4: Conditionally define compat ioctl numbers
tracing: Convert more ext4 events to DEFINE_EVENT
ext4: Add new tracepoints to track mballoc's buddy bitmap loads
ext4: Add a missing trace hook
ext4: restart ext4_ext_remove_space() after transaction restart
ext4: Clear the EXT4_EOFBLOCKS_FL flag only when warranted
ext4: Avoid crashing on NULL ptr dereference on a filesystem error
ext4: Use bitops to read/modify i_flags in struct ext4_inode_info
ext4: Convert calls of ext4_error() to EXT4_ERROR_INODE()
ext4: Convert callers of ext4_get_blocks() to use ext4_map_blocks()
ext4: Add new abstraction ext4_map_blocks() underneath ext4_get_blocks()
ext4: Use our own write_cache_pages()
ext4: Show journal_checksum option
ext4: Fix for ext4_mb_collect_stats()
ext4: check for a good block group before loading buddy pages
ext4: Prevent creation of files larger than RLIMIT_FSIZE using fallocate
ext4: Remove extraneous newlines in ext4_msg() calls
...
Fixed up trivial conflict in fs/ext4/fsync.c
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r-- | fs/ext4/ialloc.c | 89 |
1 files changed, 41 insertions, 48 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 1a0e183a2f04..25c4b3173fd9 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -240,56 +240,49 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) | |||
240 | if (fatal) | 240 | if (fatal) |
241 | goto error_return; | 241 | goto error_return; |
242 | 242 | ||
243 | /* Ok, now we can actually update the inode bitmaps.. */ | 243 | fatal = -ESRCH; |
244 | cleared = ext4_clear_bit_atomic(ext4_group_lock_ptr(sb, block_group), | 244 | gdp = ext4_get_group_desc(sb, block_group, &bh2); |
245 | bit, bitmap_bh->b_data); | 245 | if (gdp) { |
246 | if (!cleared) | ||
247 | ext4_error(sb, "bit already cleared for inode %lu", ino); | ||
248 | else { | ||
249 | gdp = ext4_get_group_desc(sb, block_group, &bh2); | ||
250 | |||
251 | BUFFER_TRACE(bh2, "get_write_access"); | 246 | BUFFER_TRACE(bh2, "get_write_access"); |
252 | fatal = ext4_journal_get_write_access(handle, bh2); | 247 | fatal = ext4_journal_get_write_access(handle, bh2); |
253 | if (fatal) goto error_return; | 248 | } |
254 | 249 | ext4_lock_group(sb, block_group); | |
255 | if (gdp) { | 250 | cleared = ext4_clear_bit(bit, bitmap_bh->b_data); |
256 | ext4_lock_group(sb, block_group); | 251 | if (fatal || !cleared) { |
257 | count = ext4_free_inodes_count(sb, gdp) + 1; | 252 | ext4_unlock_group(sb, block_group); |
258 | ext4_free_inodes_set(sb, gdp, count); | 253 | goto out; |
259 | if (is_directory) { | 254 | } |
260 | count = ext4_used_dirs_count(sb, gdp) - 1; | ||
261 | ext4_used_dirs_set(sb, gdp, count); | ||
262 | if (sbi->s_log_groups_per_flex) { | ||
263 | ext4_group_t f; | ||
264 | |||
265 | f = ext4_flex_group(sbi, block_group); | ||
266 | atomic_dec(&sbi->s_flex_groups[f].used_dirs); | ||
267 | } | ||
268 | 255 | ||
269 | } | 256 | count = ext4_free_inodes_count(sb, gdp) + 1; |
270 | gdp->bg_checksum = ext4_group_desc_csum(sbi, | 257 | ext4_free_inodes_set(sb, gdp, count); |
271 | block_group, gdp); | 258 | if (is_directory) { |
272 | ext4_unlock_group(sb, block_group); | 259 | count = ext4_used_dirs_count(sb, gdp) - 1; |
273 | percpu_counter_inc(&sbi->s_freeinodes_counter); | 260 | ext4_used_dirs_set(sb, gdp, count); |
274 | if (is_directory) | 261 | percpu_counter_dec(&sbi->s_dirs_counter); |
275 | percpu_counter_dec(&sbi->s_dirs_counter); | ||
276 | |||
277 | if (sbi->s_log_groups_per_flex) { | ||
278 | ext4_group_t f; | ||
279 | |||
280 | f = ext4_flex_group(sbi, block_group); | ||
281 | atomic_inc(&sbi->s_flex_groups[f].free_inodes); | ||
282 | } | ||
283 | } | ||
284 | BUFFER_TRACE(bh2, "call ext4_handle_dirty_metadata"); | ||
285 | err = ext4_handle_dirty_metadata(handle, NULL, bh2); | ||
286 | if (!fatal) fatal = err; | ||
287 | } | 262 | } |
288 | BUFFER_TRACE(bitmap_bh, "call ext4_handle_dirty_metadata"); | 263 | gdp->bg_checksum = ext4_group_desc_csum(sbi, block_group, gdp); |
289 | err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); | 264 | ext4_unlock_group(sb, block_group); |
290 | if (!fatal) | 265 | |
291 | fatal = err; | 266 | percpu_counter_inc(&sbi->s_freeinodes_counter); |
292 | sb->s_dirt = 1; | 267 | if (sbi->s_log_groups_per_flex) { |
268 | ext4_group_t f = ext4_flex_group(sbi, block_group); | ||
269 | |||
270 | atomic_inc(&sbi->s_flex_groups[f].free_inodes); | ||
271 | if (is_directory) | ||
272 | atomic_dec(&sbi->s_flex_groups[f].used_dirs); | ||
273 | } | ||
274 | BUFFER_TRACE(bh2, "call ext4_handle_dirty_metadata"); | ||
275 | fatal = ext4_handle_dirty_metadata(handle, NULL, bh2); | ||
276 | out: | ||
277 | if (cleared) { | ||
278 | BUFFER_TRACE(bitmap_bh, "call ext4_handle_dirty_metadata"); | ||
279 | err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); | ||
280 | if (!fatal) | ||
281 | fatal = err; | ||
282 | sb->s_dirt = 1; | ||
283 | } else | ||
284 | ext4_error(sb, "bit already cleared for inode %lu", ino); | ||
285 | |||
293 | error_return: | 286 | error_return: |
294 | brelse(bitmap_bh); | 287 | brelse(bitmap_bh); |
295 | ext4_std_error(sb, fatal); | 288 | ext4_std_error(sb, fatal); |
@@ -499,7 +492,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent, | |||
499 | 492 | ||
500 | if (S_ISDIR(mode) && | 493 | if (S_ISDIR(mode) && |
501 | ((parent == sb->s_root->d_inode) || | 494 | ((parent == sb->s_root->d_inode) || |
502 | (EXT4_I(parent)->i_flags & EXT4_TOPDIR_FL))) { | 495 | (ext4_test_inode_flag(parent, EXT4_INODE_TOPDIR)))) { |
503 | int best_ndir = inodes_per_group; | 496 | int best_ndir = inodes_per_group; |
504 | int ret = -1; | 497 | int ret = -1; |
505 | 498 | ||
@@ -1041,7 +1034,7 @@ got: | |||
1041 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) { | 1034 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) { |
1042 | /* set extent flag only for directory, file and normal symlink*/ | 1035 | /* set extent flag only for directory, file and normal symlink*/ |
1043 | if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) { | 1036 | if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) { |
1044 | EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; | 1037 | ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS); |
1045 | ext4_ext_tree_init(handle, inode); | 1038 | ext4_ext_tree_init(handle, inode); |
1046 | } | 1039 | } |
1047 | } | 1040 | } |