|
@@ -353,17 +353,16 @@ static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode,
|
|
|
|
|
|
down_write(&EXT4_I(inode)->i_data_sem);
|
|
down_write(&EXT4_I(inode)->i_data_sem);
|
|
/*
|
|
/*
|
|
- * if EXT4_EXT_MIGRATE is cleared a block allocation
|
|
|
|
|
|
+ * if EXT4_STATE_EXT_MIGRATE is cleared a block allocation
|
|
* happened after we started the migrate. We need to
|
|
* happened after we started the migrate. We need to
|
|
* fail the migrate
|
|
* fail the migrate
|
|
*/
|
|
*/
|
|
- if (!(EXT4_I(inode)->i_flags & EXT4_EXT_MIGRATE)) {
|
|
|
|
|
|
+ if (!(EXT4_I(inode)->i_state & EXT4_STATE_EXT_MIGRATE)) {
|
|
retval = -EAGAIN;
|
|
retval = -EAGAIN;
|
|
up_write(&EXT4_I(inode)->i_data_sem);
|
|
up_write(&EXT4_I(inode)->i_data_sem);
|
|
goto err_out;
|
|
goto err_out;
|
|
} else
|
|
} else
|
|
- EXT4_I(inode)->i_flags = EXT4_I(inode)->i_flags &
|
|
|
|
- ~EXT4_EXT_MIGRATE;
|
|
|
|
|
|
+ EXT4_I(inode)->i_state &= ~EXT4_STATE_EXT_MIGRATE;
|
|
/*
|
|
/*
|
|
* We have the extent map build with the tmp inode.
|
|
* We have the extent map build with the tmp inode.
|
|
* Now copy the i_data across
|
|
* Now copy the i_data across
|
|
@@ -517,14 +516,15 @@ int ext4_ext_migrate(struct inode *inode)
|
|
* when we add extents we extent the journal
|
|
* when we add extents we extent the journal
|
|
*/
|
|
*/
|
|
/*
|
|
/*
|
|
- * Even though we take i_mutex we can still cause block allocation
|
|
|
|
- * via mmap write to holes. If we have allocated new blocks we fail
|
|
|
|
- * migrate. New block allocation will clear EXT4_EXT_MIGRATE flag.
|
|
|
|
- * The flag is updated with i_data_sem held to prevent racing with
|
|
|
|
- * block allocation.
|
|
|
|
|
|
+ * Even though we take i_mutex we can still cause block
|
|
|
|
+ * allocation via mmap write to holes. If we have allocated
|
|
|
|
+ * new blocks we fail migrate. New block allocation will
|
|
|
|
+ * clear EXT4_STATE_EXT_MIGRATE flag. The flag is updated
|
|
|
|
+ * with i_data_sem held to prevent racing with block
|
|
|
|
+ * allocation.
|
|
*/
|
|
*/
|
|
down_read((&EXT4_I(inode)->i_data_sem));
|
|
down_read((&EXT4_I(inode)->i_data_sem));
|
|
- EXT4_I(inode)->i_flags = EXT4_I(inode)->i_flags | EXT4_EXT_MIGRATE;
|
|
|
|
|
|
+ EXT4_I(inode)->i_state |= EXT4_STATE_EXT_MIGRATE;
|
|
up_read((&EXT4_I(inode)->i_data_sem));
|
|
up_read((&EXT4_I(inode)->i_data_sem));
|
|
|
|
|
|
handle = ext4_journal_start(inode, 1);
|
|
handle = ext4_journal_start(inode, 1);
|