File debugfs.ocfs2-Fix-the-error-on-devices-with-sector-s.patch of Package ocfs2-tools.34411
From 4ab576767129a89f3ff6d60c85c23c3be80c2dae Mon Sep 17 00:00:00 2001
From: Gang He <ghe@suse.com>
Date: Wed, 6 May 2020 18:06:07 +0800
Subject: [PATCH] debugfs.ocfs2: Fix the error on devices with sector size 4096
Debugfs.ocfs2 can not work on devices with sector size 4096,
e.g.
# debugfs.ocfs2 -s 1 /dev/sdd
open: I/O error on channel Can't get the blocksize from the device by the num 1
# blockdev --getss /dev/sdd
4096
we should remove these line hard code, then debugfs.ocfs2 works on
different sector size devices.
---
debugfs.ocfs2/commands.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
index cc88583c..b1ee6172 100644
--- a/debugfs.ocfs2/commands.c
+++ b/debugfs.ocfs2/commands.c
@@ -482,14 +482,6 @@ static errcode_t get_blocksize(char* dev, uint64_t offset, uint64_t *blocksize,
if (ret)
goto bail;
- /* since ocfs2_super_block inode can be stored in OCFS2_MIN_BLOCKSIZE,
- * so here we just use the minimum block size and read the information
- * in the specific offset.
- */
- ret = io_set_blksize(channel, OCFS2_MIN_BLOCKSIZE);
- if (ret)
- goto bail;
-
ret = ocfs2_malloc_block(channel, &buf);
if (ret)
goto bail;
@@ -507,7 +499,7 @@ static errcode_t get_blocksize(char* dev, uint64_t offset, uint64_t *blocksize,
offset = hdr->hdr_superblocks[super_no-1] * hdr->hdr_fsblksz;
}
- blkno = offset / OCFS2_MIN_BLOCKSIZE;
+ blkno = offset / io_get_blksize(channel);
ret = io_read_block(channel, blkno, 1, buf);
if (ret)
goto bail;
--
2.21.0