Skip to content

Commit 5f00816

Browse files
goldwynrkdave
authored andcommitted
btrfs: remove BTRFS_INODE_READDIO_NEED_LOCK
Since we now perform direct reads using i_rwsem, we can remove this inode flag used to co-ordinate unlocked reads. The truncate call takes i_rwsem. This means it is correctly synchronized with concurrent direct reads. Reviewed-by: Nikolay Borisov <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Goldwyn Rodrigues <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent b75b7ca commit 5f00816

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

fs/btrfs/btrfs_inode.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ enum {
2828
BTRFS_INODE_NEEDS_FULL_SYNC,
2929
BTRFS_INODE_COPY_EVERYTHING,
3030
BTRFS_INODE_IN_DELALLOC_LIST,
31-
BTRFS_INODE_READDIO_NEED_LOCK,
3231
BTRFS_INODE_HAS_PROPS,
3332
BTRFS_INODE_SNAPSHOT_FLUSH,
3433
};
@@ -313,23 +312,6 @@ struct btrfs_dio_private {
313312
u8 csums[];
314313
};
315314

316-
/*
317-
* Disable DIO read nolock optimization, so new dio readers will be forced
318-
* to grab i_mutex. It is used to avoid the endless truncate due to
319-
* nonlocked dio read.
320-
*/
321-
static inline void btrfs_inode_block_unlocked_dio(struct btrfs_inode *inode)
322-
{
323-
set_bit(BTRFS_INODE_READDIO_NEED_LOCK, &inode->runtime_flags);
324-
smp_mb();
325-
}
326-
327-
static inline void btrfs_inode_resume_unlocked_dio(struct btrfs_inode *inode)
328-
{
329-
smp_mb__before_atomic();
330-
clear_bit(BTRFS_INODE_READDIO_NEED_LOCK, &inode->runtime_flags);
331-
}
332-
333315
/* Array of bytes with variable length, hexadecimal format 0x1234 */
334316
#define CSUM_FMT "0x%*phN"
335317
#define CSUM_FMT_VALUE(size, bytes) size, bytes

fs/btrfs/inode.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4750,10 +4750,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
47504750

47514751
truncate_setsize(inode, newsize);
47524752

4753-
/* Disable nonlocked read DIO to avoid the endless truncate */
4754-
btrfs_inode_block_unlocked_dio(BTRFS_I(inode));
47554753
inode_dio_wait(inode);
4756-
btrfs_inode_resume_unlocked_dio(BTRFS_I(inode));
47574754

47584755
ret = btrfs_truncate(inode, newsize == oldsize);
47594756
if (ret && inode->i_nlink) {

0 commit comments

Comments
 (0)