Skip to content

Commit efbe3c2

Browse files
weiny2djwong
authored andcommitted
fs: Remove unneeded IS_DAX() check in io_is_direct()
Remove the check because DAX now has it's own read/write methods and file systems which support DAX check IS_DAX() prior to IOCB_DIRECT on their own. Therefore, it does not matter if the file state is DAX when the iocb flags are created. Also remove io_is_direct() as it is just a simple flag check. Reviewed-by: Dave Chinner <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Ira Weiny <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 0e698df commit efbe3c2

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

drivers/block/loop.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,8 @@ static int do_req_filebacked(struct loop_device *lo, struct request *rq)
634634

635635
static inline void loop_update_dio(struct loop_device *lo)
636636
{
637-
__loop_update_dio(lo, io_is_direct(lo->lo_backing_file) |
638-
lo->use_dio);
637+
__loop_update_dio(lo, (lo->lo_backing_file->f_flags & O_DIRECT) |
638+
lo->use_dio);
639639
}
640640

641641
static void loop_reread_partitions(struct loop_device *lo,
@@ -1028,7 +1028,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
10281028
if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync)
10291029
blk_queue_write_cache(lo->lo_queue, true, false);
10301030

1031-
if (io_is_direct(lo->lo_backing_file) && inode->i_sb->s_bdev) {
1031+
if ((lo->lo_backing_file->f_flags & O_DIRECT) && inode->i_sb->s_bdev) {
10321032
/* In case of direct I/O, match underlying block size */
10331033
unsigned short bsize = bdev_logical_block_size(
10341034
inode->i_sb->s_bdev);

include/linux/fs.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3394,11 +3394,6 @@ extern void setattr_copy(struct inode *inode, const struct iattr *attr);
33943394

33953395
extern int file_update_time(struct file *file);
33963396

3397-
static inline bool io_is_direct(struct file *filp)
3398-
{
3399-
return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host);
3400-
}
3401-
34023397
static inline bool vma_is_dax(const struct vm_area_struct *vma)
34033398
{
34043399
return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host);
@@ -3423,7 +3418,7 @@ static inline int iocb_flags(struct file *file)
34233418
int res = 0;
34243419
if (file->f_flags & O_APPEND)
34253420
res |= IOCB_APPEND;
3426-
if (io_is_direct(file))
3421+
if (file->f_flags & O_DIRECT)
34273422
res |= IOCB_DIRECT;
34283423
if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host))
34293424
res |= IOCB_DSYNC;

0 commit comments

Comments
 (0)