From patchwork Mon Jan 6 09:54:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927114 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 315FE1D619E for ; Mon, 6 Jan 2025 09:56:18 +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=1736157380; cv=none; b=OoqQNPGoW2y/kJhDW71ujdSF77wwXgZ90mbATxW3kE1agGHaAVipFcjKBEPe9SBZl3EfqGeisrHNBfZ9i4yrKLrsVX4OJrelS3WkAVuZmoh67Jur9bwZu+akfgjFUefsmCU6dOb5IcqCRuLl5xSg5UH/CJb7P4XOEJE43N00SkE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157380; c=relaxed/simple; bh=g3LZ2nIUmjjDxk7BB4on3sLforYBouXid4zHyXIr0mE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JkiV5/UMu0YXuXDPKnGRw25upluIhJGkyta/Z3IujFk1Pw7jUxCQwXdLNfRQJiM6iWlU8UNX9JQ2ZWRauo82V2g9dst3qH9X8DnytgTL/f4sk2C+6syAwG4xJpKEDY6wwgbHwx2wn8ryLpOAsVfDeYt7R5G6ixIODKBuHnt/KKQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=UXH9j2pw; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="UXH9j2pw" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=PX1VncT4RmAtddDaB9jL14vC4dC3UJinYNv4hMCmyDs=; b=UXH9j2pwOLV2KQPQFMftzhTDBS JwofxSTn5DFF//4Bm/VrbYD9NXk6bk1O0wjsPDwyYMOS3flYQcFj9U6lN++1fUfbSw/Egaw7w9IBp jmaGaTJ/9c9bo9TtOfJUTSB5yarZWFRFl8icPP8WCrqUm0D3Jgn2YhCgDfiMXTjWgEclfiSuFsMq6 nuZwWluRHzc3mkXngAbnvCs1bHDX9dip1A3KzebYTOi1p0JhxJnRhiz/hdgNYg3QMo6WSYKQaLZIV x5su7ZscOp5SGSEnh0rF10Pu6pVXZleFx25HKWXRiJ9D1RRES/BJGUFtrOaWIumK4XibtnEZyaLeu qR3QAsqA==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqL-00000000lC5-1POS; Mon, 06 Jan 2025 09:56:17 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 01/15] xfs: fix a double completion for buffers on in-memory targets Date: Mon, 6 Jan 2025 10:54:38 +0100 Message-ID: <20250106095613.847700-2-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html __xfs_buf_submit calls xfs_buf_ioend when b_io_remaining hits zero. For in-memory buftargs b_io_remaining is never incremented from it's initial value of 1, so this always happens. Thus the extra call to xfs_buf_ioend in _xfs_buf_ioapply causes a double completion. Fortunately __xfs_buf_submit is only used for synchronous reads on in-memory buftargs due to the peculiarities of how they work, so this is mostly harmless and just causes a little extra work to be done. Fixes: 5076a6040ca1 ("xfs: support in-memory buffer cache targets") Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_buf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index aa63b8efd782..787caf0c3254 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1656,10 +1656,8 @@ _xfs_buf_ioapply( op |= REQ_META; /* in-memory targets are directly mapped, no IO required. */ - if (xfs_buftarg_is_mem(bp->b_target)) { - xfs_buf_ioend(bp); + if (xfs_buftarg_is_mem(bp->b_target)) return; - } /* * Walk all the vectors issuing IO on them. Set up the initial offset From patchwork Mon Jan 6 09:54:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927115 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 79A9EB676 for ; Mon, 6 Jan 2025 09:56:20 +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=1736157382; cv=none; b=PimcNPxX6dG5RRf2tk336gmSHRl4k2foKK+8idXYQ1crMMIv/bMrKUnSb4u/SIPM8dZqOIW+tOz52yvBn+b1p2g62ZSW1flp3ipxB2qRW50rw3yY6t0prmwlmluemL0eY+ApbOiSg/zwaEeSrcLjuU5XOvj0YJI0gPhm1Tg1zrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157382; c=relaxed/simple; bh=AD9ZQIfVAON5Bm5m5XKuhEieP3kGrOLEN2K3cAfzr6o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g3tzlSVyEjMNz/aZJ1bUSeTgw2m3gFY2rIlLxYNFrJ/x0KXr21wi4vSH3S52kKdgeOrYBSZANqgw5jl762DWxarcQrflawPVRka/rd/BdSYHccAXUEX3JmlpQTkdKLipNqa5VItMk7JyTYJehjLQYHFved1wpssXPgYSNQ1BQPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=P+0rRwop; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="P+0rRwop" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=OdMI8/y2HR9p5kJY5tBrnXXJhRqc956BkP4xpSZ40ag=; b=P+0rRwopYfUm7gJY9Uxp0VuIyM xKmFOPfe7N8BGOEQw1Zi+t7pxuRk+tksyz7f+Rmhx8y+JrlaRFH5QTc5AJbyhIoKH+ZnOHTJVeLxs gBJU1l6pdNTZQTUeUvsZb2DdosWQUrpfIa5FqeNen2gJ2uOazJWUVr+Pjxe7ChX8h4QoyE8G2KxmV t6rI8Ni1EbzLaevQ/+qACEu16aBeH+dANWSFPEFg/lGL+COzGHPfFrzeQr1fvc3RAzsGITaXBKVwp D6HGzcCsZO+VzD0pQeGoB4ablJSo/vFUmpvESAmdFDrxIqFNqPbOYLok6ZWrtmChsqJUHFvKMSrl3 6J1V82gA==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqN-00000000lCE-2zy6; Mon, 06 Jan 2025 09:56:20 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 02/15] xfs: remove the incorrect comment above xfs_buf_free_maps Date: Mon, 6 Jan 2025 10:54:39 +0100 Message-ID: <20250106095613.847700-3-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The comment above xfs_buf_free_maps talks about fields not even used in the function and also doesn't add any other value. Remove it. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_buf.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 787caf0c3254..1927655fed13 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -202,9 +202,6 @@ xfs_buf_get_maps( return 0; } -/* - * Frees b_pages if it was allocated. - */ static void xfs_buf_free_maps( struct xfs_buf *bp) From patchwork Mon Jan 6 09:54:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927116 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 A744EB676 for ; Mon, 6 Jan 2025 09:56:22 +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=1736157384; cv=none; b=qG4EiC8d9vXqw/yoerBY3/0Aya7B3LKHj6La39cbA0SR/QJzsQG6edjaHttGsaHTEhWLfekQlz0i9B06GiWh50EPLzyOg4ATRN5nXb+17g5hFpIwov4Xavf1zLSxJ9eJWUhXXP9C4MkXdMLH2BncU+2inTdpUSFUNA7ek7YsR1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157384; c=relaxed/simple; bh=OsEB0Kz8JoZ8+uz2WL48xgaYQ8evu5ptBK60qKkEcxk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uz3lK9WDcbF82ObJ5EluRR/W64By9iyTg4a3mUAjRoebTnUYkliNb1TYPFFWg7zFp5Uc25p4cUG6Wl6FjIvFiyZXHPlT6azCnAGgWkmU95Pjz1dWBBxC18S6w78+82/FMsIrjaZiZfW32Npl0hy5eAV+AJMFe/oqQYfTzeY7110= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=3Bli0s3N; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="3Bli0s3N" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=ws5mXIkIL3izsupIVy1AsPa0/+0ZJ8noCFD071mamsE=; b=3Bli0s3N1zeuD6yMcijpfl2dCa 4DMC1W+kcvIpLP0XtyF5glZUP2BFF6D7wxjBwnM4dFINQQ7y0KOVUccgSDzyDuFiV+BxKCt1emBnM h/02HqGrsB4PHbBDyGx+5nbrxg8Aqk8tAPVK80oozxGGv6dEkiSB2FIwX1ZyB/HU+xmzht3hnPxaW Ys+JP7FA0TjbjCfTxPR8ECwD2LmrZtP8PAAnbsdEebP9NiwKyrHcKJkPzfqAAmc3MnNvm4hu62p72 e5ueyVm/woXfAcEVbdzhG6GqDLohwhbUQ/h7YDP4Cc/JAlvqoINTyw7ULDDSUbiK0Wc8wK92WffQJ RtAfaHrg==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqP-00000000lDM-4Aun; Mon, 06 Jan 2025 09:56:22 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 03/15] xfs: remove the incorrect comment about the b_pag field Date: Mon, 6 Jan 2025 10:54:40 +0100 Message-ID: <20250106095613.847700-4-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The rbtree root is long gone. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_buf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index 3d56bc7a35cc..da80399c7457 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -187,7 +187,7 @@ struct xfs_buf { int b_io_error; /* internal IO error state */ wait_queue_head_t b_waiters; /* unpin waiters */ struct list_head b_list; - struct xfs_perag *b_pag; /* contains rbtree root */ + struct xfs_perag *b_pag; struct xfs_mount *b_mount; struct xfs_buftarg *b_target; /* buffer target (device) */ void *b_addr; /* virtual address of buffer */ From patchwork Mon Jan 6 09:54:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927117 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 90A6D1D9A76 for ; Mon, 6 Jan 2025 09:56:25 +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=1736157387; cv=none; b=lkuAzg8i5bPj2E9FdAL79MEF/DIUkGSA9PGiVy3YTbLW5a68Z4pGG8Y1eW6U2ZUjkoJYcGoqOlPGPZfbsHwzDO1jytQ5DBk4cGV+wYGBIXGKDd8MPvolynb19h4pxYISkqgEbDJTs7PVW7Yl2JwOwG6Cj+CXGScobjfYuPm/vY8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157387; c=relaxed/simple; bh=JrUBo9a6mBR+tKirfp5tcmayFMnc5u9f1E0w4bUFpyc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X1sBkMLnnuehYGYOktlIf3iAt/tFA7+JAaXqaSqwotxXF1tOjQsXJQxa/gurcfpyaKr9VuSL4wVpLyRKuOwcTG/VlxVDPz6ZZzUQ3BQa4yz9XEks9SGCVWiJvehmmTgOtLNeyfAKE0AoCxAN035ueogqCxKrqu4TpSSop54e8uU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=p3pAJ0kV; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="p3pAJ0kV" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=NxcOHm43DeJPslqKfTjnUgd1bI3ReiNefOYdj4l4oa8=; b=p3pAJ0kVloqZM8c7vfny/mILLt +cmybZzJZGIj+OpgfXXFZHZW2PRG4NDxlkDCE14mqyakO+/sJQUuTby/p221Nzg56j2f2CaqirxC+ 7g2gMvYvzxJHlBFVby4J4XGgF0XJKCZTlKzTY4SQ5WOSiLlXeTSCPK4myYreeDECgIQhjnlmMUslT hvakcGweMz/cmG2SMdzAK7QSQuMIdLml973szdmu15jXbT0LRlBB9xbe55FdAHbbu3zAPCLxzfpyB +IQ+qzt+EZQ7TYYqGHUIAnEoEIuCnaM6O8UGzBZfSeUXbkFaeX3bSmP7vACfYEWgLiA9FMJbePCmT 0C69gjgg==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqS-00000000lEj-2Yl0; Mon, 06 Jan 2025 09:56:25 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 04/15] xfs: move xfs_buf_iowait out of (__)xfs_buf_submit Date: Mon, 6 Jan 2025 10:54:41 +0100 Message-ID: <20250106095613.847700-5-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html There is no good reason to pass a bool argument to wait for a buffer when the callers that want that can easily just wait themselves. This means the wait moves out of the extra hold of the buffer, but as the callers of synchronous buffer I/O need to hold a reference anyway that is perfectly fine. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_buf.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 1927655fed13..a3484421a6d8 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -52,14 +52,8 @@ struct kmem_cache *xfs_buf_cache; * b_lock (trylock due to inversion) */ -static int __xfs_buf_submit(struct xfs_buf *bp, bool wait); - -static inline int -xfs_buf_submit( - struct xfs_buf *bp) -{ - return __xfs_buf_submit(bp, !(bp->b_flags & XBF_ASYNC)); -} +static int xfs_buf_submit(struct xfs_buf *bp); +static int xfs_buf_iowait(struct xfs_buf *bp); static inline bool xfs_buf_is_uncached(struct xfs_buf *bp) { @@ -797,13 +791,18 @@ _xfs_buf_read( struct xfs_buf *bp, xfs_buf_flags_t flags) { + int error; + ASSERT(!(flags & XBF_WRITE)); ASSERT(bp->b_maps[0].bm_bn != XFS_BUF_DADDR_NULL); bp->b_flags &= ~(XBF_WRITE | XBF_ASYNC | XBF_READ_AHEAD | XBF_DONE); bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD); - return xfs_buf_submit(bp); + error = xfs_buf_submit(bp); + if (!error && !(flags & XBF_ASYNC)) + error = xfs_buf_iowait(bp); + return error; } /* @@ -978,9 +977,10 @@ xfs_buf_read_uncached( bp->b_flags |= XBF_READ; bp->b_ops = ops; - xfs_buf_submit(bp); - if (bp->b_error) { - error = bp->b_error; + error = xfs_buf_submit(bp); + if (!error) + error = xfs_buf_iowait(bp); + if (error) { xfs_buf_relse(bp); return error; } @@ -1483,6 +1483,8 @@ xfs_bwrite( XBF_DONE); error = xfs_buf_submit(bp); + if (!error) + error = xfs_buf_iowait(bp); if (error) xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR); return error; @@ -1698,9 +1700,8 @@ xfs_buf_iowait( * holds an additional reference itself. */ static int -__xfs_buf_submit( - struct xfs_buf *bp, - bool wait) +xfs_buf_submit( + struct xfs_buf *bp) { int error = 0; @@ -1764,9 +1765,6 @@ __xfs_buf_submit( xfs_buf_ioend_async(bp); } - if (wait) - error = xfs_buf_iowait(bp); - /* * Release the hold that keeps the buffer referenced for the entire * I/O. Note that if the buffer is async, it is not safe to reference @@ -2322,7 +2320,7 @@ xfs_buf_delwri_submit_buffers( bp->b_flags |= XBF_ASYNC; xfs_buf_list_del(bp); } - __xfs_buf_submit(bp, false); + xfs_buf_submit(bp); } blk_finish_plug(&plug); From patchwork Mon Jan 6 09:54:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927118 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 A90131D90AD for ; Mon, 6 Jan 2025 09:56:28 +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=1736157390; cv=none; b=AGfzrr6PNWhayXY2KHdRlHRiElrrGmhsttiU3UcdEqIPk3ndCDWb/Dl1O+snd37Ig/BDtAUX+63fpr0JZXmV7YdNyWRR4EKHHAj7sbQPgeUXfDAoWRgi9Moown2NBbRw0Td7bYqBnVJm+bICq0opNlQlDh4r6B7lc2odP1Om8Qg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157390; c=relaxed/simple; bh=pSISvmmrMYjxEQWZXDTBxOFMF3hq5oq4hAdJNuA+Nn8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IcTA1+8V3QZFW/4XavxC0DoCJN0NErFIYbfTtsmNFR8hBFjKKK4PFHzh6kIdPgWWLLqnZSm1JxUuHrh7JU1vGXe/UvlADSQuO1hb78pIELxgiIHmgC+kYRuGfAfmyO9bwItQdhjpQx9asO4fhAJY4JRpbQ60gshZrE0xgXVrsSE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=P9FHtoSN; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="P9FHtoSN" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=e5iV/ZajpeKhTCgpCaXd28WRuvESmASZM0Ej4BSY7CU=; b=P9FHtoSNexBW3x26V9URFNo+Ke FldeZOALmvf0ucOKHlY4CP0YdHjJhLxF7HCYpDnfIkk0A6gBVazE1EDbT7YzKPOV2miczT1Lthemf m0CA1h3LRnJEvZnGXWu7sWleTvyEMSOlbSQitTI/tNe2BT51XRZURLC9mhqR75cEi8ZS4Zb7la4R6 zlifHqb5K3RzUnWOsuArf+rTLIoiOtDl31gZKKUEujc/0Z48AoZUR/9JnfiRHts1llQyeWk9nHnpI iASVrkTEV3ieFiUcEjaITydAaNnwrJs4sgOivQUAaXHxSFUYp5ZrokQ+tllBOAghthRCdcprAVQ0H EaaUEa8A==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqV-00000000lFt-43J4; Mon, 06 Jan 2025 09:56:28 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 05/15] xfs: simplify xfs_buf_delwri_pushbuf Date: Mon, 6 Jan 2025 10:54:42 +0100 Message-ID: <20250106095613.847700-6-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html xfs_buf_delwri_pushbuf synchronously writes a buffer that is on a delwri list already. Instead of doing a complicated dance with the delwri and wait list, just leave them alone and open code the actual buffer write. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_buf.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index a3484421a6d8..7edd7a1e9dae 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -2391,14 +2391,9 @@ xfs_buf_delwri_submit( * Push a single buffer on a delwri queue. * * The purpose of this function is to submit a single buffer of a delwri queue - * and return with the buffer still on the original queue. The waiting delwri - * buffer submission infrastructure guarantees transfer of the delwri queue - * buffer reference to a temporary wait list. We reuse this infrastructure to - * transfer the buffer back to the original queue. + * and return with the buffer still on the original queue. * - * Note the buffer transitions from the queued state, to the submitted and wait - * listed state and back to the queued state during this call. The buffer - * locking and queue management logic between _delwri_pushbuf() and + * The buffer locking and queue management logic between _delwri_pushbuf() and * _delwri_queue() guarantee that the buffer cannot be queued to another list * before returning. */ @@ -2407,33 +2402,21 @@ xfs_buf_delwri_pushbuf( struct xfs_buf *bp, struct list_head *buffer_list) { - LIST_HEAD (submit_list); int error; ASSERT(bp->b_flags & _XBF_DELWRI_Q); trace_xfs_buf_delwri_pushbuf(bp, _RET_IP_); - /* - * Isolate the buffer to a new local list so we can submit it for I/O - * independently from the rest of the original list. - */ xfs_buf_lock(bp); - list_move(&bp->b_list, &submit_list); - xfs_buf_unlock(bp); - - /* - * Delwri submission clears the DELWRI_Q buffer flag and returns with - * the buffer on the wait list with the original reference. Rather than - * bounce the buffer from a local wait list back to the original list - * after I/O completion, reuse the original list as the wait list. - */ - xfs_buf_delwri_submit_buffers(&submit_list, buffer_list); + bp->b_flags &= ~(_XBF_DELWRI_Q | XBF_ASYNC); + bp->b_flags |= XBF_WRITE; + xfs_buf_submit(bp); /* - * The buffer is now locked, under I/O and wait listed on the original - * delwri queue. Wait for I/O completion, restore the DELWRI_Q flag and - * return with the buffer unlocked and on the original queue. + * The buffer is now locked, under I/O but still on the original delwri + * queue. Wait for I/O completion, restore the DELWRI_Q flag and + * return with the buffer unlocked and still on the original queue. */ error = xfs_buf_iowait(bp); bp->b_flags |= _XBF_DELWRI_Q; From patchwork Mon Jan 6 09:54:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927119 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 DAA5BB676 for ; Mon, 6 Jan 2025 09:56:31 +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=1736157393; cv=none; b=jQ2i5xeURPBnVrvy7uXHeGGkSvR2wbcL5zpDoGurWpOCxy5KWLPLAMWEbLTY2GHbnRp6ivTbsVJw1XT3Z0Cb4wLD9FfxaTJQ1fLtnL58G+eXzJdFbFZTqNLlw5lOMHKd0vOoog/qq7IhJUv4YU4eG7TN7YmUHx4MZkDR/tTi7SA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157393; c=relaxed/simple; bh=e8MB3Ekuwho/BGqDUAFxnJQC4Nn8D4IrUbMB5dytcXw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MRi3eUErEiCLrrb2vEas9LIBC7G/1WrlNulOLnjd+cGaNeW91x0o76JueSP9XkAOQnUdSdXVxELDyATk9nJUCcjRVVFO8O3eRUNY5M2wdSh+/HEaQ4QSBnx5jsqNDJoug+TI0Ulv9OS/+5q1/NvniGyDWDdPA4g5r0XpFf5lGVY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=qa2HFcCl; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="qa2HFcCl" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=20So4vvC+UlzBtdqz3z/bQxln88Ekis9eSkTincRnY0=; b=qa2HFcClytA/30beEvOLlx9U3w q3gXPt/1yvOdjPtnsTqT1/yR9fjSuhkEe1N5SbfXRfK7M0J/S58DqkpCOmLnKNh4ONx70amQ5p67u xbdrbHRUMErZpWHgxOSM1Ns4444tRcM2WiUtxf6Frhh6UgMvW7A5Xwafhbko/KKeedDIqmT1iaWrx N97wiorvUb9E026lcYgd8giTM2TOVPWGKTliSpRem7/rIIswN4p3CUK2biWUU4UB32PlJje5V5Uhf Z1cP8PRhdYztMYP0whMzmoJnPvNYirtyou1WvN4v/zW2dKbDkvj8GoQo0EoDc6GYJY+uQWMoFTRGz hzaGXxRg==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqY-00000000lGv-41fw; Mon, 06 Jan 2025 09:56:31 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 06/15] xfs: remove xfs_buf_delwri_submit_buffers Date: Mon, 6 Jan 2025 10:54:43 +0100 Message-ID: <20250106095613.847700-7-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html xfs_buf_delwri_submit_buffers has two callers for synchronous and asynchronous writes that share very little logic. Split out a helper for the shared per-buffer loop and otherwise open code the submission in the two callers. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_buf.c | 121 +++++++++++++++++++++-------------------------- 1 file changed, 55 insertions(+), 66 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 7edd7a1e9dae..e48d796c786b 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -2259,72 +2259,26 @@ xfs_buf_cmp( return 0; } -/* - * Submit buffers for write. If wait_list is specified, the buffers are - * submitted using sync I/O and placed on the wait list such that the caller can - * iowait each buffer. Otherwise async I/O is used and the buffers are released - * at I/O completion time. In either case, buffers remain locked until I/O - * completes and the buffer is released from the queue. - */ -static int -xfs_buf_delwri_submit_buffers( - struct list_head *buffer_list, - struct list_head *wait_list) +static bool +xfs_buf_delwri_submit_prep( + struct xfs_buf *bp) { - struct xfs_buf *bp, *n; - int pinned = 0; - struct blk_plug plug; - - list_sort(NULL, buffer_list, xfs_buf_cmp); - - blk_start_plug(&plug); - list_for_each_entry_safe(bp, n, buffer_list, b_list) { - if (!wait_list) { - if (!xfs_buf_trylock(bp)) - continue; - if (xfs_buf_ispinned(bp)) { - xfs_buf_unlock(bp); - pinned++; - continue; - } - } else { - xfs_buf_lock(bp); - } - - /* - * Someone else might have written the buffer synchronously or - * marked it stale in the meantime. In that case only the - * _XBF_DELWRI_Q flag got cleared, and we have to drop the - * reference and remove it from the list here. - */ - if (!(bp->b_flags & _XBF_DELWRI_Q)) { - xfs_buf_list_del(bp); - xfs_buf_relse(bp); - continue; - } - - trace_xfs_buf_delwri_split(bp, _RET_IP_); - - /* - * If we have a wait list, each buffer (and associated delwri - * queue reference) transfers to it and is submitted - * synchronously. Otherwise, drop the buffer from the delwri - * queue and submit async. - */ - bp->b_flags &= ~_XBF_DELWRI_Q; - bp->b_flags |= XBF_WRITE; - if (wait_list) { - bp->b_flags &= ~XBF_ASYNC; - list_move_tail(&bp->b_list, wait_list); - } else { - bp->b_flags |= XBF_ASYNC; - xfs_buf_list_del(bp); - } - xfs_buf_submit(bp); + /* + * Someone else might have written the buffer synchronously or marked it + * stale in the meantime. In that case only the _XBF_DELWRI_Q flag got + * cleared, and we have to drop the reference and remove it from the + * list here. + */ + if (!(bp->b_flags & _XBF_DELWRI_Q)) { + xfs_buf_list_del(bp); + xfs_buf_relse(bp); + return false; } - blk_finish_plug(&plug); - return pinned; + trace_xfs_buf_delwri_split(bp, _RET_IP_); + bp->b_flags &= ~_XBF_DELWRI_Q; + bp->b_flags |= XBF_WRITE; + return true; } /* @@ -2347,7 +2301,30 @@ int xfs_buf_delwri_submit_nowait( struct list_head *buffer_list) { - return xfs_buf_delwri_submit_buffers(buffer_list, NULL); + struct xfs_buf *bp, *n; + int pinned = 0; + struct blk_plug plug; + + list_sort(NULL, buffer_list, xfs_buf_cmp); + + blk_start_plug(&plug); + list_for_each_entry_safe(bp, n, buffer_list, b_list) { + if (!xfs_buf_trylock(bp)) + continue; + if (xfs_buf_ispinned(bp)) { + xfs_buf_unlock(bp); + pinned++; + continue; + } + if (!xfs_buf_delwri_submit_prep(bp)) + continue; + bp->b_flags |= XBF_ASYNC; + xfs_buf_list_del(bp); + xfs_buf_submit(bp); + } + blk_finish_plug(&plug); + + return pinned; } /* @@ -2364,9 +2341,21 @@ xfs_buf_delwri_submit( { LIST_HEAD (wait_list); int error = 0, error2; - struct xfs_buf *bp; + struct xfs_buf *bp, *n; + struct blk_plug plug; - xfs_buf_delwri_submit_buffers(buffer_list, &wait_list); + list_sort(NULL, buffer_list, xfs_buf_cmp); + + blk_start_plug(&plug); + list_for_each_entry_safe(bp, n, buffer_list, b_list) { + xfs_buf_lock(bp); + if (!xfs_buf_delwri_submit_prep(bp)) + continue; + bp->b_flags &= ~XBF_ASYNC; + list_move_tail(&bp->b_list, &wait_list); + xfs_buf_submit(bp); + } + blk_finish_plug(&plug); /* Wait for IO to complete. */ while (!list_empty(&wait_list)) { From patchwork Mon Jan 6 09:54:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927120 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 09B9DB676 for ; Mon, 6 Jan 2025 09:56:34 +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=1736157396; cv=none; b=TqqW0ae/PiKk6pZXUzSdE6pYYldVz8eArXHBPH5FGwnBLhMymyYQcyDsnXAhbwnPAMYsObBuf68wDMT+D9QVgvWgcDoRNaQ9huTtTrlOq8c5wR9OfnmvoAdz8LZMl/cveo3Z59CExtf6pQBRfES9oSMnNXlE6etVj0AmV91+gew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157396; c=relaxed/simple; bh=EtxAFI+1lZcnuboGT9hbyldNbfqfKa3HmBiJTB5zWps=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tQBCILnHg56pmekb5BLJKKO4YfJLybnNGxfP+SQ4fO3D2ZMUJg8VVE0tzguUXybxVkSzJnMxjzWGX5UWLBM7wCBGNpMKnSxdl8Oxu6T1FiExOCVNV9NZjwMvQyP6/O+Cu2sO6lgVCqRHHbmTj0M5dLUoI07wg5CRDjfQoP6DqWI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=TTHAITmd; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="TTHAITmd" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=QpkF5rqe9qPrPHPx4phjTHqZ3WunJpMacmD170dG4NU=; b=TTHAITmdmWXdCZqdzpbdp7nbOs YSRpZaCixfC+PimSnm8EOIjkyT6g5RIQMm4V+K+NQRqmK6f3vNdU9AAsFxADYoX1mjOU1N5Q/9jid ce555RKRoUdc3XMT5MuCqzeyMWBgekrQFmYzvTlqxhN4tsG6cJWs0pez5igInv0oF7kGPE3BI9KuZ GZ/78ylthCRSxfuUov+aXGtrv9hWJajLQjQ9C1CeTbdsCz3grmKAmVza5CHch5MYqFNopVxe/ATKR hX0uZSrqq5sY68mc3SDDdDpTj7G4j7zv1ni+fMFJEOFNld7+WBwCfPfyFG0m31rzLIUjs4jRYP62L PJKZWzXQ==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqc-00000000lIS-0guk; Mon, 06 Jan 2025 09:56:34 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 07/15] xfs: move write verification out of _xfs_buf_ioapply Date: Mon, 6 Jan 2025 10:54:44 +0100 Message-ID: <20250106095613.847700-8-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Split the write verification logic out of _xfs_buf_ioapply into a new xfs_buf_verify_write helper called by xfs_buf_submit given that it isn't about applying the I/O and doesn't really fit in with the rest of _xfs_buf_ioapply. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_buf.c | 67 ++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index e48d796c786b..18e830c4e990 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1615,36 +1615,6 @@ _xfs_buf_ioapply( if (bp->b_flags & XBF_WRITE) { op = REQ_OP_WRITE; - - /* - * Run the write verifier callback function if it exists. If - * this function fails it will mark the buffer with an error and - * the IO should not be dispatched. - */ - if (bp->b_ops) { - bp->b_ops->verify_write(bp); - if (bp->b_error) { - xfs_force_shutdown(bp->b_mount, - SHUTDOWN_CORRUPT_INCORE); - return; - } - } else if (bp->b_rhash_key != XFS_BUF_DADDR_NULL) { - struct xfs_mount *mp = bp->b_mount; - - /* - * non-crc filesystems don't attach verifiers during - * log recovery, so don't warn for such filesystems. - */ - if (xfs_has_crc(mp)) { - xfs_warn(mp, - "%s: no buf ops on daddr 0x%llx len %d", - __func__, xfs_buf_daddr(bp), - bp->b_length); - xfs_hex_dump(bp->b_addr, - XFS_CORRUPTION_DUMP_LEN); - dump_stack(); - } - } } else { op = REQ_OP_READ; if (bp->b_flags & XBF_READ_AHEAD) @@ -1693,6 +1663,36 @@ xfs_buf_iowait( return bp->b_error; } +/* + * Run the write verifier callback function if it exists. If this fails, mark + * the buffer with an error and do not dispatch the I/O. + */ +static bool +xfs_buf_verify_write( + struct xfs_buf *bp) +{ + if (bp->b_ops) { + bp->b_ops->verify_write(bp); + if (bp->b_error) + return false; + } else if (bp->b_rhash_key != XFS_BUF_DADDR_NULL) { + /* + * Non-crc filesystems don't attach verifiers during log + * recovery, so don't warn for such filesystems. + */ + if (xfs_has_crc(bp->b_mount)) { + xfs_warn(bp->b_mount, + "%s: no buf ops on daddr 0x%llx len %d", + __func__, xfs_buf_daddr(bp), + bp->b_length); + xfs_hex_dump(bp->b_addr, XFS_CORRUPTION_DUMP_LEN); + dump_stack(); + } + } + + return true; +} + /* * Buffer I/O submission path, read or write. Asynchronous submission transfers * the buffer lock ownership and the current reference to the IO. It is not @@ -1751,8 +1751,15 @@ xfs_buf_submit( atomic_set(&bp->b_io_remaining, 1); if (bp->b_flags & XBF_ASYNC) xfs_buf_ioacct_inc(bp); + + if ((bp->b_flags & XBF_WRITE) && !xfs_buf_verify_write(bp)) { + xfs_force_shutdown(bp->b_mount, SHUTDOWN_CORRUPT_INCORE); + goto done; + } + _xfs_buf_ioapply(bp); +done: /* * If _xfs_buf_ioapply failed, we can get back here with only the IO * reference we took above. If we drop it to zero, run completion so From patchwork Mon Jan 6 09:54:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927121 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 EE08D4594D for ; Mon, 6 Jan 2025 09:56:37 +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=1736157399; cv=none; b=exVX1x7dogtrFg/WuDkZlsRB0gfvlDXVkHMJj89p/o2WQNKDuCu2ex4d/1owaB/rItgFu5/haAyL8gJbxyYeocm4URl4aynypRbac7NzwOZlSZXXHTh5CPzzppuiNFoKyaWlbHl9Ge901NWC/CekU7JBX8SG509PJyvcHiHWBSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157399; c=relaxed/simple; bh=L4Adl+c5Y9ARJGtsp2p89uBO8doua+fH834+ozFwGaQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZmcGApD5bROiJbwxMD0/+QCRc/9OzA4Xh/2vWQJ1ZXFPECpzHyWa3lPK/kWbNnJGaThahE1ni98j2MAyLMk5bPzNJ4z+qCxKTGIatZqBT8jpxz8UqKjCkidJJrP/407vKDb9TVKkQiovqvA+fl7OLkFVAv+2avXSQgd09kQaGd0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=iWlemlVb; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="iWlemlVb" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=9HNZgBF93fqEEMPunXRarlHYoqlYchaTuUhUqCTO/9M=; b=iWlemlVbRkd9LFiF+Njmii5lSd xoZV0b5qZ9JdXD62toDfbzB0OfsT4nfzN0LAxUE+Qb4WGqxEc57JBH/enlapZhSyN/nip3EFASTPy 5OVtn1piH+5CafwnXSJoNI3lNwCLnqHjyqpqx3Ii/bK7QKR046/C6w0RdqsqgGEhcNeTDR0oa8ArE H5cEBTJl5uteWOhQUsM3ixsFcJX8hYC0KZdLopaIYJmjwMsYErHUlo4gS+jOFVZQJdYb8mO1l1InA bOhiCKMHYwIXZikX7GYW6EEhGoGclgXm1colNXocYNFFFj4H1m7cjmZ9f4gOOzznLCfwJP8z4vH3t fCaVWg7Q==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqf-00000000lKg-0LUp; Mon, 06 Jan 2025 09:56:37 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 08/15] xfs: move in-memory buftarg handling out of _xfs_buf_ioapply Date: Mon, 6 Jan 2025 10:54:45 +0100 Message-ID: <20250106095613.847700-9-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html No I/O to apply for in-memory buffers, so skip the function call entirely. Clean up the b_io_error initialization logic to allow for this. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_buf.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 18e830c4e990..e886605b5721 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1607,12 +1607,6 @@ _xfs_buf_ioapply( int size; int i; - /* - * Make sure we capture only current IO errors rather than stale errors - * left over from previous use of the buffer (e.g. failed readahead). - */ - bp->b_error = 0; - if (bp->b_flags & XBF_WRITE) { op = REQ_OP_WRITE; } else { @@ -1624,10 +1618,6 @@ _xfs_buf_ioapply( /* we only use the buffer cache for meta-data */ op |= REQ_META; - /* in-memory targets are directly mapped, no IO required. */ - if (xfs_buftarg_is_mem(bp->b_target)) - return; - /* * Walk all the vectors issuing IO on them. Set up the initial offset * into the buffer and the desired IO size before we start - @@ -1740,7 +1730,11 @@ xfs_buf_submit( if (bp->b_flags & XBF_WRITE) xfs_buf_wait_unpin(bp); - /* clear the internal error state to avoid spurious errors */ + /* + * Make sure we capture only current IO errors rather than stale errors + * left over from previous use of the buffer (e.g. failed readahead). + */ + bp->b_error = 0; bp->b_io_error = 0; /* @@ -1757,6 +1751,10 @@ xfs_buf_submit( goto done; } + /* In-memory targets are directly mapped, no I/O required. */ + if (xfs_buftarg_is_mem(bp->b_target)) + goto done; + _xfs_buf_ioapply(bp); done: From patchwork Mon Jan 6 09:54:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927122 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 C55BA4594D for ; Mon, 6 Jan 2025 09:56:41 +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=1736157403; cv=none; b=niUFdfpjlpNt953r+9qM9m8P/9IWwbeFpK1eymy5n62Z2bsUUTocGhLePPmOFXIH9O6k5U14Rl12vlDr/JtJw0rymkpIv6StyK5BdZLQa6CdCEn0DQHYgWHnztM+kEzwGkpgYTZEx0OxGwa+4liZtQmdO8mQ4dsZGDDHRpHOWYk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157403; c=relaxed/simple; bh=Vrjne/xfuYkntIK+5cGcZ6qTQ/4bZBmurPBxiY8vHm0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sT8tIXoBgGAa6a0iEVF8X5XoYvqgURSpwemPzvedjtfY/IdSwXxRp5gumv9cAelE1ystsEDPfsPK58f6xzjn77zdEXfMeQKABEmsaLRJcvav3Z0bofKDIrqATWXHmZa09v3tVljKKZyrlKhMnreBSIAf3EKbSfIALi4Mln/oYBE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=IinCDbhh; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="IinCDbhh" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=qkjui50oQnn7XneLZAY8VkBT8WcFwEeA/5VsOwkmI8g=; b=IinCDbhhIuAz6pxaw7Ml05M7pE lcNIx7UlWR13KYpZXpv6q+IQkYCf/T6DiWw1I/7eLshmu/lo/zOsL1kMWMq2HTa+hBpsP9E7v9PC8 debafw/VErZhGJnf0+PMy3rsrwcYI3nZC07fxKke2s1jMJe0PyMkkfhQ6n8TY7R1k9b0cMyfNIBhl fRzXM8si8tEzT3rTMtP3Uyjmh0Pmvm8GFvuvez91qIwpd1kbCeo41+t+4uzFrXatu2OeXwXI0kZj8 2iy935UUWhfLN/EsIGLQsHnf569VSgodzyLkn9xbCqW6jzwbCj1cGsWGDMqwvxP79OKE/zBGW1nwS Y9RquDZg==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqi-00000000lLs-2si0; Mon, 06 Jan 2025 09:56:41 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 09/15] xfs: simplify buffer I/O submission Date: Mon, 6 Jan 2025 10:54:46 +0100 Message-ID: <20250106095613.847700-10-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The code in _xfs_buf_ioapply is unnecessarily complicated because it doesn't take advantage of modern bio features. Simplify it by making use of bio splitting and chaining, that is build a single bio for the pages in the buffer using a simple loop, and then split that bio on the map boundaries for discontiguous multi-FSB buffers and chain the split bios to the main one so that there is only a single I/O completion. This not only simplifies the code to build the buffer, but also removes the need for the b_io_remaining field as buffer ownership is granted to the bio on submit of the final bio with no chance for a completion before that as well as the b_io_error field that is now superfluous because there always is exactly one completion. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_buf.c | 207 ++++++++++++++--------------------------------- fs/xfs/xfs_buf.h | 2 - 2 files changed, 60 insertions(+), 149 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index e886605b5721..094f16457998 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1364,13 +1364,6 @@ xfs_buf_ioend( { trace_xfs_buf_iodone(bp, _RET_IP_); - /* - * Pull in IO completion errors now. We are guaranteed to be running - * single threaded, so we don't need the lock to read b_io_error. - */ - if (!bp->b_error && bp->b_io_error) - xfs_buf_ioerror(bp, bp->b_io_error); - if (bp->b_flags & XBF_READ) { if (!bp->b_error && bp->b_ops) bp->b_ops->verify_read(bp); @@ -1494,118 +1487,26 @@ static void xfs_buf_bio_end_io( struct bio *bio) { - struct xfs_buf *bp = (struct xfs_buf *)bio->bi_private; + struct xfs_buf *bp = bio->bi_private; - if (!bio->bi_status && - (bp->b_flags & XBF_WRITE) && (bp->b_flags & XBF_ASYNC) && - XFS_TEST_ERROR(false, bp->b_mount, XFS_ERRTAG_BUF_IOERROR)) - bio->bi_status = BLK_STS_IOERR; - - /* - * don't overwrite existing errors - otherwise we can lose errors on - * buffers that require multiple bios to complete. - */ - if (bio->bi_status) { - int error = blk_status_to_errno(bio->bi_status); - - cmpxchg(&bp->b_io_error, 0, error); - } + if (bio->bi_status) + xfs_buf_ioerror(bp, blk_status_to_errno(bio->bi_status)); + else if ((bp->b_flags & XBF_WRITE) && (bp->b_flags & XBF_ASYNC) && + XFS_TEST_ERROR(false, bp->b_mount, XFS_ERRTAG_BUF_IOERROR)) + xfs_buf_ioerror(bp, -EIO); if (!bp->b_error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ)) invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp)); - if (atomic_dec_and_test(&bp->b_io_remaining) == 1) - xfs_buf_ioend_async(bp); + xfs_buf_ioend_async(bp); bio_put(bio); } -static void -xfs_buf_ioapply_map( - struct xfs_buf *bp, - int map, - int *buf_offset, - int *count, - blk_opf_t op) -{ - int page_index; - unsigned int total_nr_pages = bp->b_page_count; - int nr_pages; - struct bio *bio; - sector_t sector = bp->b_maps[map].bm_bn; - int size; - int offset; - - /* skip the pages in the buffer before the start offset */ - page_index = 0; - offset = *buf_offset; - while (offset >= PAGE_SIZE) { - page_index++; - offset -= PAGE_SIZE; - } - - /* - * Limit the IO size to the length of the current vector, and update the - * remaining IO count for the next time around. - */ - size = min_t(int, BBTOB(bp->b_maps[map].bm_len), *count); - *count -= size; - *buf_offset += size; - -next_chunk: - atomic_inc(&bp->b_io_remaining); - nr_pages = bio_max_segs(total_nr_pages); - - bio = bio_alloc(bp->b_target->bt_bdev, nr_pages, op, GFP_NOIO); - bio->bi_iter.bi_sector = sector; - bio->bi_end_io = xfs_buf_bio_end_io; - bio->bi_private = bp; - - for (; size && nr_pages; nr_pages--, page_index++) { - int rbytes, nbytes = PAGE_SIZE - offset; - - if (nbytes > size) - nbytes = size; - - rbytes = bio_add_page(bio, bp->b_pages[page_index], nbytes, - offset); - if (rbytes < nbytes) - break; - - offset = 0; - sector += BTOBB(nbytes); - size -= nbytes; - total_nr_pages--; - } - - if (likely(bio->bi_iter.bi_size)) { - if (xfs_buf_is_vmapped(bp)) { - flush_kernel_vmap_range(bp->b_addr, - xfs_buf_vmap_len(bp)); - } - submit_bio(bio); - if (size) - goto next_chunk; - } else { - /* - * This is guaranteed not to be the last io reference count - * because the caller (xfs_buf_submit) holds a count itself. - */ - atomic_dec(&bp->b_io_remaining); - xfs_buf_ioerror(bp, -EIO); - bio_put(bio); - } - -} - -STATIC void -_xfs_buf_ioapply( - struct xfs_buf *bp) +static inline blk_opf_t +xfs_buf_bio_op( + struct xfs_buf *bp) { - struct blk_plug plug; - blk_opf_t op; - int offset; - int size; - int i; + blk_opf_t op; if (bp->b_flags & XBF_WRITE) { op = REQ_OP_WRITE; @@ -1615,25 +1516,52 @@ _xfs_buf_ioapply( op |= REQ_RAHEAD; } - /* we only use the buffer cache for meta-data */ - op |= REQ_META; + return op | REQ_META; +} + +static void +xfs_buf_submit_bio( + struct xfs_buf *bp) +{ + unsigned int size = BBTOB(bp->b_length); + unsigned int map = 0, p; + struct blk_plug plug; + struct bio *bio; + + bio = bio_alloc(bp->b_target->bt_bdev, bp->b_page_count, + xfs_buf_bio_op(bp), GFP_NOIO); + bio->bi_private = bp; + bio->bi_end_io = xfs_buf_bio_end_io; + + if (bp->b_flags & _XBF_KMEM) { + __bio_add_page(bio, virt_to_page(bp->b_addr), size, + bp->b_offset); + } else { + for (p = 0; p < bp->b_page_count; p++) + __bio_add_page(bio, bp->b_pages[p], PAGE_SIZE, 0); + bio->bi_iter.bi_size = size; /* limit to the actual size used */ + + if (xfs_buf_is_vmapped(bp)) + flush_kernel_vmap_range(bp->b_addr, + xfs_buf_vmap_len(bp)); + } /* - * Walk all the vectors issuing IO on them. Set up the initial offset - * into the buffer and the desired IO size before we start - - * _xfs_buf_ioapply_vec() will modify them appropriately for each - * subsequent call. + * If there is more than one map segment, split the original bio to + * submit a separate bio for each discontiguous range. */ - offset = bp->b_offset; - size = BBTOB(bp->b_length); blk_start_plug(&plug); - for (i = 0; i < bp->b_map_count; i++) { - xfs_buf_ioapply_map(bp, i, &offset, &size, op); - if (bp->b_error) - break; - if (size <= 0) - break; /* all done */ + for (map = 0; map < bp->b_map_count - 1; map++) { + struct bio *split; + + split = bio_split(bio, bp->b_maps[map].bm_len, GFP_NOFS, + &fs_bio_set); + split->bi_iter.bi_sector = bp->b_maps[map].bm_bn; + bio_chain(split, bio); + submit_bio(split); } + bio->bi_iter.bi_sector = bp->b_maps[map].bm_bn; + submit_bio(bio); blk_finish_plug(&plug); } @@ -1693,8 +1621,6 @@ static int xfs_buf_submit( struct xfs_buf *bp) { - int error = 0; - trace_xfs_buf_submit(bp, _RET_IP_); ASSERT(!(bp->b_flags & _XBF_DELWRI_Q)); @@ -1735,14 +1661,7 @@ xfs_buf_submit( * left over from previous use of the buffer (e.g. failed readahead). */ bp->b_error = 0; - bp->b_io_error = 0; - /* - * Set the count to 1 initially, this will stop an I/O completion - * callout which happens before we have started all the I/O from calling - * xfs_buf_ioend too early. - */ - atomic_set(&bp->b_io_remaining, 1); if (bp->b_flags & XBF_ASYNC) xfs_buf_ioacct_inc(bp); @@ -1755,28 +1674,22 @@ xfs_buf_submit( if (xfs_buftarg_is_mem(bp->b_target)) goto done; - _xfs_buf_ioapply(bp); + xfs_buf_submit_bio(bp); + goto rele; done: - /* - * If _xfs_buf_ioapply failed, we can get back here with only the IO - * reference we took above. If we drop it to zero, run completion so - * that we don't return to the caller with completion still pending. - */ - if (atomic_dec_and_test(&bp->b_io_remaining) == 1) { - if (bp->b_error || !(bp->b_flags & XBF_ASYNC)) - xfs_buf_ioend(bp); - else - xfs_buf_ioend_async(bp); - } - + if (bp->b_error || !(bp->b_flags & XBF_ASYNC)) + xfs_buf_ioend(bp); + else + xfs_buf_ioend_async(bp); +rele: /* * Release the hold that keeps the buffer referenced for the entire * I/O. Note that if the buffer is async, it is not safe to reference * after this release. */ xfs_buf_rele(bp); - return error; + return 0; } void * diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index da80399c7457..c53d27439ff2 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -184,7 +184,6 @@ struct xfs_buf { struct list_head b_lru; /* lru list */ spinlock_t b_lock; /* internal state lock */ unsigned int b_state; /* internal state flags */ - int b_io_error; /* internal IO error state */ wait_queue_head_t b_waiters; /* unpin waiters */ struct list_head b_list; struct xfs_perag *b_pag; @@ -202,7 +201,6 @@ struct xfs_buf { struct xfs_buf_map __b_map; /* inline compound buffer map */ int b_map_count; atomic_t b_pin_count; /* pin count */ - atomic_t b_io_remaining; /* #outstanding I/O requests */ unsigned int b_page_count; /* size of page array */ unsigned int b_offset; /* page offset of b_addr, only for _XBF_KMEM buffers */ From patchwork Mon Jan 6 09:54:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927123 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 C64134594D for ; Mon, 6 Jan 2025 09:56:44 +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=1736157406; cv=none; b=e5TJJtUlmbDi1qisLu94256s8njXeSaeyb7hMTzfM/fHB3Ts3MQ7cU5zln0gzLDUhFd2ZOtm8im67MrYws4unectyjiu5XT4T+ZA2p6mXiatqqsAHrTSwNQC/XMnU9eqDNBZXvFoChvf1VjinKaU1FUqOHwieBEPS0yHBI+Fb74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157406; c=relaxed/simple; bh=abon8vPzKzheEXdvXgXsxMNWmtyjF4Eeno45nWAb1/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Oqwq4iR61iurX1QwJyAufT7V8gv+fZwzcN1LhQ75wMsXCB7Hx25MlbYF85DRni60hCt/m4gQioqYHRiFepczjXQn+8MEEz2nJ26vFn2/uUj7mbASUfQXs4Q0wmwgNpSxzPA3E+GQaYW74MPkd3fBL9nw+sORvpnmLgsw4snsS+I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=HCbZwL+P; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="HCbZwL+P" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=h3yVqAxtjtK2tPwvFlRTko0HmU09NHPhGY/oZeHk5Gw=; b=HCbZwL+PVHaPy3Cq/1gMpPPJKH KjV92X6cm/Vh6HHNvNLuKbz0qf7Vso+AbRdrYsHqGPsvGD7wazhVFZSBZcJLnghAAR4fFqwCJOg2T AXOW54H+BswD1my6bxhvuOf4RLn7CikPIEvEwJIW0D2hnu8wXV9LaKGzR2266NOTr3NHv+qEKVCG+ qlxCAwrgSQX7PjZli6M4l4DjAUaEVufoLB2biDAJXv8O9x7QpE6S6t20WNjZ8JoK4s0TAxKmIZkRh 9dIoD6MTSaEEpNP75hRpRpKuWVkpH46qtCbUVbnL+DVpHIonM/G/hW/ZIwwpeYCaD0qdBdtM+2s1u uiIFJDfw==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqm-00000000lMc-0rNL; Mon, 06 Jan 2025 09:56:44 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 10/15] xfs: move invalidate_kernel_vmap_range to xfs_buf_ioend Date: Mon, 6 Jan 2025 10:54:47 +0100 Message-ID: <20250106095613.847700-11-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Invalidating cache lines can be fairly expensive, so don't do it in interrupt context. Note that in practice very few setup will actually do anything here as virtually indexed caches are rather uncommon, but we might as well move the call to the proper place while touching this area. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_buf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 094f16457998..49df4adf0e98 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1365,6 +1365,9 @@ xfs_buf_ioend( trace_xfs_buf_iodone(bp, _RET_IP_); if (bp->b_flags & XBF_READ) { + if (!bp->b_error && xfs_buf_is_vmapped(bp)) + invalidate_kernel_vmap_range(bp->b_addr, + xfs_buf_vmap_len(bp)); if (!bp->b_error && bp->b_ops) bp->b_ops->verify_read(bp); if (!bp->b_error) @@ -1495,9 +1498,6 @@ xfs_buf_bio_end_io( XFS_TEST_ERROR(false, bp->b_mount, XFS_ERRTAG_BUF_IOERROR)) xfs_buf_ioerror(bp, -EIO); - if (!bp->b_error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ)) - invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp)); - xfs_buf_ioend_async(bp); bio_put(bio); } From patchwork Mon Jan 6 09:54:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927124 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 2D0C84594D for ; Mon, 6 Jan 2025 09:56:47 +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=1736157408; cv=none; b=CasqeW3z2/actajmF3pcdQiq/at/jdGxKMwAcnNQLEw53NdMzDiPCxO1Ro4Bq1O1mKDOuiUjcJm9HArI//m3STNx62LplCBsNF5d167VTQWWwufR/0yYmT87XiEjrFkUfI7kcWd0oeyQWzzb5n4al86lX76fB8pcI6Tb/nwl578= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157408; c=relaxed/simple; bh=FEEHMimxb8AV8sC3khElLhJfSqHnHL60MlY0KF0BzgU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R7jQ4n5CsoCGELAV131tyhY1iNNggKl7A+1dnU+syuK72NscIYocfzVOUOH93ZNouwI348FUZtLfgaqfcLShiPFmNqa0OZfEDxeMH711hmD4tqYknJoMrqPjgFwWZNz+9R1cI+sl1D+oWKH7IVPMFQOITTclkSZfXiW8/+Y1qvg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=d6mDcVFy; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="d6mDcVFy" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=vqLno5ZLNrf8Go2XWxDI+JsaOXtCFHVsDtWDXcEBU+I=; b=d6mDcVFyXDp5i72Sn/6P2kdko3 vlUPPvN0vyVN/7UQtz+nd4b3wBLzG3rPcg0cg4WJkCiI0r94hT9/pQWD0wEAvebxiTq8W3KYmIuDQ R9HPrGWQlKHBz3jIl14D+ZfJRcKpmJwUOU0H+g0AdcKVzcZiU5ZCiaMXQGAffNjLHaJlzyi9IgBNC FmUBsLATDBWaOMajfvhzEwf5b6VmqLt3sY8l1HIhgns2WA/F+yk4/NG4gidQm8Yzfhhv5pMMA2JJ1 5dxxyWZYBOHyR5j6E7xAunXY7nOxxc+Iuk3HXlzJLavqAWuZU8Bt+bAkhIhWGtKdyvO+ZToRoGwIB HOAAA2Gw==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqo-00000000lMz-2KSj; Mon, 06 Jan 2025 09:56:46 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 11/15] xfs: remove the extra buffer reference in xfs_buf_submit Date: Mon, 6 Jan 2025 10:54:48 +0100 Message-ID: <20250106095613.847700-12-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Nothing touches the buffer after it has been submitted now, so the need for the extra transient reference went away as well. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_buf.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 49df4adf0e98..352cc50aeea5 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1646,13 +1646,6 @@ xfs_buf_submit( return -EIO; } - /* - * Grab a reference so the buffer does not go away underneath us. For - * async buffers, I/O completion drops the callers reference, which - * could occur before submission returns. - */ - xfs_buf_hold(bp); - if (bp->b_flags & XBF_WRITE) xfs_buf_wait_unpin(bp); @@ -1675,20 +1668,12 @@ xfs_buf_submit( goto done; xfs_buf_submit_bio(bp); - goto rele; - + return 0; done: if (bp->b_error || !(bp->b_flags & XBF_ASYNC)) xfs_buf_ioend(bp); else xfs_buf_ioend_async(bp); -rele: - /* - * Release the hold that keeps the buffer referenced for the entire - * I/O. Note that if the buffer is async, it is not safe to reference - * after this release. - */ - xfs_buf_rele(bp); return 0; } From patchwork Mon Jan 6 09:54:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927125 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 3618E4594D for ; Mon, 6 Jan 2025 09:56:50 +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=1736157411; cv=none; b=CnWUbQPm2lAROo5spxA8snDJ3HwZz/lEB34hFphMT+UMwWJy/xmeFlyO1prQGOJvhcuAipdTAOKRB4agGIwWfHqRcHZb1pJFwpf9NJhLnW5pP8jL+QJ7u6/vbZCmmo6yT+PHZd685Y24Iq3Rwl0hSvYrj31dETZw+4i41twr5Lg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157411; c=relaxed/simple; bh=anJEo2bbTF+THuR0i3EULj6MNyoXknXcW4hwEWz49hI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZSV5pRYm0akoCACuC31T/zmvkBlCz5WJxgEPoJPndhWu939F5X8N/vu+D0recOVa6M6hywgqF/IrdYOGMzSwzKJpRf3/LRCh60dV8Fsy35HMMlNHN2LaqDw3C1qruXEas6rCI9xEwQIOQAYeJyW1KbhYl89BzkeXNRDIZo+q4JM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=2G65lnZt; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="2G65lnZt" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=bqZ06RYMmMkz1k2bsy+DSpuOZWoTKYfDkLEhoOE0lo0=; b=2G65lnZtsbqvbaE4A+r9l4UDgD 6MV1MUsthtK8NIqALoa6oKOneztywLgfjXhNw+b98LxFr9slul9MjoDL5tH6jT8Ob/DYVZ50kmVA1 HvAyXcPXvemyproO5zNE3XHTc51/qbx2x7B+Se8NpTmaYfkTg+tfSA+ftob75CNW/lwK8TdTeYVVA qGQHCbGZQ70Nm9CJbZ2R0/KXYoyXQVrGfIh4JcJdTG9ZckCgywmd7Y9hJOUrbc7G5g43H4edHPhdx DGTNHKOG7E4rDn0TDB6O7wp23qH61owDcQ/x6Uyr9wi6m0PeL2cQy1t3WkQoPG0k4U4nVbTleRLTd gItdktHQ==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqr-00000000lNo-0mRc; Mon, 06 Jan 2025 09:56:49 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 12/15] xfs: always complete the buffer inline in xfs_buf_submit Date: Mon, 6 Jan 2025 10:54:49 +0100 Message-ID: <20250106095613.847700-13-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html xfs_buf_submit now only completes a buffer on error, or for in-memory buftargs. There is no point in using a workqueue for the latter as the completion will just wake up the caller. Optimize this case by avoiding the workqueue roundtrip. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_buf.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 352cc50aeea5..0ad3cacfdba1 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1670,10 +1670,7 @@ xfs_buf_submit( xfs_buf_submit_bio(bp); return 0; done: - if (bp->b_error || !(bp->b_flags & XBF_ASYNC)) - xfs_buf_ioend(bp); - else - xfs_buf_ioend_async(bp); + xfs_buf_ioend(bp); return 0; } From patchwork Mon Jan 6 09:54:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927126 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 2DC9F4594D for ; Mon, 6 Jan 2025 09:56:54 +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=1736157415; cv=none; b=DHUzmXqS6q3dbrI90C+/fo5qHfBfnHu5Rh273uJmugrLIzSss8qVFM06hnk9xNg7QPyYvJEMseP1tRXLwhY3Qqqq5x1NoZBUz9nQ+BvP1ubUYgnKjiHtkmb0VHToTMoVMbyauLM7hKkNBObivrV0/nFf6qvJT1KNlVBUO8S8A+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157415; c=relaxed/simple; bh=HNqqVAOJDpD2rNFxmFhcf2eiAOpeqVT25dhCv9fqTz0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nSUJSpxemaoWHcAYhf0ZVKt/TY33FbqjTykv8N2ezuM/LeHu4uivf6CPsakSs5KL0+dUXFNc8R+L2jz8IPch1s3BTv9WFnmlr9mGQObqM3TTP3PLxzkgOPGEW2DnhvsgCTsOHiVwt703nwf5dpRLFKGc9YF2TceP3f9MQPevGuo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=1CztRdou; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="1CztRdou" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=wyhqwI8M8vuuOiJXuhEVTKQ41hEKUamNsR29jawexw0=; b=1CztRdouSIrknirmJ9e/mCLXRb rmmnA/xvfH6Vetske2elJmCPO98PZYyejbh/rJylXK70OdnTKYWqk5P9N+LbW5s0Da9LE1YXx/ekC PhMdhHjJiJd7yooM76Qwvy/15MH5f0e3ymPM6DMS0tOFy3IbnwIMTOh65l1JDw1KDO29sl2yApMw6 gDHae35AhoU65QWcDJrPZs1ZkFyF/viMJ+q67fVYDnrJ8vYeCIQ9sYtLUWi5mY4UHk5PAr0h23eBA h6NF2KmFsSRmxYo3+m1m3PNtxVS29QmemwZrpf7HVVp0nRioGxhKK58GjO6hnxUhuxS0CRMKlM2xp fmAz4OGQ==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqv-00000000lOB-1BVi; Mon, 06 Jan 2025 09:56:53 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 13/15] xfs: simplify xfsaild_resubmit_item Date: Mon, 6 Jan 2025 10:54:50 +0100 Message-ID: <20250106095613.847700-14-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Since commit acc8f8628c37 ("xfs: attach dquot buffer to dquot log item buffer") all buf items that use bp->b_li_list are explicitly checked for in the branch to just clears XFS_LI_FAILED. Remove the dead arm that calls xfs_clear_li_failed. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_trans_ail.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index f56d62dced97..0fcb1828e598 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c @@ -359,13 +359,8 @@ xfsaild_resubmit_item( } /* protected by ail_lock */ - list_for_each_entry(lip, &bp->b_li_list, li_bio_list) { - if (bp->b_flags & (_XBF_INODES | _XBF_DQUOTS)) - clear_bit(XFS_LI_FAILED, &lip->li_flags); - else - xfs_clear_li_failed(lip); - } - + list_for_each_entry(lip, &bp->b_li_list, li_bio_list) + clear_bit(XFS_LI_FAILED, &lip->li_flags); xfs_buf_unlock(bp); return XFS_ITEM_SUCCESS; } From patchwork Mon Jan 6 09:54:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927127 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 55AD4159596 for ; Mon, 6 Jan 2025 09:56:58 +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=1736157419; cv=none; b=mJSoXT/OpqIPtmOyhHkCZSJr7lLDgp+s0TSdqCrMJhyzjBMkcPtDrpX0/Ys7rOz7WzVERnsB5HObCLBpmg7JlMeFj6Dhz2sg5yQ4DOZEYj/gAisb671+xwum/e6o47ATUVO529XWHPZ7iJkxtAOx5M08d9qTL6v1Mulp8tvOWLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157419; c=relaxed/simple; bh=w/mqqOWAGHV9xRqAglEtr4ly1s4dq2a8CK+8hXozWqs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G4qs+XR7ZPCFPq5AOKrfpaWGCqArIguEFyROMK4NsGEoKVIRM5dsjfj9qmFQWWybfN7V/SBE/CnD1W0qv/6tsPka3EzgoS35aKSy0UN6mDJ4tqam8tAX/MWMj7uzcrSp7B3zbCl9/VWBwjGNF5twe60IVUIPAMMVM0cueDIEtXA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=1E4LBJAI; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="1E4LBJAI" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=aTuw2t8c7t095/pOOAwwG1lLQYmCsj1zyLUFJX1OmeY=; b=1E4LBJAIR80kEa1TAUQIddplrt LY6n+ghPpUWbkqVRIG/4/yiskQ21vE0PfvAxPz4fLs5LyeaWwPuT9CyMc8aljkNYdNu1gEjWILznD KVqJKi+ge9lN4cnNWMg1ip+cGb8WinNUN4yYzYay2l40ioQ4jcYeh0CLBQxF0gJi3iB8ThWGdPMOG 4RuqlZGdsmPuhyrUrHalmecTCg1ufYaW32B/TEXIyRL1lz43oHmTlV1t1pE30z+0pVNdB37C1Ew5g +Q2uzrNNmy1beSzNj1KQu7aO2o/+2VOOxo9Knkk9GXo74DJZOLb6gwJ7SJMaizsz6jilS1tg0VdQp Ekn3qW/Q==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjqz-00000000lPf-1aZI; Mon, 06 Jan 2025 09:56:58 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 14/15] xfs: move b_li_list based retry handling to common code Date: Mon, 6 Jan 2025 10:54:51 +0100 Message-ID: <20250106095613.847700-15-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The dquot and inode version are very similar, which is expected given the overall b_li_list logic. The differences are that the inode version also clears the XFS_LI_FLUSHING which is defined in common but only ever set by the inode item, and that the dquot version takes the ail_lock over the list iteration. While this seems sensible given that additions and removals from b_li_list are protected by the ail_lock, log items are only added before buffer submission, and are only removed when completing the buffer, so nothing can change the list when retrying a buffer. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_buf.c | 12 ++++++------ fs/xfs/xfs_buf_item.h | 5 ----- fs/xfs/xfs_dquot.c | 12 ------------ fs/xfs/xfs_inode_item.c | 12 ------------ 4 files changed, 6 insertions(+), 35 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 0ad3cacfdba1..1cf5d14d0d06 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1288,6 +1288,7 @@ xfs_buf_ioend_handle_error( { struct xfs_mount *mp = bp->b_mount; struct xfs_error_cfg *cfg; + struct xfs_log_item *lip; /* * If we've already shutdown the journal because of I/O errors, there's @@ -1335,12 +1336,11 @@ xfs_buf_ioend_handle_error( } /* Still considered a transient error. Caller will schedule retries. */ - if (bp->b_flags & _XBF_INODES) - xfs_buf_inode_io_fail(bp); - else if (bp->b_flags & _XBF_DQUOTS) - xfs_buf_dquot_io_fail(bp); - else - ASSERT(list_empty(&bp->b_li_list)); + list_for_each_entry(lip, &bp->b_li_list, li_bio_list) { + set_bit(XFS_LI_FAILED, &lip->li_flags); + clear_bit(XFS_LI_FLUSHING, &lip->li_flags); + } + xfs_buf_ioerror(bp, 0); xfs_buf_relse(bp); return true; diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h index 4d8a6aece995..8cde85259a58 100644 --- a/fs/xfs/xfs_buf_item.h +++ b/fs/xfs/xfs_buf_item.h @@ -54,17 +54,12 @@ bool xfs_buf_item_put(struct xfs_buf_log_item *); void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint); bool xfs_buf_item_dirty_format(struct xfs_buf_log_item *); void xfs_buf_inode_iodone(struct xfs_buf *); -void xfs_buf_inode_io_fail(struct xfs_buf *bp); #ifdef CONFIG_XFS_QUOTA void xfs_buf_dquot_iodone(struct xfs_buf *); -void xfs_buf_dquot_io_fail(struct xfs_buf *bp); #else static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp) { } -static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp) -{ -} #endif /* CONFIG_XFS_QUOTA */ void xfs_buf_iodone(struct xfs_buf *); bool xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec); diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index f11d475898f2..78dde811ab16 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c @@ -1229,18 +1229,6 @@ xfs_buf_dquot_iodone( } } -void -xfs_buf_dquot_io_fail( - struct xfs_buf *bp) -{ - struct xfs_log_item *lip; - - spin_lock(&bp->b_mount->m_ail->ail_lock); - list_for_each_entry(lip, &bp->b_li_list, li_bio_list) - set_bit(XFS_LI_FAILED, &lip->li_flags); - spin_unlock(&bp->b_mount->m_ail->ail_lock); -} - /* Check incore dquot for errors before we flush. */ static xfs_failaddr_t xfs_qm_dqflush_check( diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 912f0b1bc3cb..4fb2e1a6ad26 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c @@ -1023,18 +1023,6 @@ xfs_buf_inode_iodone( list_splice_tail(&flushed_inodes, &bp->b_li_list); } -void -xfs_buf_inode_io_fail( - struct xfs_buf *bp) -{ - struct xfs_log_item *lip; - - list_for_each_entry(lip, &bp->b_li_list, li_bio_list) { - set_bit(XFS_LI_FAILED, &lip->li_flags); - clear_bit(XFS_LI_FLUSHING, &lip->li_flags); - } -} - /* * Clear the inode logging fields so no more flushes are attempted. If we are * on a buffer list, it is now safe to remove it because the buffer is From patchwork Mon Jan 6 09:54:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13927128 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 D27074594D for ; Mon, 6 Jan 2025 09:57:00 +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=1736157422; cv=none; b=pMt4F0y3DuR6NA1KKTDM7nC+YU53qCVhErW+NIFJnLO3U1HU1yyNxTu3YIxkuDWECZY4Qzvj/As295b0TJ9sOo4W2oauJFQpLw36X/wHe6fezUs/KKHEp3R7sgjAYcrioFBisCJqxx/5y54VSSJxZiIjqo0EsRFC1qdaVEFg1vM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736157422; c=relaxed/simple; bh=IIex3JbEb/hG0sBYBp7IHV2S/bQ52lGsx3i0Lm4ytvI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rPZwAMsqTBHdo/csQKGKWV7R7ovbjGxewghlYkzxo3Qz7e8aXxM07FP/mukbPqoSAIxCFBG3yUXgCVcBbF9Nx+B7uH4Jbw/KwnlrGmDTUpi2xKj9RhaOy4BJ/nllGbB6rsgw3Pi1jvDJ9Wv51ARC2mWEP/wJX15ipqav9o1rUb0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=qhVX2aD2; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="qhVX2aD2" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=p5DVMtgGiz7fQGLbiuNJiorpzRogjT8m6kM57gq7ueU=; b=qhVX2aD2dmg0Pam2dHEgnUQhuz 81jav5KKV9YTZesqP4ag6tMIwN/vN7BzgP9a62zkBpMbo+hvdI8LUaWoCFPS6k/8rfwCAThgyGpSe oGaJhwj/7n9K2rl8NB58yWTuPQ9Mj2rkk99TwpFrwcAuMroVhVQZBg3G1C9dxabv2d+EgkHIoVhbv WHa/d0+K8AbrxIBq3bwinIeh8SV7a1gezSZlrx0+qxcwh3mVKcO81hfIfAenMm/V52Fxg0l99Izpz Q1Zif3Jtr552or/hEUu8nuGFnPGbg6hCBcZEOgae9U/bQ2knuffL8rRtuiqo9wRUaTK87+PP9e9TE SBNPxImQ==; Received: from 2a02-8389-2341-5b80-db6b-99e8-3feb-3b4e.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:db6b:99e8:3feb:3b4e] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tUjr2-00000000lQ4-14xP; Mon, 06 Jan 2025 09:57:00 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 15/15] xfs: add a b_iodone callback to struct xfs_buf Date: Mon, 6 Jan 2025 10:54:52 +0100 Message-ID: <20250106095613.847700-16-hch@lst.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106095613.847700-1-hch@lst.de> References: <20250106095613.847700-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Stop open coding the log item completions and instead add a callback into back into the submitter. Signed-off-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/xfs/xfs_buf.c | 7 ++----- fs/xfs/xfs_buf.h | 5 +---- fs/xfs/xfs_dquot.c | 2 +- fs/xfs/xfs_inode_item.c | 2 +- fs/xfs/xfs_trans_buf.c | 8 ++++---- 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 1cf5d14d0d06..68a5148115e5 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1394,11 +1394,8 @@ xfs_buf_ioend( if (bp->b_log_item) xfs_buf_item_done(bp); - if (bp->b_flags & _XBF_INODES) - xfs_buf_inode_iodone(bp); - else if (bp->b_flags & _XBF_DQUOTS) - xfs_buf_dquot_iodone(bp); - + if (bp->b_iodone) + bp->b_iodone(bp); } bp->b_flags &= ~(XBF_READ | XBF_WRITE | XBF_READ_AHEAD | diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index c53d27439ff2..10bf66e074a0 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -34,8 +34,6 @@ struct xfs_buf; #define XBF_WRITE_FAIL (1u << 7) /* async writes have failed on this buffer */ /* buffer type flags for write callbacks */ -#define _XBF_INODES (1u << 16)/* inode buffer */ -#define _XBF_DQUOTS (1u << 17)/* dquot buffer */ #define _XBF_LOGRECOVERY (1u << 18)/* log recovery buffer */ /* flags used only internally */ @@ -65,8 +63,6 @@ typedef unsigned int xfs_buf_flags_t; { XBF_DONE, "DONE" }, \ { XBF_STALE, "STALE" }, \ { XBF_WRITE_FAIL, "WRITE_FAIL" }, \ - { _XBF_INODES, "INODES" }, \ - { _XBF_DQUOTS, "DQUOTS" }, \ { _XBF_LOGRECOVERY, "LOG_RECOVERY" }, \ { _XBF_PAGES, "PAGES" }, \ { _XBF_KMEM, "KMEM" }, \ @@ -205,6 +201,7 @@ struct xfs_buf { unsigned int b_offset; /* page offset of b_addr, only for _XBF_KMEM buffers */ int b_error; /* error code on I/O */ + void (*b_iodone)(struct xfs_buf *bp); /* * async write failure retry count. Initialised to zero on the first diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 78dde811ab16..e0a379729674 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c @@ -1446,7 +1446,7 @@ xfs_qm_dqflush( * Attach the dquot to the buffer so that we can remove this dquot from * the AIL and release the flush lock once the dquot is synced to disk. */ - bp->b_flags |= _XBF_DQUOTS; + bp->b_iodone = xfs_buf_dquot_iodone; list_add_tail(&lip->li_bio_list, &bp->b_li_list); /* diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 4fb2e1a6ad26..e0990a8c4007 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c @@ -185,7 +185,7 @@ xfs_inode_item_precommit( xfs_buf_hold(bp); spin_lock(&iip->ili_lock); iip->ili_item.li_buf = bp; - bp->b_flags |= _XBF_INODES; + bp->b_iodone = xfs_buf_inode_iodone; list_add_tail(&iip->ili_item.li_bio_list, &bp->b_li_list); xfs_trans_brelse(tp, bp); } diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c index 8e886ecfd69a..53af546c0b23 100644 --- a/fs/xfs/xfs_trans_buf.c +++ b/fs/xfs/xfs_trans_buf.c @@ -659,7 +659,7 @@ xfs_trans_inode_buf( ASSERT(atomic_read(&bip->bli_refcount) > 0); bip->bli_flags |= XFS_BLI_INODE_BUF; - bp->b_flags |= _XBF_INODES; + bp->b_iodone = xfs_buf_inode_iodone; xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DINO_BUF); } @@ -684,7 +684,7 @@ xfs_trans_stale_inode_buf( ASSERT(atomic_read(&bip->bli_refcount) > 0); bip->bli_flags |= XFS_BLI_STALE_INODE; - bp->b_flags |= _XBF_INODES; + bp->b_iodone = xfs_buf_inode_iodone; xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DINO_BUF); } @@ -709,7 +709,7 @@ xfs_trans_inode_alloc_buf( ASSERT(atomic_read(&bip->bli_refcount) > 0); bip->bli_flags |= XFS_BLI_INODE_ALLOC_BUF; - bp->b_flags |= _XBF_INODES; + bp->b_iodone = xfs_buf_inode_iodone; xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DINO_BUF); } @@ -820,6 +820,6 @@ xfs_trans_dquot_buf( break; } - bp->b_flags |= _XBF_DQUOTS; + bp->b_iodone = xfs_buf_dquot_iodone; xfs_trans_buf_set_type(tp, bp, type); }