Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp527453lqh; Fri, 31 May 2024 08:29:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUeiv8yJHt/9GoiCTaDoqnrp4G0QVUYCisoxYPqwZBBgf4tmevo2HZkkdt/LjieTysZw87SvSe3IH2POup93y6alc+2LnJADyIR7K4kxQ== X-Google-Smtp-Source: AGHT+IH2a0p5loBmnZwafOvTdZsH52pwEbPhiD+ROASViSyU6RLstnXee2gFoCLbubBr94wX9OXV X-Received: by 2002:a50:9b19:0:b0:56e:238e:372c with SMTP id 4fb4d7f45d1cf-57a3653a3d7mr1358019a12.26.1717169374372; Fri, 31 May 2024 08:29:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717169374; cv=pass; d=google.com; s=arc-20160816; b=osVBXy0y8izMmI6nVS6aKe27lxspZJm7Z+aXxhVca98R1Yz3aiheNjoaDgv2xaWDaS nj2bW/NeegQ8jpZ97SFyNLdWHKJ6p+AxczpCBaSJk/kcnzyOA4+OZtM7kkMPjfB+nkGB DJiGrt76a/vZ5HEBSiX1h/74ECaKMfivjnybmn/6yAmrNH2QT9HkupxvEWLeDj2cTTg1 nUwFOi3MEBQM0g6jBNopV+45edLr0srmxVaK4zmfAjH99Q5obzSt2ZlFVGTKYTliarEi detSGyKQ1zQwZycL2rDLQpk+tcJjcQ6DgZdmE8YGfOl1Q/yeDbQz97O4eYP1iceYbVFA 4a+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/CFsZSxryEuKtskHd9kyrux8Cg/9pCLLBrrQd2qafVA=; fh=/+oJP8T5Dkpuf5Cn3AdmJIb4b6f4Vsc2mL9mQYxwkNg=; b=YNeOjA+JOVJVlLeRfJFK4qPjqGpX8TAJp2lmdhFZ9ssQSxDJhN5IVMXZFH8K6lbpNJ Dw7guhqiS0P9CPs+//qOIZxOK4D/OJJDaOO31MJUd7lXw/uO90fvgM1ifjWa1cotETpS CoksEjuv80dtOjSr58vIvoO9vDViznZWUwvOnz6HGKBe5tiKvZVwK0E3/ruHGPVdxl24 OhXWHnVIyujE00ZmNiX/bbQIPG6y6gGFNxULn/gxMWu/6/82O9kdSq9xHYo+5OzWwZdH jf75ql4qzq8J/NQ90mHM3nTf36bQSDczvpwV8huSFvUsMHAOJ8nwp99MIHzAGlwcECUA +pbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UF+2dzDh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-197066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197066-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31cb3f83si1040854a12.610.2024.05.31.08.29.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 08:29:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UF+2dzDh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-197066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197066-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0978A1F217E8 for ; Fri, 31 May 2024 15:29:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B54177118; Fri, 31 May 2024 15:29:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UF+2dzDh" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 902AB33080; Fri, 31 May 2024 15:29:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717169363; cv=none; b=JVeSrP5J03IoYApssbR4pyJCPiOs7sSkjRkscc9eqkciBcsY/QZ/0OZEbxCrzDIVcLI1FH1YIxgJC7pwS1fEFWxWrPZX2DZltROw84ZpDy78JtbtTnDxHEz6KUDCIMdWu6zBxPUge5vyLKiCVWSCJr6FaH5R7o/hJlPOk56+f/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717169363; c=relaxed/simple; bh=vGdGcvG/usBANOA8rI6HjNUXFa+3GSenghMlRYfsdgA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jOmr+leAS3krXSHLhQryUSfbPQUejdVtVj4u4rf9wq1oaOAJyLn6PxeOdVcgfwdkEeplbBe6+bf996DpC+TqBrzKUJdfeyEdohr0XdalcfW4xe0vDxTXnye2fHH7XqJey8Is+PQJaEvFqM39BkF1UQNKuQrUP04Nm4jdLuOanPI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UF+2dzDh; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 122DFC116B1; Fri, 31 May 2024 15:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717169363; bh=vGdGcvG/usBANOA8rI6HjNUXFa+3GSenghMlRYfsdgA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UF+2dzDh6UpZmUspof8Y3Y11pjEkOJ4u4k3fnlpwD6csQFbUlRc+YOwzDBNfgjQ0Y 6y6UArHPAvnIA+M8dgy8aB4CBagR2BPX9DLzaP0cG/KuYMztdP+qIv5RQ/q3nzGyVt l5s1afe35RsHc6Mq7c9F2kqWJs23LDOQNT1y/FNxXgWcdpipHTxVWBjfsA0b3iueuF /WHKa8NytnhvEHZDmFgPxMa6azgFXgLT7DgNDpvIppfmCorcFwSkPVjtUDuhe4y1K1 8oKOV2eU+WtmkkMx1hy/gZ1DY+sYyerAhamQf0sGVWzRKWGOUWnZEWghbiccyg8MlV stx36vE4Oz9vw== Date: Fri, 31 May 2024 08:29:22 -0700 From: "Darrick J. Wong" To: Christoph Hellwig Cc: Zhang Yi , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, brauner@kernel.org, david@fromorbit.com, chandanbabu@kernel.org, jack@suse.cz, willy@infradead.org, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: Re: [RFC PATCH v4 7/8] xfs: reserve blocks for truncating realtime inode Message-ID: <20240531152922.GN52987@frogsfrogsfrogs> References: <20240529095206.2568162-1-yi.zhang@huaweicloud.com> <20240529095206.2568162-8-yi.zhang@huaweicloud.com> <20240531141000.GH52987@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, May 31, 2024 at 07:13:05AM -0700, Christoph Hellwig wrote: > On Fri, May 31, 2024 at 07:10:00AM -0700, Darrick J. Wong wrote: > > On Fri, May 31, 2024 at 05:42:37AM -0700, Christoph Hellwig wrote: > > > > - error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp); > > > > + resblks = XFS_IS_REALTIME_INODE(ip) ? XFS_DIOSTRAT_SPACE_RES(mp, 0) : 0; > > > > > > This probably wants a comment explaining that we need the block > > > reservation for bmap btree block allocations / splits that can happen > > > because we can split a written extent into one written and one > > > unwritten, while for the data fork we'll always just shorten or > > > remove extents. > > > > "for the data fork"? > > > > This always runs on the data fork. Did you mean "for files with alloc > > unit > 1 fsblock"? > > Sorry, it was meant to say for the data device. My whole journey > to check if this could get called for the attr fork twisted my mind. I really hope not -- all writes to the attr fork have known sizes at syscall time, and appending doesn't even make sense. > But you have a good point that even for the rt device we only need > the reservation for an rtextsize > 1. --D