aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/ialloc.c11
-rw-r--r--fs/ext4/super.c60
-rw-r--r--include/linux/ext4_fs.h6
3 files changed, 70 insertions, 7 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 7b5cfa62b663..00b152b92480 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -748,13 +748,10 @@ got:
748 if (test_opt(sb, EXTENTS)) { 748 if (test_opt(sb, EXTENTS)) {
749 EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; 749 EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
750 ext4_ext_tree_init(handle, inode); 750 ext4_ext_tree_init(handle, inode);
751 if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) { 751 err = ext4_update_incompat_feature(handle, sb,
752 err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh); 752 EXT4_FEATURE_INCOMPAT_EXTENTS);
753 if (err) goto fail; 753 if (err)
754 EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS); 754 goto fail;
755 BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "call ext4_journal_dirty_metadata");
756 err = ext4_journal_dirty_metadata(handle, EXT4_SB(sb)->s_sbh);
757 }
758 } 755 }
759 756
760 ext4_debug("allocating inode %lu\n", inode->i_ino); 757 ext4_debug("allocating inode %lu\n", inode->i_ino);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index df8842b43544..4d7f33f79552 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -373,6 +373,66 @@ void ext4_update_dynamic_rev(struct super_block *sb)
373 */ 373 */
374} 374}
375 375
376int ext4_update_compat_feature(handle_t *handle,
377 struct super_block *sb, __u32 compat)
378{
379 int err = 0;
380 if (!EXT4_HAS_COMPAT_FEATURE(sb, compat)) {
381 err = ext4_journal_get_write_access(handle,
382 EXT4_SB(sb)->s_sbh);
383 if (err)
384 return err;
385 EXT4_SET_COMPAT_FEATURE(sb, compat);
386 sb->s_dirt = 1;
387 handle->h_sync = 1;
388 BUFFER_TRACE(EXT4_SB(sb)->s_sbh,
389 "call ext4_journal_dirty_met adata");
390 err = ext4_journal_dirty_metadata(handle,
391 EXT4_SB(sb)->s_sbh);
392 }
393 return err;
394}
395
396int ext4_update_rocompat_feature(handle_t *handle,
397 struct super_block *sb, __u32 rocompat)
398{
399 int err = 0;
400 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, rocompat)) {
401 err = ext4_journal_get_write_access(handle,
402 EXT4_SB(sb)->s_sbh);
403 if (err)
404 return err;
405 EXT4_SET_RO_COMPAT_FEATURE(sb, rocompat);
406 sb->s_dirt = 1;
407 handle->h_sync = 1;
408 BUFFER_TRACE(EXT4_SB(sb)->s_sbh,
409 "call ext4_journal_dirty_met adata");
410 err = ext4_journal_dirty_metadata(handle,
411 EXT4_SB(sb)->s_sbh);
412 }
413 return err;
414}
415
416int ext4_update_incompat_feature(handle_t *handle,
417 struct super_block *sb, __u32 incompat)
418{
419 int err = 0;
420 if (!EXT4_HAS_INCOMPAT_FEATURE(sb, incompat)) {
421 err = ext4_journal_get_write_access(handle,
422 EXT4_SB(sb)->s_sbh);
423 if (err)
424 return err;
425 EXT4_SET_INCOMPAT_FEATURE(sb, incompat);
426 sb->s_dirt = 1;
427 handle->h_sync = 1;
428 BUFFER_TRACE(EXT4_SB(sb)->s_sbh,
429 "call ext4_journal_dirty_met adata");
430 err = ext4_journal_dirty_metadata(handle,
431 EXT4_SB(sb)->s_sbh);
432 }
433 return err;
434}
435
376/* 436/*
377 * Open the external journal device 437 * Open the external journal device
378 */ 438 */
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index e1103c2a0d42..429dbfc851ea 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -989,6 +989,12 @@ extern void ext4_abort (struct super_block *, const char *, const char *, ...)
989extern void ext4_warning (struct super_block *, const char *, const char *, ...) 989extern void ext4_warning (struct super_block *, const char *, const char *, ...)
990 __attribute__ ((format (printf, 3, 4))); 990 __attribute__ ((format (printf, 3, 4)));
991extern void ext4_update_dynamic_rev (struct super_block *sb); 991extern void ext4_update_dynamic_rev (struct super_block *sb);
992extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb,
993 __u32 compat);
994extern int ext4_update_rocompat_feature(handle_t *handle,
995 struct super_block *sb, __u32 rocompat);
996extern int ext4_update_incompat_feature(handle_t *handle,
997 struct super_block *sb, __u32 incompat);
992extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, 998extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
993 struct ext4_group_desc *bg); 999 struct ext4_group_desc *bg);
994extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, 1000extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,