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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A3D4C00A8F for ; Tue, 24 Oct 2023 16:17:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9913C6B02C8; Tue, 24 Oct 2023 12:17:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 941166B02C9; Tue, 24 Oct 2023 12:17:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82F516B02CA; Tue, 24 Oct 2023 12:17:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 730146B02C8 for ; Tue, 24 Oct 2023 12:17:06 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4DB97160428 for ; Tue, 24 Oct 2023 16:17:06 +0000 (UTC) X-FDA: 81380859252.26.BF46F72 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf03.hostedemail.com (Postfix) with ESMTP id 81F4F2000C for ; Tue, 24 Oct 2023 16:17:04 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698164224; a=rsa-sha256; cv=none; b=Dk5X4BArWeQ//Ae5AVICjNKqKI/x+PvEiBbU6XOFYX0wFP1hyGOatujZBQXmvyoziCaYn8 q9MPl0gnZJr6Hlr5YhNFJPd37t4GkvuN4uWPYla67Xvh34GrQMASvfEPckhmaswvkLMfHq wWhoKIx3bbZLEIfvzkqzG2oMnpQHtOQ= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698164224; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BLn8L8CSalmocwhNGj7w+rLifGOieyJaES8JcHQUCBI=; b=FCTmxyeHEr1fX8pxhrdgOnD251DZ+3T/YcLkjrZXLAw/0ZfN1TO8HbHWd549O8e9fte0gR 3gJUf4E2DmAkhrB3AYYKRvnUGIQ/u9Ar6T3GusL7ZtWzjZzmUf8Hb6NFk9oE5DZd9Sb46+ qv5APu8drH5Oo49xqY5kGBSpCuK5Y14= Received: by verein.lst.de (Postfix, from userid 2407) id 3DCE468AA6; Tue, 24 Oct 2023 18:17:00 +0200 (CEST) Date: Tue, 24 Oct 2023 18:16:59 +0200 From: Christoph Hellwig To: "Darrick J. Wong" Cc: Christoph Hellwig , Jens Axboe , Matthew Wilcox , Ilya Dryomov , Andrew Morton , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 3/3] xfs: respect the stable writes flag on the RT device Message-ID: <20231024161659.GB20546@lst.de> References: <20231024064416.897956-1-hch@lst.de> <20231024064416.897956-4-hch@lst.de> <20231024150904.GA3195650@frogsfrogsfrogs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231024150904.GA3195650@frogsfrogsfrogs> User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 81F4F2000C X-Stat-Signature: cmbc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Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Oct 24, 2023 at 08:09:04AM -0700, Darrick J. Wong wrote: > > + /* > > + * Make the stable writes flag match that of the device the inode > > + * resides on when flipping the RT flag. > > + */ > > + if (S_ISREG(VFS_I(ip)->i_mode) && > > + XFS_IS_REALTIME_INODE(ip) != (fa->fsx_xflags & FS_XFLAG_REALTIME)) > > + xfs_update_stable_writes(ip); > > Hmm. Won't the masking operation here result in the if test comparing 0 > or FS_XFLAG_REALTIME to 0 or 1? > > Oh. FS_XFLAG_REALTIME == 1, so that's not an issue in this one case. > That's a bit subtle though, I'd have preferred > > XFS_IS_REALTIME_INODE(ip) != !!(fa->fsx_xflags & FS_XFLAG_REALTIME)) > > to make it more obvious that the if test isn't comparing apples to > oranges. This is all copy and pasted from a check a few lines above :) I guess I could clean it up as well or even add a rt_flag_changed local variable instead of duplicating the check. > > + /* > > + * For real-time inodes update the stable write flags to that of the RT > > + * device instead of the data device. > > + */ > > + if (S_ISREG(inode->i_mode) && XFS_IS_REALTIME_INODE(ip)) > > + xfs_update_stable_writes(ip); > > I wonder if xfs_update_stable_writes should become an empty function for > the CONFIG_XFS_RT=n case, to avoid the atomic flags update? > > (The extra code is probably not worth the microoptimization.) The compiler already eliminates the code because XFS_IS_REALTIME_INODE(ip) has a stub for CONFIG_XFS_RT=n that always returns 0.