From patchwork Mon Jun 12 05:35:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13275611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60B32C7EE23 for ; Mon, 12 Jun 2023 05:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234508AbjFLFfv (ORCPT ); Mon, 12 Jun 2023 01:35:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234419AbjFLFfo (ORCPT ); Mon, 12 Jun 2023 01:35:44 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6340718B for ; Sun, 11 Jun 2023 22:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=89VKJziDz7b/CYr41XY8Omy1Z40o8Fo790ujxdQ6y1Q=; b=Mtm8B8CFGMDL/eImXuFiivwCAL 6bWOvKuI/gwDslwsqYw7HTMCpUTRNWGwL+rWG3EohGRyar04BgqCjxmXY/YIDq21WrHKvPvqinMvf 87vLPqiQqQuuph2sLxr+BeyQ/pfu5N6PzlKgK+Nso6truDD8ipUdJ7YfcAv+2WRQM5nNfO6ofWif+ 5UwTFz9Fj2bBe0ec+VK7r65amnRCC0XOQnoP9CyP7XHiBkzPgBbHQY5cU6M614NvplsCGKfldpb0B XC41EzbERC5tNFx/nuis8XFq17VOAvYhxfLuZDscUzKKtpoucVe+o3f367Ov6BGFabSyiuTZbTC3s l2wykD4w==; Received: from 2a02-8389-2341-5b80-8c8c-28f8-1274-e038.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:8c8c:28f8:1274:e038] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q8aDL-002f7O-1e; Mon, 12 Jun 2023 05:35:39 +0000 From: Christoph Hellwig To: xiubli@redhat.com, idryomov@gmail.com, jlayton@kernel.org, ceph-devel@vger.kernel.org Subject: [PATCH] ceph: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Date: Mon, 12 Jun 2023 07:35:37 +0200 Message-Id: <20230612053537.585525-1-hch@lst.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Since commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") file systems can just set the FMODE_CAN_ODIRECT flag at open time instead of wiring up a dummy direct_IO method to indicate support for direct I/O. Do that for ceph so that noop_direct_IO can eventually be removed. Signed-off-by: Christoph Hellwig --- fs/ceph/addr.c | 1 - fs/ceph/file.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 6bb251a4d613eb..19c0f42540b600 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1401,7 +1401,6 @@ const struct address_space_operations ceph_aops = { .dirty_folio = ceph_dirty_folio, .invalidate_folio = ceph_invalidate_folio, .release_folio = ceph_release_folio, - .direct_IO = noop_direct_IO, }; static void ceph_block_sigs(sigset_t *oldset) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index f4d8bf7dec88a8..314c5d5971bf4a 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -368,6 +368,8 @@ int ceph_open(struct inode *inode, struct file *file) flags = file->f_flags & ~(O_CREAT|O_EXCL); if (S_ISDIR(inode->i_mode)) flags = O_DIRECTORY; /* mds likes to know */ + if (S_ISREG(inode->i_mode)) + file->f_mode |= FMODE_CAN_ODIRECT; dout("open inode %p ino %llx.%llx file %p flags %d (%d)\n", inode, ceph_vinop(inode), file, flags, file->f_flags);