Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3510903ybz; Mon, 27 Apr 2020 17:24:19 -0700 (PDT) X-Google-Smtp-Source: APiQypJJdxHURuuugJwr9zyJ67900DxOIgsAKBCuMOLEggSbO/W06dPuvX6R6aDf/XEn9Ui1E9Mi X-Received: by 2002:a17:906:1e47:: with SMTP id i7mr22452469ejj.61.1588033459477; Mon, 27 Apr 2020 17:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588033459; cv=none; d=google.com; s=arc-20160816; b=rrh3iMIKpdQSNNgRnzflYrrexCUnez61OwKhc/+nEzR0KvOjanPPFv5fGqYz3IMYQ3 2xqL6e3T7fH0b0AFEYeX5DzBb8T/9wE+hMKWvKD6Zob54WdpxkSvkp2ay8Gi7jelMrHK MPugBqDnT3j86h5xekekdoezylZ9SYR+vOKis2E5ID18yG0EW5oEqcUIs/IZAajhibC1 J59MoTULkvWGXqEc2HX09xAQ2tzVxkVMpTiUyAy49ZUGBizdlaUSLx+yryXQLBLgpcph EjpRB3LklG7Gf0moXG0zY4cqU6L/NCC74czGnJDtnkmVcq/5SrS+My5/Bxa5QACdNL59 ny/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=JQOH85qfNSQBjcSdYi+c9wGhy4vfkbSvR1n308jwWzU=; b=X0wej8TMim5k26KHPv36fVm4SiJSSwI/tPgIsdDrn8OTF07dUdeSvW7pdWQHBF5w10 rQ7GrWVVhror87wN6Z6XmE0H05I44iiEw97+UwqEcUjW9xVQ2dMT27lEbwxgZ0cug07n IbwHv/b5vDFkHJHmqaEjnrzbgVFhhpL1AKTlXySBiJnaMebhVb2zLAdQJH9FiSX7edlS tl+w5tlSMe7mcsHuJmWjCis0vMFXtGigbOphpJm45xOmw+izb4W1qYE8VN8eofS7eyX+ zmxsD5m8dS62cw7IrNRUU7iHalmz85U2KEIC7hfaoHxNSuQbIXE2o6udKCMKbaHNVqBw bDxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si768568ejr.170.2020.04.27.17.23.56; Mon, 27 Apr 2020 17:24:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726660AbgD1AWj (ORCPT + 99 others); Mon, 27 Apr 2020 20:22:39 -0400 Received: from mga18.intel.com ([134.134.136.126]:16476 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726424AbgD1AVt (ORCPT ); Mon, 27 Apr 2020 20:21:49 -0400 IronPort-SDR: otWHwsYP7gJC3Nedz6AbXqXhkUeVc5uPDXCHZ+L0kQVVteh2pfSR7lMCPyRP+Bveh/tYzgz0i9 BLJquHBI3eig== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2020 17:21:48 -0700 IronPort-SDR: CzElres2me3QpcebS4hq61xayp3+MnEtKbHg/B4tNmZEW4TkWo5aykndJ3RyIAZQsROOEfosir v8KDoWQIoJgg== X-IronPort-AV: E=Sophos;i="5.73,325,1583222400"; d="scan'208";a="275659926" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2020 17:21:47 -0700 From: ira.weiny@intel.com To: linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, "Darrick J. Wong" Cc: Ira Weiny , Dave Chinner , Jan Kara , Christoph Hellwig , Al Viro , Dan Williams , Dave Chinner , "Theodore Y. Ts'o" , Jeff Moyer , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org Subject: [PATCH V11 02/11] fs: Remove unneeded IS_DAX() check in io_is_direct() Date: Mon, 27 Apr 2020 17:21:33 -0700 Message-Id: <20200428002142.404144-3-ira.weiny@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200428002142.404144-1-ira.weiny@intel.com> References: <20200428002142.404144-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Ira Weiny 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 Reviewed-by: Jan Kara Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Ira Weiny --- Changes from v8: Rebase to latest Linus tree Changes from v6: remove io_is_direct() as well. Remove Reviews since this is quite a bit different. Changes from v3: Reword commit message. Reordered to be a 'pre-cleanup' patch --- drivers/block/loop.c | 6 +++--- include/linux/fs.h | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index da693e6a834e..14372df0f354 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -634,8 +634,8 @@ static int do_req_filebacked(struct loop_device *lo, struct request *rq) static inline void loop_update_dio(struct loop_device *lo) { - __loop_update_dio(lo, io_is_direct(lo->lo_backing_file) | - lo->use_dio); + __loop_update_dio(lo, (lo->lo_backing_file->f_flags & O_DIRECT) | + lo->use_dio); } 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, if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync) blk_queue_write_cache(lo->lo_queue, true, false); - if (io_is_direct(lo->lo_backing_file) && inode->i_sb->s_bdev) { + if ((lo->lo_backing_file->f_flags & O_DIRECT) && inode->i_sb->s_bdev) { /* In case of direct I/O, match underlying block size */ unsigned short bsize = bdev_logical_block_size( inode->i_sb->s_bdev); diff --git a/include/linux/fs.h b/include/linux/fs.h index 4f6f59b4f22a..a87cc5845a02 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3394,11 +3394,6 @@ extern void setattr_copy(struct inode *inode, const struct iattr *attr); extern int file_update_time(struct file *file); -static inline bool io_is_direct(struct file *filp) -{ - return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host); -} - static inline bool vma_is_dax(const struct vm_area_struct *vma) { return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host); @@ -3423,7 +3418,7 @@ static inline int iocb_flags(struct file *file) int res = 0; if (file->f_flags & O_APPEND) res |= IOCB_APPEND; - if (io_is_direct(file)) + if (file->f_flags & O_DIRECT) res |= IOCB_DIRECT; if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host)) res |= IOCB_DSYNC; -- 2.25.1