[PATCH] xfs_db: take BB cluster offset into account when using 'type' cmd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changing the interpretation type of data under the cursor moves the
cursor to the beginning of BB cluster. When cursor is set to an
inode the cursor is offset in BB buffer. However, this offset is not
considered when type of the data is changed - the cursor points to
the beginning of BB buffer. For example:

$ xfs_db -c "inode 131" -c "daddr" -c "type text" \
	-c "daddr" /dev/sdb1
current daddr is 131
current daddr is 128

Signed-off-by: Andrey Albershteyn <aalbersh@xxxxxxxxxx>
---
 db/io.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/db/io.c b/db/io.c
index df97ed91..107f2e11 100644
--- a/db/io.c
+++ b/db/io.c
@@ -589,6 +589,7 @@ set_iocur_type(
 	const typ_t	*type)
 {
 	int		bb_count = 1;	/* type's size in basic blocks */
+	int boff = iocur_top->boff;
 
 	/*
 	 * Inodes are special; verifier checks all inodes in the chunk, the
@@ -613,6 +614,9 @@ set_iocur_type(
 		bb_count = BTOBB(byteize(fsize(type->fields,
 				       iocur_top->data, 0, 0)));
 	set_cur(type, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
+	iocur_top->boff = boff;
+	iocur_top->off = ((xfs_off_t)iocur_top->bb << BBSHIFT) + boff;
+	iocur_top->data = (void *)((char *)iocur_top->buf + boff);
 }
 
 static void
-- 
2.27.0




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux