Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp474612lqh; Fri, 31 May 2024 07:10:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWDD3ZQMx6mVY0c0nIn296adRb7DzAtDm9+j9b/zAGWDJ+NPpMQQ/YjiDrnzTzTWHNmgwJyp8Rjm0D0xcLMnOu04pTmXWY8wALJmNorHA== X-Google-Smtp-Source: AGHT+IHDVwcvQ0QwmaSog+gr+BkmzqG3YJVztz8l6bWd8nfSt3Izc0ObclfYA9tEXBorK6WSvK4I X-Received: by 2002:ac2:58d8:0:b0:525:32aa:443e with SMTP id 2adb3069b0e04-52b8954e931mr1657763e87.17.1717164617122; Fri, 31 May 2024 07:10:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717164617; cv=pass; d=google.com; s=arc-20160816; b=rMq2tz77uiwC/PlBSk3ha2t0Y2mQlKHFHJGVLj8cvMq6JVnb1QA8LSHS9pDKSMUuh5 NYuvo3eWX+K9EimOYeGxhkUyq7YdLluS7ZX6+ioVtRAqQXC+aGlgBrXY4Ph/yQM6sfFH qXFCVnU5qjmZmgHYNbsbNsEY4oDQ27qQirY4pjz2D+n0WcNSbm5m8eK9uyQDbThBw6x4 y3c0qMRzLe0IbexveBHTPNoVc1AmNCCVjmDb9/Npx9gvjwQO4BcsLpvNsdvc0pJ51IrT lw0+PixlKsmTrDTKGGrUcjFXLbv5owg2Fw4eAA/+OX+dCEi6v23VWCW06Ho3R4KcV4Dh 5kRg== 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=6m2xJjfM8YtZi7ZN5GXw1qIqfyeh4yfKYHuQvJPH/XQ=; fh=/+oJP8T5Dkpuf5Cn3AdmJIb4b6f4Vsc2mL9mQYxwkNg=; b=HZtyK5T/LnyYOzH8ZV7uCvZTrkIus8tfRMLWl3vfMbMRIubE30hnEYF5nNyXw1vjcM KWQnjqwLFmQwA3t/L0NN90pXlH9mz7QwftNG5NLocb/tpzhIJJxSQPTtQtt3CoDy2MSv OhxXU/MDu52sFH6/uG0BwtRxgikvRbRJpZTzbHRr67V4vKq8INU0M9aq/mkfBKtSA86N Nfqg4uA1XpO340NL01AYPYcOwQ2KeLHgJ9wX6ZP5OXr8X5T4sYDphZQM2W0Rl63K4EpV Jcb8Og+pX7BGnNE7OOleJr4tXCSSTfblZ0399OSKHDTKboC9vt9d2UoAjMOMY/j+hiN8 z6aw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uHCGEIFO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196947-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196947-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 a640c23a62f3a-a67e6f036dbsi94323066b.11.2024.05.31.07.10.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 07:10:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196947-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=uHCGEIFO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196947-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196947-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 CFC421F27861 for ; Fri, 31 May 2024 14:10:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6ED5816D304; Fri, 31 May 2024 14:10:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uHCGEIFO" 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 8CF021E492; Fri, 31 May 2024 14:10:01 +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=1717164601; cv=none; b=Dmg9U3Dh4TNL/kxGh38dm+XpiqgbjwMuC0ibSqAM/U+ZNa9W7g8UGcHEWxKi8TTAcRh5NMQ+ki8j4030fG3jwTwCWvXMyEVOE+0idP2lT+idHMNDoP7NcL3esiyCGJJPQKyvZGi4+wx6MfdWlUHkq8D1RvUYqQ+8Jp3hFdNekLE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717164601; c=relaxed/simple; bh=6+bnziXgxwqhoOY1VvRRs5lGYHQ7FbFZYIANGvO6r24=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gEYIOuIL1QcfPgxrvr53IXgt5eVmOINBwws4rElQ7rGd9NhCxyRA1uS+MGyHGAe1bykw+Mq9oVF23NTxKtWgVKDnGOsw23ulisYAuDIwQ9Ca3jVDhRpcPcCfYb6hHfs2zk78rKFCBUuUnenCfHmXsL77KqejruLj0XMJ7jzkQbc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uHCGEIFO; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11902C116B1; Fri, 31 May 2024 14:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717164601; bh=6+bnziXgxwqhoOY1VvRRs5lGYHQ7FbFZYIANGvO6r24=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uHCGEIFOz4I2/6WrL6ELPQdxd5jko0EOlBJFWfb5W4ZFEpUE+TaUHQ+mRh0tmJ22i 7dP4R0TRtqPzRXAmuWNv9Iuc82Clm3TddeBYWHJzEuqtFHfelXxW2G6uWmGZbPrze1 bhj7rZT5NNYTtUaVrfKyJLw1xVhCIXWLBWwxurU6rIACfZmrjH3u018xj9IR883O+q k1j3+aD1JRuUKKMFkFaUqCQnnLpoDze28e7SNpQ+2JbN/E17UCeKcjV90mkRBkUo4a ESyDoEbgDDwNWHsyyTvCnTSZkKa7uqXQgHoIEW7vL4beeN79amXgDncFO38BIviXDy /kxPObN06vJAg== Date: Fri, 31 May 2024 07:10:00 -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: <20240531141000.GH52987@frogsfrogsfrogs> References: <20240529095206.2568162-1-yi.zhang@huaweicloud.com> <20240529095206.2568162-8-yi.zhang@huaweicloud.com> 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 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"? > I'd also find this more readable if resblks was initialized to 0, > and this became a: > > if (XFS_IS_REALTIME_INODE(ip)) > resblks = XFS_DIOSTRAT_SPACE_RES(mp, 0); Agreed. --D