From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC4BCC433E9 for ; Tue, 12 Jan 2021 19:05:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A32F423102 for ; Tue, 12 Jan 2021 19:05:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406584AbhALTF2 (ORCPT ); Tue, 12 Jan 2021 14:05:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:42272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406212AbhALTF2 (ORCPT ); Tue, 12 Jan 2021 14:05:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B797230F9; Tue, 12 Jan 2021 19:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610478249; bh=Zs1h5JfMmZOeqAwdOYUH+AziTqKfcFLZqcUS4NYWVDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cm00WACIoNMlTYL0uJSNnHvNdLoQ/ExfQkhIm4IyRnI8Gkzr97lIAe5g6goqw5qN0 cFHtPNEBXpDjjIG3ZuJAINbeFIoOUSGDgFvwWs8SsgWdYcdTwxyh1jZZEbDvMGTR4F CCOEuBkUzU9p2J4MWW8m+8nT41oSeAXFbUORKfQIev6Nhk7Ud2VSdrq+DaP1PpHxrd 7+DWRCmwpZ8wyIOTh/73J/6MYNpQuUX6NrHhksoznNkr+PAAwPwMj+ttPARWpY4u6U S6lvjbzFA+tJVd9KHBxMZM3p2D1TrH91q2z4cIng/8ZVUQPEhaZt9K+6cq877CKdkR n78IDCLrJB4FQ== From: Eric Biggers To: linux-fsdevel@vger.kernel.org Cc: linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Theodore Ts'o , Christoph Hellwig , Jan Kara Subject: [PATCH v3 06/11] fs: pass only I_DIRTY_INODE flags to ->dirty_inode Date: Tue, 12 Jan 2021 11:02:48 -0800 Message-Id: <20210112190253.64307-7-ebiggers@kernel.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210112190253.64307-1-ebiggers@kernel.org> References: <20210112190253.64307-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Eric Biggers ->dirty_inode is now only called when I_DIRTY_INODE (I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) is set. However it may still be passed other dirty flags at the same time, provided that these other flags happened to be passed to __mark_inode_dirty() at the same time as I_DIRTY_INODE. This doesn't make sense because there is no reason for filesystems to care about these extra flags. Nor are filesystems notified about all updates to these other flags. Therefore, mask the flags before passing them to ->dirty_inode. Also properly document ->dirty_inode in vfs.rst. Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Signed-off-by: Eric Biggers --- Documentation/filesystems/vfs.rst | 5 ++++- fs/fs-writeback.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst index ca52c82e5bb54..287b80948a40b 100644 --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst @@ -270,7 +270,10 @@ or bottom half). ->alloc_inode. ``dirty_inode`` - this method is called by the VFS to mark an inode dirty. + this method is called by the VFS when an inode is marked dirty. + This is specifically for the inode itself being marked dirty, + not its data. If the update needs to be persisted by fdatasync(), + then I_DIRTY_DATASYNC will be set in the flags argument. ``write_inode`` this method is called when the VFS needs to write an inode to diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index b7616bbd55336..2e6064012f7d3 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2259,7 +2259,7 @@ void __mark_inode_dirty(struct inode *inode, int flags) trace_writeback_dirty_inode_start(inode, flags); if (sb->s_op->dirty_inode) - sb->s_op->dirty_inode(inode, flags); + sb->s_op->dirty_inode(inode, flags & I_DIRTY_INODE); trace_writeback_dirty_inode(inode, flags); -- 2.30.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F6EAC433DB for ; Tue, 12 Jan 2021 19:04:31 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9088623107; Tue, 12 Jan 2021 19:04:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9088623107 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kzOxy-0000tD-4G; Tue, 12 Jan 2021 19:04:30 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzOxx-0000sn-A6 for linux-f2fs-devel@lists.sourceforge.net; Tue, 12 Jan 2021 19:04:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9jM31ZQ7HBtIli5iNUMGjkS7eG0fSZZhSx3Kx+B70ZA=; b=USVPIG69g853oUNhIb1/Gb77jW lDpWaEhhnQY5NbwZd/cwKJL599cexxtMyHqmhXBZyJ9r2fphYMtGTLkMoItdfGYO6xHF7fQp7VgMG jEYSlDDYQ8q/5olM5BgTkBEgJK0sbW7VDSnGFhAqy8dLBRtu6sz37WXqs9ueFYqlcSyw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9jM31ZQ7HBtIli5iNUMGjkS7eG0fSZZhSx3Kx+B70ZA=; b=ioEOLClMQuJpCaTR6v0PDvJL6b biqb8LLq08/nrNwatGkP/Ub5MtG6KaI0sis4P1AJ4HYdoWVohJ0CKdqp0HXBtm6dc8oU0OWMBeBAX 5gBscqFus5FVuLK34rSH6i52MtZUaDOLnKIfUNZMSrBoE40bmsyYiepnxX4OKJ2hvDek=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kzOxq-004zCq-6p for linux-f2fs-devel@lists.sourceforge.net; Tue, 12 Jan 2021 19:04:29 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B797230F9; Tue, 12 Jan 2021 19:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610478249; bh=Zs1h5JfMmZOeqAwdOYUH+AziTqKfcFLZqcUS4NYWVDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cm00WACIoNMlTYL0uJSNnHvNdLoQ/ExfQkhIm4IyRnI8Gkzr97lIAe5g6goqw5qN0 cFHtPNEBXpDjjIG3ZuJAINbeFIoOUSGDgFvwWs8SsgWdYcdTwxyh1jZZEbDvMGTR4F CCOEuBkUzU9p2J4MWW8m+8nT41oSeAXFbUORKfQIev6Nhk7Ud2VSdrq+DaP1PpHxrd 7+DWRCmwpZ8wyIOTh/73J/6MYNpQuUX6NrHhksoznNkr+PAAwPwMj+ttPARWpY4u6U S6lvjbzFA+tJVd9KHBxMZM3p2D1TrH91q2z4cIng/8ZVUQPEhaZt9K+6cq877CKdkR n78IDCLrJB4FQ== From: Eric Biggers To: linux-fsdevel@vger.kernel.org Date: Tue, 12 Jan 2021 11:02:48 -0800 Message-Id: <20210112190253.64307-7-ebiggers@kernel.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210112190253.64307-1-ebiggers@kernel.org> References: <20210112190253.64307-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Headers-End: 1kzOxq-004zCq-6p Subject: [f2fs-dev] [PATCH v3 06/11] fs: pass only I_DIRTY_INODE flags to ->dirty_inode X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Kara , linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, Theodore Ts'o , linux-ext4@vger.kernel.org, Christoph Hellwig Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: Eric Biggers ->dirty_inode is now only called when I_DIRTY_INODE (I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) is set. However it may still be passed other dirty flags at the same time, provided that these other flags happened to be passed to __mark_inode_dirty() at the same time as I_DIRTY_INODE. This doesn't make sense because there is no reason for filesystems to care about these extra flags. Nor are filesystems notified about all updates to these other flags. Therefore, mask the flags before passing them to ->dirty_inode. Also properly document ->dirty_inode in vfs.rst. Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Signed-off-by: Eric Biggers --- Documentation/filesystems/vfs.rst | 5 ++++- fs/fs-writeback.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst index ca52c82e5bb54..287b80948a40b 100644 --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst @@ -270,7 +270,10 @@ or bottom half). ->alloc_inode. ``dirty_inode`` - this method is called by the VFS to mark an inode dirty. + this method is called by the VFS when an inode is marked dirty. + This is specifically for the inode itself being marked dirty, + not its data. If the update needs to be persisted by fdatasync(), + then I_DIRTY_DATASYNC will be set in the flags argument. ``write_inode`` this method is called when the VFS needs to write an inode to diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index b7616bbd55336..2e6064012f7d3 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2259,7 +2259,7 @@ void __mark_inode_dirty(struct inode *inode, int flags) trace_writeback_dirty_inode_start(inode, flags); if (sb->s_op->dirty_inode) - sb->s_op->dirty_inode(inode, flags); + sb->s_op->dirty_inode(inode, flags & I_DIRTY_INODE); trace_writeback_dirty_inode(inode, flags); -- 2.30.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel