From patchwork Thu Oct 31 23:23:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13858484 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44E9A19CC1D for ; Thu, 31 Oct 2024 23:23:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417029; cv=none; b=toPEHA86YiJkUL/xMar65m0MTVPWmqLPXmgGrUDmhQodXfjmhMzZEe2rYwvx08m+NrSNzvwe5G0lVZh5Iq8PsMsbwRqsAm1VJmWBR9OOHjh7uGKVOpMOFH8XMcvHcTLWN2WbbdKVt186M2ionfgWFy4sVpW+t050LmO+8MoZtgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417029; c=relaxed/simple; bh=idrqojhoP60nDOAyoYJpaUDyEzoQaF0oO5p8QFUOKeI=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K7KEfa5ZeV02kZ33QYK641YeMiOUwSM6Yw6i1DiON5qbIKXAVy1pIGFd1r34nVMXLAOkgi1eOfcf2uqEzlf48DDZ8DjY3e7K56qgZ62EkT2obw6YMbzT+SRcpNsupxiBr2n03gNr5X1tdZcq9xxifXO+i6usvfcZwk/XPPpMNxw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PLujU/hT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PLujU/hT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4A8CC4CEC3; Thu, 31 Oct 2024 23:23:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730417028; bh=idrqojhoP60nDOAyoYJpaUDyEzoQaF0oO5p8QFUOKeI=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=PLujU/hT3KdWOiKdrAlbF9/1xjS0mR8EtSuYU+7wS5Zsvlp8zIdp0cUTk2jPAJnKg 2oyTYT1Ooerob3H7XAYtFAaqEuWVGQcJlfl/agXWXeYYcyatyOc50N8j1yE118x/HC Pl4cM06KsJcm/lyeA6e/xtrHsD+TaypazQ6hoNagCW30McP2unb58YlH9ai0o63+7T zD3sucRstM/Xoj/TZrcv2tjcUAMOzzCnc8hgjEEm1wqB0+SX5QstzkNwB9JJRIpBrG xgyF4acvpyv/1aYMqDRFOkxsAOLd5I1IpE0oVb8lYBubJJ1qJWqunbltw66SFuK1jL 8ufwpCfCQHHow== Date: Thu, 31 Oct 2024 16:23:48 -0700 Subject: [PATCH 1/6] xfs_repair: checking rt free space metadata must happen during phase 4 From: "Darrick J. Wong" To: djwong@kernel.org, aalbersh@kernel.org Cc: linux-xfs@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173041568118.964620.7418836022913791251.stgit@frogsfrogsfrogs> In-Reply-To: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> References: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Back in the really old days, xfs_repair would generate the new free space information for the realtime section during phase 5, and write the contents to the rtbitmap and summary files during phase 6. This was ok because the incore information isn't used until phase 6. Then I changed the behavior to check the generated information against what was on disk and complain about the discrepancies. Unfortunately, there was a subtle flaw here -- for a non -n run, we'll have regenerated the AG metadata before we actually check the rt free space information. If the AG btree regeneration should clobber one of the old rtbitmap or summary blocks, this will be reported as a corruption even though nothing's wrong. Move check_rtmetadata to the end of phase 4 so that this doesn't happen. Cc: # v5.19.0 Fixes: f2e388616d7491 ("xfs_repair: check free rt extent count") Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- repair/phase4.c | 7 +++++++ repair/phase5.c | 6 ------ repair/xfs_repair.c | 3 --- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/repair/phase4.c b/repair/phase4.c index 5e5d8c3c7d9b96..071f20ed736e4b 100644 --- a/repair/phase4.c +++ b/repair/phase4.c @@ -401,4 +401,11 @@ phase4(xfs_mount_t *mp) */ quotino_check(mp); quota_sb_check(mp); + + /* Check the rt metadata before we rebuild */ + if (mp->m_sb.sb_rblocks) { + do_log( + _(" - generate realtime summary info and bitmap...\n")); + check_rtmetadata(mp); + } } diff --git a/repair/phase5.c b/repair/phase5.c index d18ec095b0524b..9207da7172c05b 100644 --- a/repair/phase5.c +++ b/repair/phase5.c @@ -694,12 +694,6 @@ phase5(xfs_mount_t *mp) free(sb_ifree_ag); free(sb_fdblocks_ag); - if (mp->m_sb.sb_rblocks) { - do_log( - _(" - generate realtime summary info and bitmap...\n")); - check_rtmetadata(mp); - } - do_log(_(" - reset superblock...\n")); /* diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index e325d61f10367e..3ade85bbcbb7fd 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -1318,9 +1318,6 @@ main(int argc, char **argv) if (no_modify) { printf(_("No modify flag set, skipping phase 5\n")); - - if (mp->m_sb.sb_rblocks > 0) - check_rtmetadata(mp); } else { phase5(mp); } From patchwork Thu Oct 31 23:24:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13858485 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9881F1E7C09 for ; Thu, 31 Oct 2024 23:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417044; cv=none; b=fAF89SlC7e6FVXDBZZkp+Nhp3CC4hcZZj/4UPz2LjfdPXD40eAY26INCLai1GYx5mtupbZlSKlPchRKPbcnPUYLhqzO02I9DA/k6QsLPhuTc+uxOzLDyymsdiilEzkZfvlFqALWuxxFwG+WATLvm40FOb5eIxK/oB1b0moMYEkI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417044; c=relaxed/simple; bh=0AHzcXLas3a4rW2ud5bbDx/k7BW2dyPEEK3v9dcfxdo=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EdNIUM9jYEAXFt51p3f/O1oJOCAce6St+SwvNi0gzU242FG3oQYs2vRXcOkiBdbyhNYEm+By11W2UDn7tSqlM95XrL4COvBwyzMTMDC8VyKwH8k5sRdIanZKpSI8EbEpDdPBrsWXHgjlwWNPOe6OnECoHn0hJ3DHRn6rFsAzjRs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ye97DvyQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ye97DvyQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 629BFC4CED7; Thu, 31 Oct 2024 23:24:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730417044; bh=0AHzcXLas3a4rW2ud5bbDx/k7BW2dyPEEK3v9dcfxdo=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Ye97DvyQLW8qEX+fjQkSzRHjZ0hOfikgOL4DKf+lrBudfjyaTenGfPpDlWCB/65EN vGJPN//5lgl6Z1L5GHfuyjqU+fuNTeN5eFGGE1kv1OWCXT804mi8JcWE9LhmtQSc73 N2IpUgkzVB2nmmB2MogP1JjUJCxJKPSHTjl8SBKXXF/Vw8a/x4UTj0FGjwAAsm5Ae/ LZ7gxvMcWjJD8OD0U5Ypomr2QJY2rB5DDJ6/1cHCao05vDcEGcViktxnGVmpYcdZ2d bO1gJZ2eB8/dK0eDbxvW/XRYC3iM4VQs5b6itZWA4H8PeHVvzoM3zhgTRKBwtddTE8 3f2kofRRqZpyw== Date: Thu, 31 Oct 2024 16:24:03 -0700 Subject: [PATCH 2/6] xfs_repair: use xfs_validate_rt_geometry From: "Darrick J. Wong" To: djwong@kernel.org, aalbersh@kernel.org Cc: linux-xfs@vger.kernel.org Message-ID: <173041568133.964620.17517771729333469028.stgit@frogsfrogsfrogs> In-Reply-To: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> References: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Christoph Hellwig Use shared libxfs code with the kernel instead of reimplementing it. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- libxfs/libxfs_api_defs.h | 1 + repair/sb.c | 40 ++-------------------------------------- 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index b9986a00681c1e..a4e8fd08a90541 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -309,6 +309,7 @@ #define xfs_update_secondary_sbs libxfs_update_secondary_sbs +#define xfs_validate_rt_geometry libxfs_validate_rt_geometry #define xfs_validate_stripe_geometry libxfs_validate_stripe_geometry #define xfs_verify_agbno libxfs_verify_agbno #define xfs_verify_agbext libxfs_verify_agbext diff --git a/repair/sb.c b/repair/sb.c index 4b49c1b33c6c83..1320929caee590 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -447,44 +447,8 @@ verify_sb(char *sb_buf, xfs_sb_t *sb, int is_primary_sb) return(XR_BAD_SECT_SIZE_DATA); } - /* - * real-time extent size is always set - */ - if (sb->sb_rextsize * sb->sb_blocksize > XFS_MAX_RTEXTSIZE) - return(XR_BAD_RT_GEO_DATA); - - if (sb->sb_rextsize * sb->sb_blocksize < XFS_MIN_RTEXTSIZE) - return(XR_BAD_RT_GEO_DATA); - - if (sb->sb_rblocks == 0) { - if (sb->sb_rextents != 0) - return(XR_BAD_RT_GEO_DATA); - - if (sb->sb_rbmblocks != 0) - return(XR_BAD_RT_GEO_DATA); - - if (sb->sb_rextslog != 0) - return(XR_BAD_RT_GEO_DATA); - - if (sb->sb_frextents != 0) - return(XR_BAD_RT_GEO_DATA); - } else { - /* - * if we have a real-time partition, sanity-check geometry - */ - if (sb->sb_rblocks / sb->sb_rextsize != sb->sb_rextents) - return(XR_BAD_RT_GEO_DATA); - - if (sb->sb_rextents == 0) - return XR_BAD_RT_GEO_DATA; - - if (sb->sb_rextslog != libxfs_compute_rextslog(sb->sb_rextents)) - return(XR_BAD_RT_GEO_DATA); - - if (sb->sb_rbmblocks != (xfs_extlen_t) howmany(sb->sb_rextents, - NBBY * sb->sb_blocksize)) - return(XR_BAD_RT_GEO_DATA); - } + if (!libxfs_validate_rt_geometry(sb)) + return XR_BAD_RT_GEO_DATA; /* * verify correctness of inode alignment if it's there From patchwork Thu Oct 31 23:24:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13858486 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2ADC31E1A12 for ; Thu, 31 Oct 2024 23:24:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417060; cv=none; b=WX8Y/Wb5dmZbOKOeJylPvbodo99mocOGw1uUeAkl+vc7TsFCDIHZ11mrUrDwLKi+O2zsaaU7Ts3cyS9qLMffF8vo7m+uXj9m91+JXLY14UrTqgVgnCqH4xHFhTstrEzDSQ87O8nMKcuTxIn6u1mgaal+QuPR9mPoj4r/CdpoBVo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417060; c=relaxed/simple; bh=UjNpHV+k9RorUDh45wvtXOvZiBxlhSv06rMjJTZC6RA=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h9ie5vuSRUnJyEKa47qi38T2pBgBZCfVEJwDaIJhWqQ2qlGp4UpfZ5KbJn5kVS8XtJYW/DET+ey3FrJ42YAGDWAwjNbc0QW62dyM40fg+nuSHhzQ0wuWPxG+ZwJdiwTxzRo6pVuDs2zBSbf+FbLHz8Y4osNKV5XbAQA6QrohK7I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UUJiuNz3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UUJiuNz3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04EBAC4CECF; Thu, 31 Oct 2024 23:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730417060; bh=UjNpHV+k9RorUDh45wvtXOvZiBxlhSv06rMjJTZC6RA=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=UUJiuNz3pHiVTFB3hCurmBzyZy+FCvRx66omIJv91GgQUjrGD9DY8iH9yeshEE28b vc1trsyW4QmCuhfx4v1QVfcMN/BPap3XivYTuLcOdtCRXdFJhp6VlpCN4a+gPLZQsG TMjTIvTRPbEGp865fkYnNyjXf4+ekFbPIpPER9KY/J+S3w+Jfhs5Ue3E/2L4uwqJni fnmxuMgeeR9shKcQ+QYUIZHxUphXFVYfU+FQzYkuK47Bo8xgCbKcWVWGZqKlVbCJAe vU8LGCmkJ6E8apZMZ2ibI7IHBkKCEEk2bDJK3tHJ8t95D1/2kHtd7pQRgeybVBBdAU BlPBTDqtmzo9A== Date: Thu, 31 Oct 2024 16:24:19 -0700 Subject: [PATCH 3/6] mkfs: remove a pointless rtfreesp_init forward declaration From: "Darrick J. Wong" To: djwong@kernel.org, aalbersh@kernel.org Cc: linux-xfs@vger.kernel.org Message-ID: <173041568148.964620.2012589547616082953.stgit@frogsfrogsfrogs> In-Reply-To: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> References: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Christoph Hellwig Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- mkfs/proto.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mkfs/proto.c b/mkfs/proto.c index 06010980c5b313..9d21f027c0b174 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -18,7 +18,6 @@ static struct xfs_trans * getres(struct xfs_mount *mp, uint blocks); static void rsvfile(xfs_mount_t *mp, xfs_inode_t *ip, long long len); static char *newregfile(char **pp, int *len); static void rtinit(xfs_mount_t *mp); -static void rtfreesp_init(struct xfs_mount *mp); static long filesize(int fd); static int slashes_are_spaces; From patchwork Thu Oct 31 23:24:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13858487 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C589E1CDA30 for ; Thu, 31 Oct 2024 23:24:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417075; cv=none; b=LPZyoFrcd3Qq1AmdLT68DOtk7SOYrbsGW2kW6uYlaukmHIbi4iTKXCcoPhy/MOsJSRoQEs8Je+Hn4H4TFn+PLBunAOkOos1sR5vahJl00HPHce88d4IsLb+Ibu0qjoxiIqirkex4Cq39B4HPJeozXqOrISvLJ2peCj3FEv3Rcbc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417075; c=relaxed/simple; bh=KgMyQd0U8H4Zra97/Ok/O+1LZTIiiS6Z6wLL9eJJ1KI=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fkRxaAC7Xf/b7rD8xp7kdJhOFT08P4f+lOedjDgiLU+WZfFMYCFYbrdLbIhUXCaIB/TgmOIt0fc/ekcr8tP0GOv4rt+kpAmgS1jN38E0GeuKllr3tqY9aaQj009MnW2cG7p7GSBNZwPa/gcvsufWLySt8bbe3xiwV7BwNe7BoqA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JSygXX8G; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JSygXX8G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FA6AC4CEC3; Thu, 31 Oct 2024 23:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730417075; bh=KgMyQd0U8H4Zra97/Ok/O+1LZTIiiS6Z6wLL9eJJ1KI=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=JSygXX8GDcITpczetzMzei7YsrosFJTxHU7tWHj2a4V4f+wM+sbTvLKrYHvNAXYoN ZQf2Rdf4ZpuyNFEcN9H3WN4LzjZ+e3v9x4pUP8+Uex4td8FNvBEV5QGsmMw9yHWD3T hZN2Z2A4vizKnkoKnENLD9F4WrXAYbBU3XImS9AUer0bRwnpKUmyBmeagoRZhmqmva b4cQFBpQYfVR4I/kceuJwqu7PiS1qGVkj74V1Ck2rzjYZXuJs4hvedaMvLd0iXcgWr e6gk2rvCzcayUYcVjyKlGQI8Tck3cM4RXwrmH73uuNmv3nwrTnpZq+MwJ19/asTi56 P8YpfGfOI5+yQ== Date: Thu, 31 Oct 2024 16:24:35 -0700 Subject: [PATCH 4/6] mkfs: use xfs_rtfile_initialize_blocks From: "Darrick J. Wong" To: djwong@kernel.org, aalbersh@kernel.org Cc: linux-xfs@vger.kernel.org Message-ID: <173041568162.964620.14224234536890497208.stgit@frogsfrogsfrogs> In-Reply-To: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> References: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Christoph Hellwig Use the new libxfs helper for initializing the rtbitmap/summary files for rtgroup-enabled file systems. Also skip the zeroing of the blocks for rtgroup file systems as we'll overwrite every block instantly. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- libxfs/libxfs_api_defs.h | 1 mkfs/proto.c | 106 +++++++--------------------------------------- 2 files changed, 17 insertions(+), 90 deletions(-) diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index a4e8fd08a90541..8f3e9e8694675d 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -263,6 +263,7 @@ #define xfs_suminfo_add libxfs_suminfo_add #define xfs_suminfo_get libxfs_suminfo_get #define xfs_rtsummary_wordcount libxfs_rtsummary_wordcount +#define xfs_rtfile_initialize_blocks libxfs_rtfile_initialize_blocks #define xfs_rtfree_extent libxfs_rtfree_extent #define xfs_rtfree_blocks libxfs_rtfree_blocks diff --git a/mkfs/proto.c b/mkfs/proto.c index 9d21f027c0b174..d8eb6ca33672bd 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -819,94 +819,6 @@ rtsummary_create( ihold(VFS_I(ip)); } -/* Zero the realtime bitmap. */ -static void -rtbitmap_init( - struct xfs_mount *mp) -{ - struct xfs_bmbt_irec map[XFS_BMAP_MAX_NMAP]; - struct xfs_trans *tp; - struct xfs_bmbt_irec *ep; - xfs_fileoff_t bno; - uint blocks; - int i; - int nmap; - int error; - - blocks = mp->m_sb.sb_rbmblocks + - XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1; - error = -libxfs_trans_alloc_rollable(mp, blocks, &tp); - if (error) - res_failed(error); - - libxfs_trans_ijoin(tp, mp->m_rbmip, 0); - bno = 0; - while (bno < mp->m_sb.sb_rbmblocks) { - nmap = XFS_BMAP_MAX_NMAP; - error = -libxfs_bmapi_write(tp, mp->m_rbmip, bno, - (xfs_extlen_t)(mp->m_sb.sb_rbmblocks - bno), - 0, mp->m_sb.sb_rbmblocks, map, &nmap); - if (error) - fail(_("Allocation of the realtime bitmap failed"), - error); - - for (i = 0, ep = map; i < nmap; i++, ep++) { - libxfs_device_zero(mp->m_ddev_targp, - XFS_FSB_TO_DADDR(mp, ep->br_startblock), - XFS_FSB_TO_BB(mp, ep->br_blockcount)); - bno += ep->br_blockcount; - } - } - - error = -libxfs_trans_commit(tp); - if (error) - fail(_("Block allocation of the realtime bitmap inode failed"), - error); -} - -/* Zero the realtime summary file. */ -static void -rtsummary_init( - struct xfs_mount *mp) -{ - struct xfs_bmbt_irec map[XFS_BMAP_MAX_NMAP]; - struct xfs_trans *tp; - struct xfs_bmbt_irec *ep; - xfs_fileoff_t bno; - uint blocks; - int i; - int nmap; - int error; - - blocks = mp->m_rsumblocks + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1; - error = -libxfs_trans_alloc_rollable(mp, blocks, &tp); - if (error) - res_failed(error); - libxfs_trans_ijoin(tp, mp->m_rsumip, 0); - - bno = 0; - while (bno < mp->m_rsumblocks) { - nmap = XFS_BMAP_MAX_NMAP; - error = -libxfs_bmapi_write(tp, mp->m_rsumip, bno, - (xfs_extlen_t)(mp->m_rsumblocks - bno), - 0, mp->m_rsumblocks, map, &nmap); - if (error) - fail(_("Allocation of the realtime summary failed"), - error); - - for (i = 0, ep = map; i < nmap; i++, ep++) { - libxfs_device_zero(mp->m_ddev_targp, - XFS_FSB_TO_DADDR(mp, ep->br_startblock), - XFS_FSB_TO_BB(mp, ep->br_blockcount)); - bno += ep->br_blockcount; - } - } - error = -libxfs_trans_commit(tp); - if (error) - fail(_("Block allocation of the realtime summary inode failed"), - error); -} - /* * Free the whole realtime area using transactions. * Do one transaction per bitmap block. @@ -920,6 +832,22 @@ rtfreesp_init( xfs_rtxnum_t ertx; int error; + /* + * First zero the realtime bitmap and summary files. + */ + error = -libxfs_rtfile_initialize_blocks(mp->m_rbmip, 0, + mp->m_sb.sb_rbmblocks, NULL); + if (error) + fail(_("Initialization of rtbitmap inode failed"), error); + + error = -libxfs_rtfile_initialize_blocks(mp->m_rsumip, 0, + mp->m_rsumblocks, NULL); + if (error) + fail(_("Initialization of rtsummary inode failed"), error); + + /* + * Then free the blocks into the allocator, one bitmap block at a time. + */ for (rtx = 0; rtx < mp->m_sb.sb_rextents; rtx = ertx) { error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp); @@ -953,8 +881,6 @@ rtinit( create_sb_metadata_file(mp, rtbitmap_create); create_sb_metadata_file(mp, rtsummary_create); - rtbitmap_init(mp); - rtsummary_init(mp); rtfreesp_init(mp); } From patchwork Thu Oct 31 23:24:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13858488 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69EF31BD9DC for ; Thu, 31 Oct 2024 23:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417091; cv=none; b=B9WUYzK5X78mZqTKghQNVvUTUSm4ku0CtLO4/VvC+UzyTvzhAdY6kxQAzjvzltDRRKn1CDax1kAo0phenydeYRK/+wgFiefULtdNfyaLau3kp6TpTp/OokD1rhV6T58NHPjm3am/8araWI+e20VSlkHvL3TJUdU7bp9dyBbNFbs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417091; c=relaxed/simple; bh=xEOiA3GlXGGIbYMUXDQ9vw3RahS7fPrF7pQfmD+JO3U=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=myH8vG14EfBGPhw1Lc8NDt9m8pwXeJ1yLE8WdHaZlJ3SmHzhiqGPVxftKgihxNAX+llcNSGjqEafC64eBcaMsPTcXbqNLcwT5UOkOGmMPqDZVVZ9T/0U6Y2I3WXSz7ehotZUhGH6MuoOC3x/dS/dC1EfZArF4HuiQp3El16xipM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PBGSREgz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PBGSREgz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47A91C4CEC3; Thu, 31 Oct 2024 23:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730417091; bh=xEOiA3GlXGGIbYMUXDQ9vw3RahS7fPrF7pQfmD+JO3U=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=PBGSREgzKtEXqki8ga9QTSPZXcsCSswJSpWpGhJa07O8495dlq4O5KsVOHJL6Ghu2 GzxxS1vh7nTLFsqloBCGnRn3Vz4yewh9ebHUsdYgz9FAVy7eyZwBCg3XmXtSOpf6Q5 b5Zc3hBg5irAmwnZmTYoeMtpHeYOX8+1NTkbv8QwhxRr6oH9pV3EVZk2cskedisago lTDt9ZUE3dNWwfO/KaNFvRwambr58F8ONcKHpWmjpEu0MZ+TJp5g6JeARjH8M91MdU Bt8DKmgTD3gqS8cZsjC3725wI0S43AfWP5dIonTjoIKk229v9aMiC3YILNSeLydj5q kdvZ6Maxnj48g== Date: Thu, 31 Oct 2024 16:24:50 -0700 Subject: [PATCH 5/6] xfs_repair: use libxfs_rtfile_initialize_blocks From: "Darrick J. Wong" To: djwong@kernel.org, aalbersh@kernel.org Cc: linux-xfs@vger.kernel.org Message-ID: <173041568178.964620.7403844353440979838.stgit@frogsfrogsfrogs> In-Reply-To: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> References: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Christoph Hellwig Use libxfs_rtfile_initialize_blocks to write the re-computed rtbitmap and rtsummary contents. This removes duplicate code and prepares for even more sharing once the rtgroup features adds a metadata header to the rtbitmap and rtsummary blocks. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- repair/phase6.c | 168 ++++++++++--------------------------------------------- 1 file changed, 32 insertions(+), 136 deletions(-) diff --git a/repair/phase6.c b/repair/phase6.c index c96b50cf6a69dd..310a2b9c07bff0 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -547,157 +547,60 @@ mk_rbmino(xfs_mount_t *mp) libxfs_irele(ip); } -static int -fill_rbmino(xfs_mount_t *mp) +static void +fill_rbmino( + struct xfs_mount *mp) { - struct xfs_buf *bp; - xfs_trans_t *tp; - xfs_inode_t *ip; - union xfs_rtword_raw *bmp; - int nmap; - int error; - xfs_fileoff_t bno; - xfs_bmbt_irec_t map; - - bmp = btmcompute; - bno = 0; + struct xfs_trans *tp; + struct xfs_inode *ip; + int error; error = -libxfs_trans_alloc_rollable(mp, 10, &tp); if (error) res_failed(error); error = -libxfs_iget(mp, tp, mp->m_sb.sb_rbmino, 0, &ip); - if (error) { + libxfs_trans_cancel(tp); + if (error) do_error( - _("couldn't iget realtime bitmap inode -- error - %d\n"), - error); - } - - while (bno < mp->m_sb.sb_rbmblocks) { - struct xfs_rtalloc_args args = { - .mp = mp, - .tp = tp, - }; - union xfs_rtword_raw *ondisk; - - /* - * fill the file one block at a time - */ - nmap = 1; - error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, 1, &map, &nmap); - if (error || nmap != 1) { - do_error( - _("couldn't map realtime bitmap block %" PRIu64 ", error = %d\n"), - bno, error); - } - - ASSERT(map.br_startblock != HOLESTARTBLOCK); - - error = -libxfs_trans_read_buf( - mp, tp, mp->m_dev, - XFS_FSB_TO_DADDR(mp, map.br_startblock), - XFS_FSB_TO_BB(mp, 1), 1, &bp, NULL); - - if (error) { - do_warn( -_("can't access block %" PRIu64 " (fsbno %" PRIu64 ") of realtime bitmap inode %" PRIu64 "\n"), - bno, map.br_startblock, mp->m_sb.sb_rbmino); - return(1); - } +_("couldn't iget realtime bitmap inode, error %d\n"), error); - args.rbmbp = bp; - ondisk = xfs_rbmblock_wordptr(&args, 0); - memcpy(ondisk, bmp, mp->m_blockwsize << XFS_WORDLOG); - - libxfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1); - - bmp += mp->m_blockwsize; - bno++; - } - - libxfs_trans_ijoin(tp, ip, 0); - error = -libxfs_trans_commit(tp); + error = -libxfs_rtfile_initialize_blocks(ip, 0, mp->m_sb.sb_rbmblocks, + btmcompute); if (error) - do_error(_("%s: commit failed, error %d\n"), __func__, error); + do_error( +_("couldn't re-initialize realtime bitmap inode, error %d\n"), error); + libxfs_irele(ip); - return(0); } -static int -fill_rsumino(xfs_mount_t *mp) +static void +fill_rsumino( + struct xfs_mount *mp) { - struct xfs_buf *bp; - xfs_trans_t *tp; - xfs_inode_t *ip; - union xfs_suminfo_raw *smp; - int nmap; - int error; - xfs_fileoff_t bno; - xfs_bmbt_irec_t map; - - smp = sumcompute; - bno = 0; + struct xfs_trans *tp; + struct xfs_inode *ip; + int error; error = -libxfs_trans_alloc_rollable(mp, 10, &tp); if (error) res_failed(error); error = -libxfs_iget(mp, tp, mp->m_sb.sb_rsumino, 0, &ip); - if (error) { + libxfs_trans_cancel(tp); + if (error) do_error( - _("couldn't iget realtime summary inode -- error - %d\n"), - error); - } - - while (bno < mp->m_rsumblocks) { - struct xfs_rtalloc_args args = { - .mp = mp, - .tp = tp, - }; - union xfs_suminfo_raw *ondisk; - - /* - * fill the file one block at a time - */ - nmap = 1; - error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, 1, &map, &nmap); - if (error || nmap != 1) { - do_error( - _("couldn't map realtime summary inode block %" PRIu64 ", error = %d\n"), - bno, error); - } - - ASSERT(map.br_startblock != HOLESTARTBLOCK); - - error = -libxfs_trans_read_buf( - mp, tp, mp->m_dev, - XFS_FSB_TO_DADDR(mp, map.br_startblock), - XFS_FSB_TO_BB(mp, 1), 1, &bp, NULL); - - if (error) { - do_warn( -_("can't access block %" PRIu64 " (fsbno %" PRIu64 ") of realtime summary inode %" PRIu64 "\n"), - bno, map.br_startblock, mp->m_sb.sb_rsumino); - libxfs_irele(ip); - return(1); - } +_("couldn't iget realtime summary inode, error %d\n"), error); - args.sumbp = bp; - ondisk = xfs_rsumblock_infoptr(&args, 0); - memcpy(ondisk, smp, mp->m_blockwsize << XFS_WORDLOG); - - libxfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1); - - smp += mp->m_blockwsize; - bno++; - } - - libxfs_trans_ijoin(tp, ip, 0); - error = -libxfs_trans_commit(tp); + mp->m_rsumip = ip; + error = -libxfs_rtfile_initialize_blocks(ip, 0, mp->m_rsumblocks, + sumcompute); + mp->m_rsumip = NULL; if (error) - do_error(_("%s: commit failed, error %d\n"), __func__, error); + do_error( +_("couldn't re-initialize realtime summary inode, error %d\n"), error); + libxfs_irele(ip); - return(0); } static void @@ -3302,15 +3205,8 @@ phase6(xfs_mount_t *mp) if (!no_modify) { do_log( _(" - resetting contents of realtime bitmap and summary inodes\n")); - if (fill_rbmino(mp)) { - do_warn( - _("Warning: realtime bitmap may be inconsistent\n")); - } - - if (fill_rsumino(mp)) { - do_warn( - _("Warning: realtime bitmap may be inconsistent\n")); - } + fill_rbmino(mp); + fill_rsumino(mp); } mark_standalone_inodes(mp); From patchwork Thu Oct 31 23:25:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13858489 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 597441BD9DC for ; Thu, 31 Oct 2024 23:25:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417107; cv=none; b=V0YfYFoI7PL++kvOUdnAqWYWbOLKUGYPxVWZ+20nGzO6C6nGx+6QtY3BVlOrtv1ZhwqvbgPCikCUNnNwy1HlTiH6SOuZmfB32iTfFY64G+eWVPZUFFU6w83r/dZzo4n5WkdsSwklRV0rTWdnfHfOmejh7KIn4mr3Y2vCHWtxdko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730417107; c=relaxed/simple; bh=rMS04JzWbTA10NoNgT1uDwTz6/mlMY+uwx8e75a0h5c=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Z7kMb0tkxHAka05z55cFGGMOSvzCMmi+AxXgufV8Qi4K2+z3ShtGtNrjkDbMjiZQXuo2ZwBzzWtWi+UG/gIa7a3PaXop9uXqrSuH+hmjyKi/BL2ADyZMJS0vX9MSgBlTnx22BzNuIFNfpkbK9j60i3rSwMqUTJthBKa6v6vdJrU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZbIvu+yD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZbIvu+yD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5A10C4CEC3; Thu, 31 Oct 2024 23:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730417106; bh=rMS04JzWbTA10NoNgT1uDwTz6/mlMY+uwx8e75a0h5c=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ZbIvu+yDazZN/Xjm0/qO4YidZBc14r/RHERV13G5+9bI6pRF11f/xCOomfCGDqaCu teuMS2rA8BaAaIwYVSuTlm/xbrCsLk/BMnOaIA/UmB5EBywuenoSpw1ncxb/ukNSBN ZfkZ0Pu41chfXTlm0FS5ZFgdQhIpuZp3flcX0edxpj/KKF5YRZm+YAA3xl+gSf96IH 0jC6xaC0y+RyGKt5qpmgOIMC+YtaVpszf+YAei0715cCdsYDlqSX80rqY7Fey9i8Jz cXDPuROT81bkPKJwzEeMzsJp9QiuH2V4ccKnNuwMPRDhMwbuuBTYpzPg0q9SXKNdy7 fOKMDkSNkl+zQ== Date: Thu, 31 Oct 2024 16:25:06 -0700 Subject: [PATCH 6/6] xfs_repair: stop preallocating blocks in mk_rbmino and mk_rsumino From: "Darrick J. Wong" To: djwong@kernel.org, aalbersh@kernel.org Cc: linux-xfs@vger.kernel.org Message-ID: <173041568193.964620.8976369035012357193.stgit@frogsfrogsfrogs> In-Reply-To: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> References: <173041568097.964620.17809679042644398581.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Christoph Hellwig Now that repair is using libxfs_rtfile_initialize_blocks to write to the rtbitmap and rtsummary inodes, space allocation is already taken care of that helper and there is no need to preallocate it. Remove the code to do so. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- repair/phase6.c | 116 +++++++------------------------------------------------ 1 file changed, 14 insertions(+), 102 deletions(-) diff --git a/repair/phase6.c b/repair/phase6.c index 310a2b9c07bff0..630617ef8ab8fe 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -475,24 +475,16 @@ reset_sbroot_ino( } static void -mk_rbmino(xfs_mount_t *mp) +mk_rbmino( + struct xfs_mount *mp) { - xfs_trans_t *tp; - xfs_inode_t *ip; - xfs_bmbt_irec_t *ep; - int i; - int nmap; - int error; - xfs_fileoff_t bno; - xfs_bmbt_irec_t map[XFS_BMAP_MAX_NMAP]; - uint blocks; + struct xfs_trans *tp; + struct xfs_inode *ip; + int error; - /* - * first set up inode - */ - i = -libxfs_trans_alloc_rollable(mp, 10, &tp); - if (i) - res_failed(i); + error = -libxfs_trans_alloc_rollable(mp, 10, &tp); + if (error) + res_failed(error); error = -libxfs_iget(mp, tp, mp->m_sb.sb_rbmino, 0, &ip); if (error) { @@ -508,42 +500,6 @@ mk_rbmino(xfs_mount_t *mp) error = -libxfs_trans_commit(tp); if (error) do_error(_("%s: commit failed, error %d\n"), __func__, error); - - /* - * then allocate blocks for file and fill with zeroes (stolen - * from mkfs) - */ - blocks = mp->m_sb.sb_rbmblocks + - XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1; - error = -libxfs_trans_alloc_rollable(mp, blocks, &tp); - if (error) - res_failed(error); - - libxfs_trans_ijoin(tp, ip, 0); - bno = 0; - while (bno < mp->m_sb.sb_rbmblocks) { - nmap = XFS_BMAP_MAX_NMAP; - error = -libxfs_bmapi_write(tp, ip, bno, - (xfs_extlen_t)(mp->m_sb.sb_rbmblocks - bno), - 0, mp->m_sb.sb_rbmblocks, map, &nmap); - if (error) { - do_error( - _("couldn't allocate realtime bitmap, error = %d\n"), - error); - } - for (i = 0, ep = map; i < nmap; i++, ep++) { - libxfs_device_zero(mp->m_ddev_targp, - XFS_FSB_TO_DADDR(mp, ep->br_startblock), - XFS_FSB_TO_BB(mp, ep->br_blockcount)); - bno += ep->br_blockcount; - } - } - error = -libxfs_trans_commit(tp); - if (error) { - do_error( - _("allocation of the realtime bitmap failed, error = %d\n"), - error); - } libxfs_irele(ip); } @@ -606,22 +562,13 @@ _("couldn't re-initialize realtime summary inode, error %d\n"), error); static void mk_rsumino(xfs_mount_t *mp) { - xfs_trans_t *tp; - xfs_inode_t *ip; - xfs_bmbt_irec_t *ep; - int i; - int nmap; - int error; - xfs_fileoff_t bno; - xfs_bmbt_irec_t map[XFS_BMAP_MAX_NMAP]; - uint blocks; + struct xfs_trans *tp; + struct xfs_inode *ip; + int error; - /* - * first set up inode - */ - i = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 10, 0, 0, &tp); - if (i) - res_failed(i); + error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 10, 0, 0, &tp); + if (error) + res_failed(error); error = -libxfs_iget(mp, tp, mp->m_sb.sb_rsumino, 0, &ip); if (error) { @@ -637,41 +584,6 @@ mk_rsumino(xfs_mount_t *mp) error = -libxfs_trans_commit(tp); if (error) do_error(_("%s: commit failed, error %d\n"), __func__, error); - - /* - * then allocate blocks for file and fill with zeroes (stolen - * from mkfs) - */ - blocks = mp->m_rsumblocks + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1; - error = -libxfs_trans_alloc_rollable(mp, blocks, &tp); - if (error) - res_failed(error); - - libxfs_trans_ijoin(tp, ip, 0); - bno = 0; - while (bno < mp->m_rsumblocks) { - nmap = XFS_BMAP_MAX_NMAP; - error = -libxfs_bmapi_write(tp, ip, bno, - (xfs_extlen_t)(mp->m_rsumblocks - bno), - 0, mp->m_rsumblocks, map, &nmap); - if (error) { - do_error( - _("couldn't allocate realtime summary inode, error = %d\n"), - error); - } - for (i = 0, ep = map; i < nmap; i++, ep++) { - libxfs_device_zero(mp->m_ddev_targp, - XFS_FSB_TO_DADDR(mp, ep->br_startblock), - XFS_FSB_TO_BB(mp, ep->br_blockcount)); - bno += ep->br_blockcount; - } - } - error = -libxfs_trans_commit(tp); - if (error) { - do_error( - _("allocation of the realtime summary ino failed, error = %d\n"), - error); - } libxfs_irele(ip); }