btrfs: remove dio iomap DSYNC workaround
This effectively reverts 09745ff88d93 ("btrfs: dio iomap DSYNC
workaround") now that the iomap API has been updated to allow
iomap_dio_complete() not to be called under i_rwsem anymore.
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
a42fa64316
commit
ecfdc08b8c
@@ -62,7 +62,6 @@ struct btrfs_dio_data {
|
||||
loff_t length;
|
||||
ssize_t submitted;
|
||||
struct extent_changeset *data_reserved;
|
||||
bool sync;
|
||||
};
|
||||
|
||||
static const struct inode_operations btrfs_dir_inode_operations;
|
||||
@@ -7431,17 +7430,6 @@ static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start,
|
||||
int ret = 0;
|
||||
u64 len = length;
|
||||
bool unlock_extents = false;
|
||||
bool sync = (current->journal_info == BTRFS_DIO_SYNC_STUB);
|
||||
|
||||
/*
|
||||
* We used current->journal_info here to see if we were sync, but
|
||||
* there's a lot of tests in the enospc machinery to not do flushing if
|
||||
* we have a journal_info set, so we need to clear this out and re-set
|
||||
* it in iomap_end.
|
||||
*/
|
||||
ASSERT(current->journal_info == NULL ||
|
||||
current->journal_info == BTRFS_DIO_SYNC_STUB);
|
||||
current->journal_info = NULL;
|
||||
|
||||
if (!write)
|
||||
len = min_t(u64, len, fs_info->sectorsize);
|
||||
@@ -7467,7 +7455,6 @@ static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start,
|
||||
if (!dio_data)
|
||||
return -ENOMEM;
|
||||
|
||||
dio_data->sync = sync;
|
||||
dio_data->length = length;
|
||||
if (write) {
|
||||
dio_data->reserve = round_up(length, fs_info->sectorsize);
|
||||
@@ -7615,14 +7602,6 @@ static int btrfs_dio_iomap_end(struct inode *inode, loff_t pos, loff_t length,
|
||||
extent_changeset_free(dio_data->data_reserved);
|
||||
}
|
||||
out:
|
||||
/*
|
||||
* We're all done, we can re-set the current->journal_info now safely
|
||||
* for our endio.
|
||||
*/
|
||||
if (dio_data->sync) {
|
||||
ASSERT(current->journal_info == NULL);
|
||||
current->journal_info = BTRFS_DIO_SYNC_STUB;
|
||||
}
|
||||
kfree(dio_data);
|
||||
iomap->private = NULL;
|
||||
|
||||
@@ -7999,30 +7978,6 @@ out_err:
|
||||
return BLK_QC_T_NONE;
|
||||
}
|
||||
|
||||
static inline int btrfs_maybe_fsync_end_io(struct kiocb *iocb, ssize_t size,
|
||||
int error, unsigned flags)
|
||||
{
|
||||
/*
|
||||
* Now if we're still in the context of our submitter we know we can't
|
||||
* safely run generic_write_sync(), so clear our flag here so that the
|
||||
* caller knows to follow up with a sync.
|
||||
*/
|
||||
if (current->journal_info == BTRFS_DIO_SYNC_STUB) {
|
||||
current->journal_info = NULL;
|
||||
return error;
|
||||
}
|
||||
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (size) {
|
||||
iocb->ki_flags |= IOCB_DSYNC;
|
||||
return generic_write_sync(iocb, size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct iomap_ops btrfs_dio_iomap_ops = {
|
||||
.iomap_begin = btrfs_dio_iomap_begin,
|
||||
.iomap_end = btrfs_dio_iomap_end,
|
||||
@@ -8032,11 +7987,6 @@ const struct iomap_dio_ops btrfs_dio_ops = {
|
||||
.submit_io = btrfs_submit_direct,
|
||||
};
|
||||
|
||||
const struct iomap_dio_ops btrfs_sync_dops = {
|
||||
.submit_io = btrfs_submit_direct,
|
||||
.end_io = btrfs_maybe_fsync_end_io,
|
||||
};
|
||||
|
||||
static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
||||
u64 start, u64 len)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user