Skip to content

Commit 12e9b89

Browse files
Dmitry Monakhovtytso
authored andcommitted
ext4: Use bitops to read/modify i_flags in struct ext4_inode_info
At several places we modify EXT4_I(inode)->i_flags without holding i_mutex (ext4_do_update_inode, ...). These modifications are racy and we can lose updates to i_flags. So convert handling of i_flags to use bitops which are atomic. https://bugzilla.kernel.org/show_bug.cgi?id=15792 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent 24676da commit 12e9b89

13 files changed

Lines changed: 136 additions & 56 deletions

File tree

‎fs/ext4/dir.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static int ext4_readdir(struct file *filp,
110110

111111
if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
112112
EXT4_FEATURE_COMPAT_DIR_INDEX) &&
113-
((EXT4_I(inode)->i_flags & EXT4_INDEX_FL) ||
113+
((ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) ||
114114
((inode->i_size >> sb->s_blocksize_bits) == 1))) {
115115
err = ext4_dx_readdir(filp, dirent, filldir);
116116
if (err != ERR_BAD_DX_DIR) {
@@ -121,7 +121,7 @@ static int ext4_readdir(struct file *filp,
121121
* We don't set the inode dirty flag since it's not
122122
* critical that it get flushed back to the disk.
123123
*/
124-
EXT4_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL;
124+
ext4_clear_inode_flag(filp->f_path.dentry->d_inode, EXT4_INODE_INDEX);
125125
}
126126
stored = 0;
127127
offset = filp->f_pos & (sb->s_blocksize - 1);

‎fs/ext4/ext4.h‎

Lines changed: 94 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,83 @@ static inline __u32 ext4_mask_flags(umode_t mode, __u32 flags)
344344
return flags & EXT4_OTHER_FLMASK;
345345
}
346346

347+
/*
348+
* Inode flags used for atomic set/get
349+
*/
350+
enum {
351+
EXT4_INODE_SECRM = 0, /* Secure deletion */
352+
EXT4_INODE_UNRM = 1, /* Undelete */
353+
EXT4_INODE_COMPR = 2, /* Compress file */
354+
EXT4_INODE_SYNC = 3, /* Synchronous updates */
355+
EXT4_INODE_IMMUTABLE = 4, /* Immutable file */
356+
EXT4_INODE_APPEND = 5, /* writes to file may only append */
357+
EXT4_INODE_NODUMP = 6, /* do not dump file */
358+
EXT4_INODE_NOATIME = 7, /* do not update atime */
359+
/* Reserved for compression usage... */
360+
EXT4_INODE_DIRTY = 8,
361+
EXT4_INODE_COMPRBLK = 9, /* One or more compressed clusters */
362+
EXT4_INODE_NOCOMPR = 10, /* Don't compress */
363+
EXT4_INODE_ECOMPR = 11, /* Compression error */
364+
/* End compression flags --- maybe not all used */
365+
EXT4_INODE_INDEX = 12, /* hash-indexed directory */
366+
EXT4_INODE_IMAGIC = 13, /* AFS directory */
367+
EXT4_INODE_JOURNAL_DATA = 14, /* file data should be journaled */
368+
EXT4_INODE_NOTAIL = 15, /* file tail should not be merged */
369+
EXT4_INODE_DIRSYNC = 16, /* dirsync behaviour (directories only) */
370+
EXT4_INODE_TOPDIR = 17, /* Top of directory hierarchies*/
371+
EXT4_INODE_HUGE_FILE = 18, /* Set to each huge file */
372+
EXT4_INODE_EXTENTS = 19, /* Inode uses extents */
373+
EXT4_INODE_EA_INODE = 21, /* Inode used for large EA */
374+
EXT4_INODE_EOFBLOCKS = 22, /* Blocks allocated beyond EOF */
375+
EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */
376+
};
377+
378+
#define TEST_FLAG_VALUE(FLAG) (EXT4_##FLAG##_FL == (1 << EXT4_INODE_##FLAG))
379+
#define CHECK_FLAG_VALUE(FLAG) if (!TEST_FLAG_VALUE(FLAG)) { \
380+
printk(KERN_EMERG "EXT4 flag fail: " #FLAG ": %d %d\n", \
381+
EXT4_##FLAG##_FL, EXT4_INODE_##FLAG); BUG_ON(1); }
382+
383+
/*
384+
* Since it's pretty easy to mix up bit numbers and hex values, and we
385+
* can't do a compile-time test for ENUM values, we use a run-time
386+
* test to make sure that EXT4_XXX_FL is consistent with respect to
387+
* EXT4_INODE_XXX. If all is well the printk and BUG_ON will all drop
388+
* out so it won't cost any extra space in the compiled kernel image.
389+
* But it's important that these values are the same, since we are
390+
* using EXT4_INODE_XXX to test for the flag values, but EXT4_XX_FL
391+
* must be consistent with the values of FS_XXX_FL defined in
392+
* include/linux/fs.h and the on-disk values found in ext2, ext3, and
393+
* ext4 filesystems, and of course the values defined in e2fsprogs.
394+
*
395+
* It's not paranoia if the Murphy's Law really *is* out to get you. :-)
396+
*/
397+
static inline void ext4_check_flag_values(void)
398+
{
399+
CHECK_FLAG_VALUE(SECRM);
400+
CHECK_FLAG_VALUE(UNRM);
401+
CHECK_FLAG_VALUE(COMPR);
402+
CHECK_FLAG_VALUE(SYNC);
403+
CHECK_FLAG_VALUE(IMMUTABLE);
404+
CHECK_FLAG_VALUE(APPEND);
405+
CHECK_FLAG_VALUE(NODUMP);
406+
CHECK_FLAG_VALUE(NOATIME);
407+
CHECK_FLAG_VALUE(DIRTY);
408+
CHECK_FLAG_VALUE(COMPRBLK);
409+
CHECK_FLAG_VALUE(NOCOMPR);
410+
CHECK_FLAG_VALUE(ECOMPR);
411+
CHECK_FLAG_VALUE(INDEX);
412+
CHECK_FLAG_VALUE(IMAGIC);
413+
CHECK_FLAG_VALUE(JOURNAL_DATA);
414+
CHECK_FLAG_VALUE(NOTAIL);
415+
CHECK_FLAG_VALUE(DIRSYNC);
416+
CHECK_FLAG_VALUE(TOPDIR);
417+
CHECK_FLAG_VALUE(HUGE_FILE);
418+
CHECK_FLAG_VALUE(EXTENTS);
419+
CHECK_FLAG_VALUE(EA_INODE);
420+
CHECK_FLAG_VALUE(EOFBLOCKS);
421+
CHECK_FLAG_VALUE(RESERVED);
422+
}
423+
347424
/* Used to pass group descriptor data when online resize is done */
348425
struct ext4_new_group_input {
349426
__u32 group; /* Group number for this data */
@@ -639,9 +716,8 @@ struct ext4_ext_cache {
639716
*/
640717
struct ext4_inode_info {
641718
__le32 i_data[15]; /* unconverted */
642-
__u32 i_flags;
643-
ext4_fsblk_t i_file_acl;
644719
__u32 i_dtime;
720+
ext4_fsblk_t i_file_acl;
645721

646722
/*
647723
* i_block_group is the number of the block group which contains
@@ -652,6 +728,7 @@ struct ext4_inode_info {
652728
*/
653729
ext4_group_t i_block_group;
654730
unsigned long i_state_flags; /* Dynamic state flags */
731+
unsigned long i_flags;
655732

656733
ext4_lblk_t i_dir_start_lookup;
657734
#ifdef CONFIG_EXT4_FS_XATTR
@@ -1087,20 +1164,22 @@ enum {
10871164
EXT4_STATE_DIO_UNWRITTEN, /* need convert on dio done*/
10881165
};
10891166

1090-
static inline int ext4_test_inode_state(struct inode *inode, int bit)
1091-
{
1092-
return test_bit(bit, &EXT4_I(inode)->i_state_flags);
1167+
#define EXT4_INODE_BIT_FNS(name, field) \
1168+
static inline int ext4_test_inode_##name(struct inode *inode, int bit) \
1169+
{ \
1170+
return test_bit(bit, &EXT4_I(inode)->i_##field); \
1171+
} \
1172+
static inline void ext4_set_inode_##name(struct inode *inode, int bit) \
1173+
{ \
1174+
set_bit(bit, &EXT4_I(inode)->i_##field); \
1175+
} \
1176+
static inline void ext4_clear_inode_##name(struct inode *inode, int bit) \
1177+
{ \
1178+
clear_bit(bit, &EXT4_I(inode)->i_##field); \
10931179
}
10941180

1095-
static inline void ext4_set_inode_state(struct inode *inode, int bit)
1096-
{
1097-
set_bit(bit, &EXT4_I(inode)->i_state_flags);
1098-
}
1099-
1100-
static inline void ext4_clear_inode_state(struct inode *inode, int bit)
1101-
{
1102-
clear_bit(bit, &EXT4_I(inode)->i_state_flags);
1103-
}
1181+
EXT4_INODE_BIT_FNS(flag, flags)
1182+
EXT4_INODE_BIT_FNS(state, state_flags)
11041183
#else
11051184
/* Assume that user mode programs are passing in an ext4fs superblock, not
11061185
* a kernel struct super_block. This will allow us to call the feature-test
@@ -1287,7 +1366,7 @@ struct ext4_dir_entry_2 {
12871366

12881367
#define is_dx(dir) (EXT4_HAS_COMPAT_FEATURE(dir->i_sb, \
12891368
EXT4_FEATURE_COMPAT_DIR_INDEX) && \
1290-
(EXT4_I(dir)->i_flags & EXT4_INDEX_FL))
1369+
ext4_test_inode_flag((dir), EXT4_INODE_INDEX))
12911370
#define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX)
12921371
#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
12931372

‎fs/ext4/ext4_jbd2.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static inline int ext4_should_journal_data(struct inode *inode)
273273
return 1;
274274
if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
275275
return 1;
276-
if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
276+
if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA))
277277
return 1;
278278
return 0;
279279
}
@@ -284,7 +284,7 @@ static inline int ext4_should_order_data(struct inode *inode)
284284
return 0;
285285
if (!S_ISREG(inode->i_mode))
286286
return 0;
287-
if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
287+
if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA))
288288
return 0;
289289
if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
290290
return 1;
@@ -297,7 +297,7 @@ static inline int ext4_should_writeback_data(struct inode *inode)
297297
return 0;
298298
if (EXT4_JOURNAL(inode) == NULL)
299299
return 1;
300-
if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
300+
if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA))
301301
return 0;
302302
if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
303303
return 1;
@@ -321,7 +321,7 @@ static inline int ext4_should_dioread_nolock(struct inode *inode)
321321
return 0;
322322
if (!S_ISREG(inode->i_mode))
323323
return 0;
324-
if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
324+
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
325325
return 0;
326326
if (ext4_should_journal_data(inode))
327327
return 0;

‎fs/ext4/extents.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3498,7 +3498,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
34983498
map->m_flags |= EXT4_MAP_UNINIT;
34993499
}
35003500

3501-
if (unlikely(EXT4_I(inode)->i_flags & EXT4_EOFBLOCKS_FL)) {
3501+
if (unlikely(ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS))) {
35023502
if (unlikely(!eh->eh_entries)) {
35033503
EXT4_ERROR_INODE(inode,
35043504
"eh->eh_entries == 0 ee_block %d",
@@ -3509,7 +3509,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
35093509
last_ex = EXT_LAST_EXTENT(eh);
35103510
if (map->m_lblk + ar.len > le32_to_cpu(last_ex->ee_block)
35113511
+ ext4_ext_get_actual_len(last_ex))
3512-
EXT4_I(inode)->i_flags &= ~EXT4_EOFBLOCKS_FL;
3512+
ext4_clear_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
35133513
}
35143514
err = ext4_ext_insert_extent(handle, inode, path, &newex, flags);
35153515
if (err) {
@@ -3650,7 +3650,7 @@ static void ext4_falloc_update_inode(struct inode *inode,
36503650
* can proceed even if the new size is the same as i_size.
36513651
*/
36523652
if (new_size > i_size_read(inode))
3653-
EXT4_I(inode)->i_flags |= EXT4_EOFBLOCKS_FL;
3653+
ext4_set_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
36543654
}
36553655

36563656
}
@@ -3677,7 +3677,7 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)
36773677
* currently supporting (pre)allocate mode for extent-based
36783678
* files _only_
36793679
*/
3680-
if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
3680+
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
36813681
return -EOPNOTSUPP;
36823682

36833683
/* preallocation to directories is currently not supported */
@@ -3922,7 +3922,7 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
39223922
int error = 0;
39233923

39243924
/* fallback to generic here if not in extents fmt */
3925-
if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
3925+
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
39263926
return generic_block_fiemap(inode, fieinfo, start, len,
39273927
ext4_get_block);
39283928

‎fs/ext4/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
6666
* is smaller than s_maxbytes, which is for extent-mapped files.
6767
*/
6868

69-
if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)) {
69+
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
7070
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
7171
size_t length = iov_length(iov, nr_segs);
7272

‎fs/ext4/ialloc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent,
492492

493493
if (S_ISDIR(mode) &&
494494
((parent == sb->s_root->d_inode) ||
495-
(EXT4_I(parent)->i_flags & EXT4_TOPDIR_FL))) {
495+
(ext4_test_inode_flag(parent, EXT4_INODE_TOPDIR)))) {
496496
int best_ndir = inodes_per_group;
497497
int ret = -1;
498498

@@ -1038,7 +1038,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode,
10381038
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
10391039
/* set extent flag only for directory, file and normal symlink*/
10401040
if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) {
1041-
EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
1041+
ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS);
10421042
ext4_ext_tree_init(handle, inode);
10431043
}
10441044
}

‎fs/ext4/inode.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ static int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
931931
int count = 0;
932932
ext4_fsblk_t first_block = 0;
933933

934-
J_ASSERT(!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL));
934+
J_ASSERT(!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)));
935935
J_ASSERT(handle != NULL || (flags & EXT4_GET_BLOCKS_CREATE) == 0);
936936
depth = ext4_block_to_path(inode, map->m_lblk, offsets,
937937
&blocks_to_boundary);
@@ -1059,7 +1059,7 @@ static int ext4_indirect_calc_metadata_amount(struct inode *inode,
10591059
*/
10601060
static int ext4_calc_metadata_amount(struct inode *inode, sector_t lblock)
10611061
{
1062-
if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
1062+
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
10631063
return ext4_ext_calc_metadata_amount(inode, lblock);
10641064

10651065
return ext4_indirect_calc_metadata_amount(inode, lblock);
@@ -1236,7 +1236,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
12361236
* file system block.
12371237
*/
12381238
down_read((&EXT4_I(inode)->i_data_sem));
1239-
if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) {
1239+
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
12401240
retval = ext4_ext_map_blocks(handle, inode, map, 0);
12411241
} else {
12421242
retval = ext4_ind_map_blocks(handle, inode, map, 0);
@@ -1295,7 +1295,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
12951295
* We need to check for EXT4 here because migrate
12961296
* could have changed the inode type in between
12971297
*/
1298-
if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) {
1298+
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
12991299
retval = ext4_ext_map_blocks(handle, inode, map, flags);
13001300
} else {
13011301
retval = ext4_ind_map_blocks(handle, inode, map, flags);
@@ -2325,7 +2325,7 @@ static void mpage_add_bh_to_extent(struct mpage_da_data *mpd,
23252325
goto flush_it;
23262326

23272327
/* check if thereserved journal credits might overflow */
2328-
if (!(EXT4_I(mpd->inode)->i_flags & EXT4_EXTENTS_FL)) {
2328+
if (!(ext4_test_inode_flag(mpd->inode, EXT4_INODE_EXTENTS))) {
23292329
if (nrblocks >= EXT4_MAX_TRANS_DATA) {
23302330
/*
23312331
* With non-extent format we are limited by the journal
@@ -2779,7 +2779,7 @@ static int ext4_da_writepages_trans_blocks(struct inode *inode)
27792779
* number of contiguous block. So we will limit
27802780
* number of contiguous block to a sane value
27812781
*/
2782-
if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) &&
2782+
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) &&
27832783
(max_blocks > EXT4_MAX_TRANS_DATA))
27842784
max_blocks = EXT4_MAX_TRANS_DATA;
27852785

@@ -3995,7 +3995,7 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
39953995
struct file *file = iocb->ki_filp;
39963996
struct inode *inode = file->f_mapping->host;
39973997

3998-
if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
3998+
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
39993999
return ext4_ext_direct_IO(rw, iocb, iov, offset, nr_segs);
40004000

40014001
return ext4_ind_direct_IO(rw, iocb, iov, offset, nr_segs);
@@ -4631,12 +4631,12 @@ void ext4_truncate(struct inode *inode)
46314631
if (!ext4_can_truncate(inode))
46324632
return;
46334633

4634-
EXT4_I(inode)->i_flags &= ~EXT4_EOFBLOCKS_FL;
4634+
ext4_clear_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
46354635

46364636
if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC))
46374637
ext4_set_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
46384638

4639-
if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) {
4639+
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
46404640
ext4_ext_truncate(inode);
46414641
return;
46424642
}
@@ -5473,7 +5473,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
54735473
}
54745474

54755475
if (attr->ia_valid & ATTR_SIZE) {
5476-
if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)) {
5476+
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
54775477
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
54785478

54795479
if (attr->ia_size > sbi->s_bitmap_maxbytes) {
@@ -5486,7 +5486,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
54865486
if (S_ISREG(inode->i_mode) &&
54875487
attr->ia_valid & ATTR_SIZE &&
54885488
(attr->ia_size < inode->i_size ||
5489-
(EXT4_I(inode)->i_flags & EXT4_EOFBLOCKS_FL))) {
5489+
(ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS)))) {
54905490
handle_t *handle;
54915491

54925492
handle = ext4_journal_start(inode, 3);
@@ -5518,7 +5518,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
55185518
}
55195519
}
55205520
/* ext4_truncate will clear the flag */
5521-
if ((EXT4_I(inode)->i_flags & EXT4_EOFBLOCKS_FL))
5521+
if ((ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS)))
55225522
ext4_truncate(inode);
55235523
}
55245524

@@ -5594,7 +5594,7 @@ static int ext4_indirect_trans_blocks(struct inode *inode, int nrblocks,
55945594

55955595
static int ext4_index_trans_blocks(struct inode *inode, int nrblocks, int chunk)
55965596
{
5597-
if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
5597+
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
55985598
return ext4_indirect_trans_blocks(inode, nrblocks, chunk);
55995599
return ext4_ext_index_trans_blocks(inode, nrblocks, chunk);
56005600
}
@@ -5929,9 +5929,9 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
59295929
*/
59305930

59315931
if (val)
5932-
EXT4_I(inode)->i_flags |= EXT4_JOURNAL_DATA_FL;
5932+
ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA);
59335933
else
5934-
EXT4_I(inode)->i_flags &= ~EXT4_JOURNAL_DATA_FL;
5934+
ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA);
59355935
ext4_set_aops(inode);
59365936

59375937
jbd2_journal_unlock_updates(journal);

0 commit comments

Comments
 (0)