xfs_db: don't hardcode 'type data' size at 512b
This commit is contained in:
parent
7d6f4a7c58
commit
315f731667
62
0003-xfs_db-don-t-hardcode-type-data-size-at-512b.patch
Normal file
62
0003-xfs_db-don-t-hardcode-type-data-size-at-512b.patch
Normal file
@ -0,0 +1,62 @@
|
||||
From 127b66a4d8afc6f3dfe8929c01b1f1e63c1ebf31 Mon Sep 17 00:00:00 2001
|
||||
From: "Darrick J. Wong" <djwong@kernel.org>
|
||||
Date: Thu, 22 Feb 2024 14:04:31 -0800
|
||||
Subject: xfs_db: don't hardcode 'type data' size at 512b
|
||||
|
||||
On a disk with 4096-byte LBAs, the xfs_db 'type data' subcommand doesn't
|
||||
work:
|
||||
|
||||
# xfs_io -c 'sb' -c 'type data' /dev/sda
|
||||
xfs_db: read failed: Invalid argument
|
||||
no current object
|
||||
|
||||
The cause of this is the hardcoded initialization of bb_count when we're
|
||||
setting type data -- it should be the filesystem sector size, not just 1.
|
||||
|
||||
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
|
||||
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
||||
---
|
||||
db/block.c | 3 ++-
|
||||
db/io.c | 3 ++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/db/block.c b/db/block.c
|
||||
index d730c77967..22930e5a28 100644
|
||||
--- a/db/block.c
|
||||
+++ b/db/block.c
|
||||
@@ -124,6 +124,7 @@ daddr_f(
|
||||
{
|
||||
int64_t d;
|
||||
char *p;
|
||||
+ int bb_count = BTOBB(mp->m_sb.sb_sectsize);
|
||||
|
||||
if (argc == 1) {
|
||||
xfs_daddr_t daddr = iocur_top->off >> BBSHIFT;
|
||||
@@ -144,7 +145,7 @@ daddr_f(
|
||||
return 0;
|
||||
}
|
||||
ASSERT(typtab[TYP_DATA].typnm == TYP_DATA);
|
||||
- set_cur(&typtab[TYP_DATA], d, 1, DB_RING_ADD, NULL);
|
||||
+ set_cur(&typtab[TYP_DATA], d, bb_count, DB_RING_ADD, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/db/io.c b/db/io.c
|
||||
index 590dd1f82f..9b2c6b4cf7 100644
|
||||
--- a/db/io.c
|
||||
+++ b/db/io.c
|
||||
@@ -652,7 +652,8 @@ void
|
||||
set_iocur_type(
|
||||
const typ_t *type)
|
||||
{
|
||||
- int bb_count = 1; /* type's size in basic blocks */
|
||||
+ /* type's size in basic blocks */
|
||||
+ int bb_count = BTOBB(mp->m_sb.sb_sectsize);
|
||||
int boff = iocur_top->boff;
|
||||
|
||||
/*
|
||||
--
|
||||
cgit 1.2.3-korg
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: xfsprogs
|
||||
Version: 6.6.0
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: Administration and debugging tools for the XFS file system
|
||||
License: GPL+ and LGPLv2+
|
||||
URL: https://xfs.wiki.kernel.org
|
||||
@ -21,6 +21,7 @@ Conflicts: xfsdump < 3.0.1
|
||||
Patch0: xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch
|
||||
Patch1: 0001-xfsprogs-Add-sw64-architecture.patch
|
||||
Patch2: 0002-xfs-fix-internal-error-from-AGFL-exhaustion.patch
|
||||
Patch3: 0003-xfs_db-don-t-hardcode-type-data-size-at-512b.patch
|
||||
|
||||
%description
|
||||
xfsprogs are the userspace utilities that manage XFS filesystems.
|
||||
@ -102,6 +103,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Apr 2 2024 liuh <liuhuan01@kylinos.cn> - 6.6.0-3
|
||||
- sync patch from community
|
||||
|
||||
* Fri Mar 29 2024 liuh <liuhuan01@kylinos.cn> - 6.6.0-2
|
||||
- sync patch from community
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user