Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp538793lqh; Fri, 31 May 2024 08:48:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVh1D5GzCahXvVw4Ktf9Z+LzZLG5MMl+ph8yArYevttc4ujuFpw2Msk49P4U/dMyuxFcEz0BwLw5dpCNLtHKaCZsxlQQVB++lxrBew39Q== X-Google-Smtp-Source: AGHT+IHgwWgunPr9C4ZKEfjkBxfLpDyQePhVMbqKFPpANqnO+BqoeS7lhHQYpEYVMraUqNmMjrV/ X-Received: by 2002:a17:906:370d:b0:a5a:3da6:7712 with SMTP id a640c23a62f3a-a68220494e2mr152234766b.71.1717170495337; Fri, 31 May 2024 08:48:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717170495; cv=pass; d=google.com; s=arc-20160816; b=fQlNq2h2gIPfQKNgww+G5cb2Vq3PhQ5BVFZML2VPQXfP5Ezrp8HtbBzCoBLJghUSpY oVgjPDIB8mvPzBBRtrfHLf24SnbNlohqYYv62KXHmqNn9JldkdEs7JraYBxunFLk9ajw LDloYLtruwP6cDDy+N7Ako5t7l2o1XF/ojiTbH8ljWRBXCfDrV8UEmhXQxRhbEDL7jfK viUVF0swpIC8+G7H5S98A8rmW7tS4+DK3xHKgWaUhVHoraw7ruzKJsccZoJf5YQr3JIj +mP9JF4c75FGV7zvLa0Eeg2rYAMyZcHjlg3eF5nmfjwltKPUUhrnlPH3C5NhGTdVXAdg l5cg== 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=PG064AjeQrSESy4LpL2Nyv1xiftbRyDQaqAqFgklnuI=; fh=sPKrtYcvfYrx0SMCKkPItgREgastrob9cURc2UNAf8I=; b=gasgRmES/yfl2V6Ldr7n301oLlp0tqlgCxAQDfFM0jcUEqhi2BdkzjDXBr4gWK1gr9 v6lcOCSfUC/dYA2ud5Qiv8z7AiFXeKbl5S4qRrFPMbEV5IZVK7l7NFq+U+rJ6E6V8+O8 +mSK0ql/417/jB0iADolO9XBRb6WISRUCmSCzcEpJwrjXreXW3KOul3U0C6qMrSPiIGE Ldg5A6/eMGvwCVEJfGlzm+YvvLNhsq85ZyEPvxeUWYSAgIi4IPJNd/jqXkbZU4ic4/bM ShyrauoGqiPBLrwAPmpiaNDk1BdtRP7weBSoh8NFv3C0krvpSeADWTJbcu4BnZeJ9yTc btuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=OGMKFbLI; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-196814-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196814-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a67ea38ea25si103840066b.304.2024.05.31.08.48.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 08:48:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196814-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=OGMKFbLI; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-196814-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196814-linux.lists.archive=gmail.com@vger.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 666E51F28B34 for ; Fri, 31 May 2024 12:42:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A369158848; Fri, 31 May 2024 12:42:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="OGMKFbLI" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3532B1E498; Fri, 31 May 2024 12:42:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717159359; cv=none; b=Z+E8Gvd9ANDFqMo7ggsnzTbQB0QE5AN7Obodj+Sdig90FX0UoqjnG6H6yQ7hHnSKh2aloKzvQKPorTQbDM9EmTIun1jKB8wk8AgixPPNZ5j87Dd4zF65E+YwgKazXCdBMFuF5ke40lpC3DhjqhdhuTWlVL0MA7mRbyMxMxIycH8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717159359; c=relaxed/simple; bh=qTBh2HpM9SAloF1wlUWaGIyEti34WcbewwJilEn4a5Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uqy4fy2Eov7dY1zi/lSwdicR9kNjIB/YJiBDMvyDJnIzSAZngaPwsE7rbtz7S6leXvuK2v+xsYOLtX99bivOGdoF1WqNtmayWSQVUggMDqYIwenqom3K6O9OoC1wWqm+jxqolLpxhjptQ3Mwhp+G01kVl4/HUGlxzyhyhpDHCsU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=OGMKFbLI; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=PG064AjeQrSESy4LpL2Nyv1xiftbRyDQaqAqFgklnuI=; b=OGMKFbLIoQflKOSrBsT7/12+Nj cIhVbEUocTGZ6Oey/QUjOhfM1ozm2dour/2V+UKtcOm/NUF6OXtojXsQnaGmaDWE9opLNXCSU6rTf evp5MprXAKSAPHwLEGpXpYcDFsOqd8CWv/BiEI0rkayaq/VnleRyRMAaNvjIjah56UT85I1NehNo/ bsAiekXOld1RFYVyMb2uyJgXrxSIwHin3+YUbbOxe+wPQ8muw8nX3qqpDHvkGMgnJei5RDhjbTjFw iSP3QLH0NEr8QX/vP4X7X6Ng0UewlEHjLhaCfHF86+to9Ty+O+KgDpVJyAq/31FCVjrCqmgr/z7rO oaCdQhYQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sD1af-0000000AEip-35Oh; Fri, 31 May 2024 12:42:37 +0000 Date: Fri, 31 May 2024 05:42:37 -0700 From: Christoph Hellwig To: Zhang Yi Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, djwong@kernel.org, hch@infradead.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: 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: <20240529095206.2568162-8-yi.zhang@huaweicloud.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html > - 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. 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);