diff options
-rw-r--r-- | fs/ext4/ext4.h | 41 | ||||
-rw-r--r-- | fs/ext4/extents.c | 8 | ||||
-rw-r--r-- | fs/ext4/file.c | 4 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 3 | ||||
-rw-r--r-- | fs/ext4/inode.c | 38 | ||||
-rw-r--r-- | fs/ext4/migrate.c | 6 | ||||
-rw-r--r-- | fs/ext4/xattr.c | 22 |
7 files changed, 71 insertions, 51 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 307ecd13a762..ffe1334c891e 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -313,17 +313,6 @@ static inline __u32 ext4_mask_flags(umode_t mode, __u32 flags) | |||
313 | return flags & EXT4_OTHER_FLMASK; | 313 | return flags & EXT4_OTHER_FLMASK; |
314 | } | 314 | } |
315 | 315 | ||
316 | /* | ||
317 | * Inode dynamic state flags | ||
318 | */ | ||
319 | #define EXT4_STATE_JDATA 0x00000001 /* journaled data exists */ | ||
320 | #define EXT4_STATE_NEW 0x00000002 /* inode is newly created */ | ||
321 | #define EXT4_STATE_XATTR 0x00000004 /* has in-inode xattrs */ | ||
322 | #define EXT4_STATE_NO_EXPAND 0x00000008 /* No space for expansion */ | ||
323 | #define EXT4_STATE_DA_ALLOC_CLOSE 0x00000010 /* Alloc DA blks on close */ | ||
324 | #define EXT4_STATE_EXT_MIGRATE 0x00000020 /* Inode is migrating */ | ||
325 | #define EXT4_STATE_DIO_UNWRITTEN 0x00000040 /* need convert on dio done*/ | ||
326 | |||
327 | /* Used to pass group descriptor data when online resize is done */ | 316 | /* Used to pass group descriptor data when online resize is done */ |
328 | struct ext4_new_group_input { | 317 | struct ext4_new_group_input { |
329 | __u32 group; /* Group number for this data */ | 318 | __u32 group; /* Group number for this data */ |
@@ -631,7 +620,7 @@ struct ext4_inode_info { | |||
631 | * near to their parent directory's inode. | 620 | * near to their parent directory's inode. |
632 | */ | 621 | */ |
633 | ext4_group_t i_block_group; | 622 | ext4_group_t i_block_group; |
634 | __u32 i_state; /* Dynamic state flags for ext4 */ | 623 | unsigned long i_state_flags; /* Dynamic state flags */ |
635 | 624 | ||
636 | ext4_lblk_t i_dir_start_lookup; | 625 | ext4_lblk_t i_dir_start_lookup; |
637 | #ifdef CONFIG_EXT4_FS_XATTR | 626 | #ifdef CONFIG_EXT4_FS_XATTR |
@@ -1051,6 +1040,34 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
1051 | (ino >= EXT4_FIRST_INO(sb) && | 1040 | (ino >= EXT4_FIRST_INO(sb) && |
1052 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); | 1041 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); |
1053 | } | 1042 | } |
1043 | |||
1044 | /* | ||
1045 | * Inode dynamic state flags | ||
1046 | */ | ||
1047 | enum { | ||
1048 | EXT4_STATE_JDATA, /* journaled data exists */ | ||
1049 | EXT4_STATE_NEW, /* inode is newly created */ | ||
1050 | EXT4_STATE_XATTR, /* has in-inode xattrs */ | ||
1051 | EXT4_STATE_NO_EXPAND, /* No space for expansion */ | ||
1052 | EXT4_STATE_DA_ALLOC_CLOSE, /* Alloc DA blks on close */ | ||
1053 | EXT4_STATE_EXT_MIGRATE, /* Inode is migrating */ | ||
1054 | EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/ | ||
1055 | }; | ||
1056 | |||
1057 | static inline int ext4_test_inode_state(struct inode *inode, int bit) | ||
1058 | { | ||
1059 | return test_bit(bit, &EXT4_I(inode)->i_state_flags); | ||
1060 | } | ||
1061 | |||
1062 | static inline void ext4_set_inode_state(struct inode *inode, int bit) | ||
1063 | { | ||
1064 | set_bit(bit, &EXT4_I(inode)->i_state_flags); | ||
1065 | } | ||
1066 | |||
1067 | static inline void ext4_clear_inode_state(struct inode *inode, int bit) | ||
1068 | { | ||
1069 | clear_bit(bit, &EXT4_I(inode)->i_state_flags); | ||
1070 | } | ||
1054 | #else | 1071 | #else |
1055 | /* Assume that user mode programs are passing in an ext4fs superblock, not | 1072 | /* Assume that user mode programs are passing in an ext4fs superblock, not |
1056 | * a kernel struct super_block. This will allow us to call the feature-test | 1073 | * a kernel struct super_block. This will allow us to call the feature-test |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index c56877972b0e..54616157c0f3 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -3076,7 +3076,7 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | |||
3076 | if (io) | 3076 | if (io) |
3077 | io->flag = DIO_AIO_UNWRITTEN; | 3077 | io->flag = DIO_AIO_UNWRITTEN; |
3078 | else | 3078 | else |
3079 | EXT4_I(inode)->i_state |= EXT4_STATE_DIO_UNWRITTEN; | 3079 | ext4_set_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN); |
3080 | goto out; | 3080 | goto out; |
3081 | } | 3081 | } |
3082 | /* async DIO end_io complete, convert the filled extent to written */ | 3082 | /* async DIO end_io complete, convert the filled extent to written */ |
@@ -3362,8 +3362,8 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | |||
3362 | if (io) | 3362 | if (io) |
3363 | io->flag = DIO_AIO_UNWRITTEN; | 3363 | io->flag = DIO_AIO_UNWRITTEN; |
3364 | else | 3364 | else |
3365 | EXT4_I(inode)->i_state |= | 3365 | ext4_set_inode_state(inode, |
3366 | EXT4_STATE_DIO_UNWRITTEN;; | 3366 | EXT4_STATE_DIO_UNWRITTEN); |
3367 | } | 3367 | } |
3368 | } | 3368 | } |
3369 | err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); | 3369 | err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); |
@@ -3739,7 +3739,7 @@ static int ext4_xattr_fiemap(struct inode *inode, | |||
3739 | int error = 0; | 3739 | int error = 0; |
3740 | 3740 | ||
3741 | /* in-inode? */ | 3741 | /* in-inode? */ |
3742 | if (EXT4_I(inode)->i_state & EXT4_STATE_XATTR) { | 3742 | if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) { |
3743 | struct ext4_iloc iloc; | 3743 | struct ext4_iloc iloc; |
3744 | int offset; /* offset of xattr in inode */ | 3744 | int offset; /* offset of xattr in inode */ |
3745 | 3745 | ||
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 9630583cef28..f6071ce0b155 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -35,9 +35,9 @@ | |||
35 | */ | 35 | */ |
36 | static int ext4_release_file(struct inode *inode, struct file *filp) | 36 | static int ext4_release_file(struct inode *inode, struct file *filp) |
37 | { | 37 | { |
38 | if (EXT4_I(inode)->i_state & EXT4_STATE_DA_ALLOC_CLOSE) { | 38 | if (ext4_test_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE)) { |
39 | ext4_alloc_da_blocks(inode); | 39 | ext4_alloc_da_blocks(inode); |
40 | EXT4_I(inode)->i_state &= ~EXT4_STATE_DA_ALLOC_CLOSE; | 40 | ext4_clear_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE); |
41 | } | 41 | } |
42 | /* if we are the last writer on the inode, drop the block reservation */ | 42 | /* if we are the last writer on the inode, drop the block reservation */ |
43 | if ((filp->f_mode & FMODE_WRITE) && | 43 | if ((filp->f_mode & FMODE_WRITE) && |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index f3624ead4f6c..2fab5adae1e2 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -1029,7 +1029,8 @@ got: | |||
1029 | inode->i_generation = sbi->s_next_generation++; | 1029 | inode->i_generation = sbi->s_next_generation++; |
1030 | spin_unlock(&sbi->s_next_gen_lock); | 1030 | spin_unlock(&sbi->s_next_gen_lock); |
1031 | 1031 | ||
1032 | ei->i_state = EXT4_STATE_NEW; | 1032 | ei->i_state_flags = 0; |
1033 | ext4_set_inode_state(inode, EXT4_STATE_NEW); | ||
1033 | 1034 | ||
1034 | ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; | 1035 | ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; |
1035 | 1036 | ||
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 1a3d7b232cd7..3e530119d7f0 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1307,7 +1307,7 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block, | |||
1307 | * i_data's format changing. Force the migrate | 1307 | * i_data's format changing. Force the migrate |
1308 | * to fail by clearing migrate flags | 1308 | * to fail by clearing migrate flags |
1309 | */ | 1309 | */ |
1310 | EXT4_I(inode)->i_state &= ~EXT4_STATE_EXT_MIGRATE; | 1310 | ext4_clear_inode_state(inode, EXT4_STATE_EXT_MIGRATE); |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | /* | 1313 | /* |
@@ -1794,7 +1794,7 @@ static int ext4_journalled_write_end(struct file *file, | |||
1794 | new_i_size = pos + copied; | 1794 | new_i_size = pos + copied; |
1795 | if (new_i_size > inode->i_size) | 1795 | if (new_i_size > inode->i_size) |
1796 | i_size_write(inode, pos+copied); | 1796 | i_size_write(inode, pos+copied); |
1797 | EXT4_I(inode)->i_state |= EXT4_STATE_JDATA; | 1797 | ext4_set_inode_state(inode, EXT4_STATE_JDATA); |
1798 | if (new_i_size > EXT4_I(inode)->i_disksize) { | 1798 | if (new_i_size > EXT4_I(inode)->i_disksize) { |
1799 | ext4_update_i_disksize(inode, new_i_size); | 1799 | ext4_update_i_disksize(inode, new_i_size); |
1800 | ret2 = ext4_mark_inode_dirty(handle, inode); | 1800 | ret2 = ext4_mark_inode_dirty(handle, inode); |
@@ -2632,7 +2632,7 @@ static int __ext4_journalled_writepage(struct page *page, | |||
2632 | ret = err; | 2632 | ret = err; |
2633 | 2633 | ||
2634 | walk_page_buffers(handle, page_bufs, 0, len, NULL, bput_one); | 2634 | walk_page_buffers(handle, page_bufs, 0, len, NULL, bput_one); |
2635 | EXT4_I(inode)->i_state |= EXT4_STATE_JDATA; | 2635 | ext4_set_inode_state(inode, EXT4_STATE_JDATA); |
2636 | out: | 2636 | out: |
2637 | return ret; | 2637 | return ret; |
2638 | } | 2638 | } |
@@ -3303,7 +3303,8 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block) | |||
3303 | filemap_write_and_wait(mapping); | 3303 | filemap_write_and_wait(mapping); |
3304 | } | 3304 | } |
3305 | 3305 | ||
3306 | if (EXT4_JOURNAL(inode) && EXT4_I(inode)->i_state & EXT4_STATE_JDATA) { | 3306 | if (EXT4_JOURNAL(inode) && |
3307 | ext4_test_inode_state(inode, EXT4_STATE_JDATA)) { | ||
3307 | /* | 3308 | /* |
3308 | * This is a REALLY heavyweight approach, but the use of | 3309 | * This is a REALLY heavyweight approach, but the use of |
3309 | * bmap on dirty files is expected to be extremely rare: | 3310 | * bmap on dirty files is expected to be extremely rare: |
@@ -3322,7 +3323,7 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block) | |||
3322 | * everything they get. | 3323 | * everything they get. |
3323 | */ | 3324 | */ |
3324 | 3325 | ||
3325 | EXT4_I(inode)->i_state &= ~EXT4_STATE_JDATA; | 3326 | ext4_clear_inode_state(inode, EXT4_STATE_JDATA); |
3326 | journal = EXT4_JOURNAL(inode); | 3327 | journal = EXT4_JOURNAL(inode); |
3327 | jbd2_journal_lock_updates(journal); | 3328 | jbd2_journal_lock_updates(journal); |
3328 | err = jbd2_journal_flush(journal); | 3329 | err = jbd2_journal_flush(journal); |
@@ -3790,8 +3791,8 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, | |||
3790 | if (ret != -EIOCBQUEUED && ret <= 0 && iocb->private) { | 3791 | if (ret != -EIOCBQUEUED && ret <= 0 && iocb->private) { |
3791 | ext4_free_io_end(iocb->private); | 3792 | ext4_free_io_end(iocb->private); |
3792 | iocb->private = NULL; | 3793 | iocb->private = NULL; |
3793 | } else if (ret > 0 && (EXT4_I(inode)->i_state & | 3794 | } else if (ret > 0 && ext4_test_inode_state(inode, |
3794 | EXT4_STATE_DIO_UNWRITTEN)) { | 3795 | EXT4_STATE_DIO_UNWRITTEN)) { |
3795 | int err; | 3796 | int err; |
3796 | /* | 3797 | /* |
3797 | * for non AIO case, since the IO is already | 3798 | * for non AIO case, since the IO is already |
@@ -3801,7 +3802,7 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, | |||
3801 | offset, ret); | 3802 | offset, ret); |
3802 | if (err < 0) | 3803 | if (err < 0) |
3803 | ret = err; | 3804 | ret = err; |
3804 | EXT4_I(inode)->i_state &= ~EXT4_STATE_DIO_UNWRITTEN; | 3805 | ext4_clear_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN); |
3805 | } | 3806 | } |
3806 | return ret; | 3807 | return ret; |
3807 | } | 3808 | } |
@@ -4457,7 +4458,7 @@ void ext4_truncate(struct inode *inode) | |||
4457 | return; | 4458 | return; |
4458 | 4459 | ||
4459 | if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC)) | 4460 | if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC)) |
4460 | ei->i_state |= EXT4_STATE_DA_ALLOC_CLOSE; | 4461 | ext4_set_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE); |
4461 | 4462 | ||
4462 | if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) { | 4463 | if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) { |
4463 | ext4_ext_truncate(inode); | 4464 | ext4_ext_truncate(inode); |
@@ -4743,7 +4744,7 @@ int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc) | |||
4743 | { | 4744 | { |
4744 | /* We have all inode data except xattrs in memory here. */ | 4745 | /* We have all inode data except xattrs in memory here. */ |
4745 | return __ext4_get_inode_loc(inode, iloc, | 4746 | return __ext4_get_inode_loc(inode, iloc, |
4746 | !(EXT4_I(inode)->i_state & EXT4_STATE_XATTR)); | 4747 | !ext4_test_inode_state(inode, EXT4_STATE_XATTR)); |
4747 | } | 4748 | } |
4748 | 4749 | ||
4749 | void ext4_set_inode_flags(struct inode *inode) | 4750 | void ext4_set_inode_flags(struct inode *inode) |
@@ -4837,7 +4838,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
4837 | } | 4838 | } |
4838 | inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); | 4839 | inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); |
4839 | 4840 | ||
4840 | ei->i_state = 0; | 4841 | ei->i_state_flags = 0; |
4841 | ei->i_dir_start_lookup = 0; | 4842 | ei->i_dir_start_lookup = 0; |
4842 | ei->i_dtime = le32_to_cpu(raw_inode->i_dtime); | 4843 | ei->i_dtime = le32_to_cpu(raw_inode->i_dtime); |
4843 | /* We now have enough fields to check if the inode was active or not. | 4844 | /* We now have enough fields to check if the inode was active or not. |
@@ -4920,7 +4921,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
4920 | EXT4_GOOD_OLD_INODE_SIZE + | 4921 | EXT4_GOOD_OLD_INODE_SIZE + |
4921 | ei->i_extra_isize; | 4922 | ei->i_extra_isize; |
4922 | if (*magic == cpu_to_le32(EXT4_XATTR_MAGIC)) | 4923 | if (*magic == cpu_to_le32(EXT4_XATTR_MAGIC)) |
4923 | ei->i_state |= EXT4_STATE_XATTR; | 4924 | ext4_set_inode_state(inode, EXT4_STATE_XATTR); |
4924 | } | 4925 | } |
4925 | } else | 4926 | } else |
4926 | ei->i_extra_isize = 0; | 4927 | ei->i_extra_isize = 0; |
@@ -5060,7 +5061,7 @@ static int ext4_do_update_inode(handle_t *handle, | |||
5060 | 5061 | ||
5061 | /* For fields not not tracking in the in-memory inode, | 5062 | /* For fields not not tracking in the in-memory inode, |
5062 | * initialise them to zero for new inodes. */ | 5063 | * initialise them to zero for new inodes. */ |
5063 | if (ei->i_state & EXT4_STATE_NEW) | 5064 | if (ext4_test_inode_state(inode, EXT4_STATE_NEW)) |
5064 | memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size); | 5065 | memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size); |
5065 | 5066 | ||
5066 | ext4_get_inode_flags(ei); | 5067 | ext4_get_inode_flags(ei); |
@@ -5156,7 +5157,7 @@ static int ext4_do_update_inode(handle_t *handle, | |||
5156 | rc = ext4_handle_dirty_metadata(handle, inode, bh); | 5157 | rc = ext4_handle_dirty_metadata(handle, inode, bh); |
5157 | if (!err) | 5158 | if (!err) |
5158 | err = rc; | 5159 | err = rc; |
5159 | ei->i_state &= ~EXT4_STATE_NEW; | 5160 | ext4_clear_inode_state(inode, EXT4_STATE_NEW); |
5160 | 5161 | ||
5161 | ext4_update_inode_fsync_trans(handle, inode, 0); | 5162 | ext4_update_inode_fsync_trans(handle, inode, 0); |
5162 | out_brelse: | 5163 | out_brelse: |
@@ -5580,8 +5581,8 @@ static int ext4_expand_extra_isize(struct inode *inode, | |||
5580 | entry = IFIRST(header); | 5581 | entry = IFIRST(header); |
5581 | 5582 | ||
5582 | /* No extended attributes present */ | 5583 | /* No extended attributes present */ |
5583 | if (!(EXT4_I(inode)->i_state & EXT4_STATE_XATTR) || | 5584 | if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) || |
5584 | header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)) { | 5585 | header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)) { |
5585 | memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE, 0, | 5586 | memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE, 0, |
5586 | new_extra_isize); | 5587 | new_extra_isize); |
5587 | EXT4_I(inode)->i_extra_isize = new_extra_isize; | 5588 | EXT4_I(inode)->i_extra_isize = new_extra_isize; |
@@ -5625,7 +5626,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) | |||
5625 | err = ext4_reserve_inode_write(handle, inode, &iloc); | 5626 | err = ext4_reserve_inode_write(handle, inode, &iloc); |
5626 | if (ext4_handle_valid(handle) && | 5627 | if (ext4_handle_valid(handle) && |
5627 | EXT4_I(inode)->i_extra_isize < sbi->s_want_extra_isize && | 5628 | EXT4_I(inode)->i_extra_isize < sbi->s_want_extra_isize && |
5628 | !(EXT4_I(inode)->i_state & EXT4_STATE_NO_EXPAND)) { | 5629 | !ext4_test_inode_state(inode, EXT4_STATE_NO_EXPAND)) { |
5629 | /* | 5630 | /* |
5630 | * We need extra buffer credits since we may write into EA block | 5631 | * We need extra buffer credits since we may write into EA block |
5631 | * with this same handle. If journal_extend fails, then it will | 5632 | * with this same handle. If journal_extend fails, then it will |
@@ -5639,7 +5640,8 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) | |||
5639 | sbi->s_want_extra_isize, | 5640 | sbi->s_want_extra_isize, |
5640 | iloc, handle); | 5641 | iloc, handle); |
5641 | if (ret) { | 5642 | if (ret) { |
5642 | EXT4_I(inode)->i_state |= EXT4_STATE_NO_EXPAND; | 5643 | ext4_set_inode_state(inode, |
5644 | EXT4_STATE_NO_EXPAND); | ||
5643 | if (mnt_count != | 5645 | if (mnt_count != |
5644 | le16_to_cpu(sbi->s_es->s_mnt_count)) { | 5646 | le16_to_cpu(sbi->s_es->s_mnt_count)) { |
5645 | ext4_warning(inode->i_sb, __func__, | 5647 | ext4_warning(inode->i_sb, __func__, |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 81415814b00b..46a4101e0aec 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -365,12 +365,12 @@ static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode, | |||
365 | * happened after we started the migrate. We need to | 365 | * happened after we started the migrate. We need to |
366 | * fail the migrate | 366 | * fail the migrate |
367 | */ | 367 | */ |
368 | if (!(EXT4_I(inode)->i_state & EXT4_STATE_EXT_MIGRATE)) { | 368 | if (!ext4_test_inode_state(inode, EXT4_STATE_EXT_MIGRATE)) { |
369 | retval = -EAGAIN; | 369 | retval = -EAGAIN; |
370 | up_write(&EXT4_I(inode)->i_data_sem); | 370 | up_write(&EXT4_I(inode)->i_data_sem); |
371 | goto err_out; | 371 | goto err_out; |
372 | } else | 372 | } else |
373 | EXT4_I(inode)->i_state &= ~EXT4_STATE_EXT_MIGRATE; | 373 | ext4_clear_inode_state(inode, EXT4_STATE_EXT_MIGRATE); |
374 | /* | 374 | /* |
375 | * We have the extent map build with the tmp inode. | 375 | * We have the extent map build with the tmp inode. |
376 | * Now copy the i_data across | 376 | * Now copy the i_data across |
@@ -533,7 +533,7 @@ int ext4_ext_migrate(struct inode *inode) | |||
533 | * allocation. | 533 | * allocation. |
534 | */ | 534 | */ |
535 | down_read((&EXT4_I(inode)->i_data_sem)); | 535 | down_read((&EXT4_I(inode)->i_data_sem)); |
536 | EXT4_I(inode)->i_state |= EXT4_STATE_EXT_MIGRATE; | 536 | ext4_set_inode_state(inode, EXT4_STATE_EXT_MIGRATE); |
537 | up_read((&EXT4_I(inode)->i_data_sem)); | 537 | up_read((&EXT4_I(inode)->i_data_sem)); |
538 | 538 | ||
539 | handle = ext4_journal_start(inode, 1); | 539 | handle = ext4_journal_start(inode, 1); |
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index f3a2f7ed45aa..c619a7ea670d 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c | |||
@@ -267,7 +267,7 @@ ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name, | |||
267 | void *end; | 267 | void *end; |
268 | int error; | 268 | int error; |
269 | 269 | ||
270 | if (!(EXT4_I(inode)->i_state & EXT4_STATE_XATTR)) | 270 | if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR)) |
271 | return -ENODATA; | 271 | return -ENODATA; |
272 | error = ext4_get_inode_loc(inode, &iloc); | 272 | error = ext4_get_inode_loc(inode, &iloc); |
273 | if (error) | 273 | if (error) |
@@ -396,7 +396,7 @@ ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) | |||
396 | void *end; | 396 | void *end; |
397 | int error; | 397 | int error; |
398 | 398 | ||
399 | if (!(EXT4_I(inode)->i_state & EXT4_STATE_XATTR)) | 399 | if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR)) |
400 | return 0; | 400 | return 0; |
401 | error = ext4_get_inode_loc(inode, &iloc); | 401 | error = ext4_get_inode_loc(inode, &iloc); |
402 | if (error) | 402 | if (error) |
@@ -908,7 +908,7 @@ ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i, | |||
908 | is->s.base = is->s.first = IFIRST(header); | 908 | is->s.base = is->s.first = IFIRST(header); |
909 | is->s.here = is->s.first; | 909 | is->s.here = is->s.first; |
910 | is->s.end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; | 910 | is->s.end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; |
911 | if (EXT4_I(inode)->i_state & EXT4_STATE_XATTR) { | 911 | if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) { |
912 | error = ext4_xattr_check_names(IFIRST(header), is->s.end); | 912 | error = ext4_xattr_check_names(IFIRST(header), is->s.end); |
913 | if (error) | 913 | if (error) |
914 | return error; | 914 | return error; |
@@ -940,10 +940,10 @@ ext4_xattr_ibody_set(handle_t *handle, struct inode *inode, | |||
940 | header = IHDR(inode, ext4_raw_inode(&is->iloc)); | 940 | header = IHDR(inode, ext4_raw_inode(&is->iloc)); |
941 | if (!IS_LAST_ENTRY(s->first)) { | 941 | if (!IS_LAST_ENTRY(s->first)) { |
942 | header->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC); | 942 | header->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC); |
943 | EXT4_I(inode)->i_state |= EXT4_STATE_XATTR; | 943 | ext4_set_inode_state(inode, EXT4_STATE_XATTR); |
944 | } else { | 944 | } else { |
945 | header->h_magic = cpu_to_le32(0); | 945 | header->h_magic = cpu_to_le32(0); |
946 | EXT4_I(inode)->i_state &= ~EXT4_STATE_XATTR; | 946 | ext4_clear_inode_state(inode, EXT4_STATE_XATTR); |
947 | } | 947 | } |
948 | return 0; | 948 | return 0; |
949 | } | 949 | } |
@@ -986,8 +986,8 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, | |||
986 | if (strlen(name) > 255) | 986 | if (strlen(name) > 255) |
987 | return -ERANGE; | 987 | return -ERANGE; |
988 | down_write(&EXT4_I(inode)->xattr_sem); | 988 | down_write(&EXT4_I(inode)->xattr_sem); |
989 | no_expand = EXT4_I(inode)->i_state & EXT4_STATE_NO_EXPAND; | 989 | no_expand = ext4_test_inode_state(inode, EXT4_STATE_NO_EXPAND); |
990 | EXT4_I(inode)->i_state |= EXT4_STATE_NO_EXPAND; | 990 | ext4_set_inode_state(inode, EXT4_STATE_NO_EXPAND); |
991 | 991 | ||
992 | error = ext4_get_inode_loc(inode, &is.iloc); | 992 | error = ext4_get_inode_loc(inode, &is.iloc); |
993 | if (error) | 993 | if (error) |
@@ -997,10 +997,10 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, | |||
997 | if (error) | 997 | if (error) |
998 | goto cleanup; | 998 | goto cleanup; |
999 | 999 | ||
1000 | if (EXT4_I(inode)->i_state & EXT4_STATE_NEW) { | 1000 | if (ext4_test_inode_state(inode, EXT4_STATE_NEW)) { |
1001 | struct ext4_inode *raw_inode = ext4_raw_inode(&is.iloc); | 1001 | struct ext4_inode *raw_inode = ext4_raw_inode(&is.iloc); |
1002 | memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size); | 1002 | memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size); |
1003 | EXT4_I(inode)->i_state &= ~EXT4_STATE_NEW; | 1003 | ext4_clear_inode_state(inode, EXT4_STATE_NEW); |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | error = ext4_xattr_ibody_find(inode, &i, &is); | 1006 | error = ext4_xattr_ibody_find(inode, &i, &is); |
@@ -1052,7 +1052,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, | |||
1052 | ext4_xattr_update_super_block(handle, inode->i_sb); | 1052 | ext4_xattr_update_super_block(handle, inode->i_sb); |
1053 | inode->i_ctime = ext4_current_time(inode); | 1053 | inode->i_ctime = ext4_current_time(inode); |
1054 | if (!value) | 1054 | if (!value) |
1055 | EXT4_I(inode)->i_state &= ~EXT4_STATE_NO_EXPAND; | 1055 | ext4_clear_inode_state(inode, EXT4_STATE_NO_EXPAND); |
1056 | error = ext4_mark_iloc_dirty(handle, inode, &is.iloc); | 1056 | error = ext4_mark_iloc_dirty(handle, inode, &is.iloc); |
1057 | /* | 1057 | /* |
1058 | * The bh is consumed by ext4_mark_iloc_dirty, even with | 1058 | * The bh is consumed by ext4_mark_iloc_dirty, even with |
@@ -1067,7 +1067,7 @@ cleanup: | |||
1067 | brelse(is.iloc.bh); | 1067 | brelse(is.iloc.bh); |
1068 | brelse(bs.bh); | 1068 | brelse(bs.bh); |
1069 | if (no_expand == 0) | 1069 | if (no_expand == 0) |
1070 | EXT4_I(inode)->i_state &= ~EXT4_STATE_NO_EXPAND; | 1070 | ext4_clear_inode_state(inode, EXT4_STATE_NO_EXPAND); |
1071 | up_write(&EXT4_I(inode)->xattr_sem); | 1071 | up_write(&EXT4_I(inode)->xattr_sem); |
1072 | return error; | 1072 | return error; |
1073 | } | 1073 | } |