|
@@ -931,7 +931,7 @@ static int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
|
|
int count = 0;
|
|
int count = 0;
|
|
ext4_fsblk_t first_block = 0;
|
|
ext4_fsblk_t first_block = 0;
|
|
|
|
|
|
- J_ASSERT(!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL));
|
|
|
|
|
|
+ J_ASSERT(!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)));
|
|
J_ASSERT(handle != NULL || (flags & EXT4_GET_BLOCKS_CREATE) == 0);
|
|
J_ASSERT(handle != NULL || (flags & EXT4_GET_BLOCKS_CREATE) == 0);
|
|
depth = ext4_block_to_path(inode, map->m_lblk, offsets,
|
|
depth = ext4_block_to_path(inode, map->m_lblk, offsets,
|
|
&blocks_to_boundary);
|
|
&blocks_to_boundary);
|
|
@@ -1059,7 +1059,7 @@ static int ext4_indirect_calc_metadata_amount(struct inode *inode,
|
|
*/
|
|
*/
|
|
static int ext4_calc_metadata_amount(struct inode *inode, sector_t lblock)
|
|
static int ext4_calc_metadata_amount(struct inode *inode, sector_t lblock)
|
|
{
|
|
{
|
|
- if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
|
|
|
|
|
|
+ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
|
|
return ext4_ext_calc_metadata_amount(inode, lblock);
|
|
return ext4_ext_calc_metadata_amount(inode, lblock);
|
|
|
|
|
|
return ext4_indirect_calc_metadata_amount(inode, lblock);
|
|
return ext4_indirect_calc_metadata_amount(inode, lblock);
|
|
@@ -1236,7 +1236,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
|
|
* file system block.
|
|
* file system block.
|
|
*/
|
|
*/
|
|
down_read((&EXT4_I(inode)->i_data_sem));
|
|
down_read((&EXT4_I(inode)->i_data_sem));
|
|
- if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) {
|
|
|
|
|
|
+ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
|
|
retval = ext4_ext_map_blocks(handle, inode, map, 0);
|
|
retval = ext4_ext_map_blocks(handle, inode, map, 0);
|
|
} else {
|
|
} else {
|
|
retval = ext4_ind_map_blocks(handle, inode, map, 0);
|
|
retval = ext4_ind_map_blocks(handle, inode, map, 0);
|
|
@@ -1295,7 +1295,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
|
|
* We need to check for EXT4 here because migrate
|
|
* We need to check for EXT4 here because migrate
|
|
* could have changed the inode type in between
|
|
* could have changed the inode type in between
|
|
*/
|
|
*/
|
|
- if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) {
|
|
|
|
|
|
+ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
|
|
retval = ext4_ext_map_blocks(handle, inode, map, flags);
|
|
retval = ext4_ext_map_blocks(handle, inode, map, flags);
|
|
} else {
|
|
} else {
|
|
retval = ext4_ind_map_blocks(handle, inode, map, flags);
|
|
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,
|
|
goto flush_it;
|
|
goto flush_it;
|
|
|
|
|
|
/* check if thereserved journal credits might overflow */
|
|
/* check if thereserved journal credits might overflow */
|
|
- if (!(EXT4_I(mpd->inode)->i_flags & EXT4_EXTENTS_FL)) {
|
|
|
|
|
|
+ if (!(ext4_test_inode_flag(mpd->inode, EXT4_INODE_EXTENTS))) {
|
|
if (nrblocks >= EXT4_MAX_TRANS_DATA) {
|
|
if (nrblocks >= EXT4_MAX_TRANS_DATA) {
|
|
/*
|
|
/*
|
|
* With non-extent format we are limited by the journal
|
|
* With non-extent format we are limited by the journal
|
|
@@ -2779,7 +2779,7 @@ static int ext4_da_writepages_trans_blocks(struct inode *inode)
|
|
* number of contiguous block. So we will limit
|
|
* number of contiguous block. So we will limit
|
|
* number of contiguous block to a sane value
|
|
* number of contiguous block to a sane value
|
|
*/
|
|
*/
|
|
- if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) &&
|
|
|
|
|
|
+ if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) &&
|
|
(max_blocks > EXT4_MAX_TRANS_DATA))
|
|
(max_blocks > EXT4_MAX_TRANS_DATA))
|
|
max_blocks = EXT4_MAX_TRANS_DATA;
|
|
max_blocks = EXT4_MAX_TRANS_DATA;
|
|
|
|
|
|
@@ -3995,7 +3995,7 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
|
|
struct file *file = iocb->ki_filp;
|
|
struct file *file = iocb->ki_filp;
|
|
struct inode *inode = file->f_mapping->host;
|
|
struct inode *inode = file->f_mapping->host;
|
|
|
|
|
|
- if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
|
|
|
|
|
|
+ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
|
|
return ext4_ext_direct_IO(rw, iocb, iov, offset, nr_segs);
|
|
return ext4_ext_direct_IO(rw, iocb, iov, offset, nr_segs);
|
|
|
|
|
|
return ext4_ind_direct_IO(rw, iocb, iov, offset, nr_segs);
|
|
return ext4_ind_direct_IO(rw, iocb, iov, offset, nr_segs);
|
|
@@ -4631,12 +4631,12 @@ void ext4_truncate(struct inode *inode)
|
|
if (!ext4_can_truncate(inode))
|
|
if (!ext4_can_truncate(inode))
|
|
return;
|
|
return;
|
|
|
|
|
|
- EXT4_I(inode)->i_flags &= ~EXT4_EOFBLOCKS_FL;
|
|
|
|
|
|
+ ext4_clear_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
|
|
|
|
|
|
if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC))
|
|
if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC))
|
|
ext4_set_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
|
|
ext4_set_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
|
|
|
|
|
|
- if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) {
|
|
|
|
|
|
+ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
|
|
ext4_ext_truncate(inode);
|
|
ext4_ext_truncate(inode);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -5473,7 +5473,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
|
|
}
|
|
}
|
|
|
|
|
|
if (attr->ia_valid & ATTR_SIZE) {
|
|
if (attr->ia_valid & ATTR_SIZE) {
|
|
- if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)) {
|
|
|
|
|
|
+ if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
|
|
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
|
|
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
|
|
|
|
|
|
if (attr->ia_size > sbi->s_bitmap_maxbytes) {
|
|
if (attr->ia_size > sbi->s_bitmap_maxbytes) {
|
|
@@ -5486,7 +5486,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
|
|
if (S_ISREG(inode->i_mode) &&
|
|
if (S_ISREG(inode->i_mode) &&
|
|
attr->ia_valid & ATTR_SIZE &&
|
|
attr->ia_valid & ATTR_SIZE &&
|
|
(attr->ia_size < inode->i_size ||
|
|
(attr->ia_size < inode->i_size ||
|
|
- (EXT4_I(inode)->i_flags & EXT4_EOFBLOCKS_FL))) {
|
|
|
|
|
|
+ (ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS)))) {
|
|
handle_t *handle;
|
|
handle_t *handle;
|
|
|
|
|
|
handle = ext4_journal_start(inode, 3);
|
|
handle = ext4_journal_start(inode, 3);
|
|
@@ -5518,7 +5518,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/* ext4_truncate will clear the flag */
|
|
/* ext4_truncate will clear the flag */
|
|
- if ((EXT4_I(inode)->i_flags & EXT4_EOFBLOCKS_FL))
|
|
|
|
|
|
+ if ((ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS)))
|
|
ext4_truncate(inode);
|
|
ext4_truncate(inode);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -5594,7 +5594,7 @@ static int ext4_indirect_trans_blocks(struct inode *inode, int nrblocks,
|
|
|
|
|
|
static int ext4_index_trans_blocks(struct inode *inode, int nrblocks, int chunk)
|
|
static int ext4_index_trans_blocks(struct inode *inode, int nrblocks, int chunk)
|
|
{
|
|
{
|
|
- if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
|
|
|
|
|
|
+ if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
|
|
return ext4_indirect_trans_blocks(inode, nrblocks, chunk);
|
|
return ext4_indirect_trans_blocks(inode, nrblocks, chunk);
|
|
return ext4_ext_index_trans_blocks(inode, nrblocks, chunk);
|
|
return ext4_ext_index_trans_blocks(inode, nrblocks, chunk);
|
|
}
|
|
}
|
|
@@ -5929,9 +5929,9 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
|
|
*/
|
|
*/
|
|
|
|
|
|
if (val)
|
|
if (val)
|
|
- EXT4_I(inode)->i_flags |= EXT4_JOURNAL_DATA_FL;
|
|
|
|
|
|
+ ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA);
|
|
else
|
|
else
|
|
- EXT4_I(inode)->i_flags &= ~EXT4_JOURNAL_DATA_FL;
|
|
|
|
|
|
+ ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA);
|
|
ext4_set_aops(inode);
|
|
ext4_set_aops(inode);
|
|
|
|
|
|
jbd2_journal_unlock_updates(journal);
|
|
jbd2_journal_unlock_updates(journal);
|