Skip to contentSkip to conversation

Review: Fix bulkstat block count units

DISCUSSION David Chinner 2 participants 2 messages Jan 31, 2007

lore
Share & tools
lore
#0 lore raw

The recent bulkstat improvements introduced a minor regression - they changed the units of the dt_count field from 512 byte blocks to filesystem blocks. This changes the userspace visible fields and can break existing applications that use bulkstat.

Comments?

Cheers,

Dave.

Signature · 31 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group

---
 fs/xfs/dmapi/xfs_dm.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: 2.6.x-xfs-new/fs/xfs/dmapi/xfs_dm.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/dmapi/xfs_dm.c	2007-01-16 10:54:14.000000000 +1100
+++ 2.6.x-xfs-new/fs/xfs/dmapi/xfs_dm.c	2007-01-29 18:09:35.612014885 +1100
@@ -426,7 +426,8 @@ xfs_dip_to_stat(
 	case XFS_DINODE_FMT_BTREE:
 		buf->dt_rdev = 0;
 		buf->dt_blksize = mp->m_sb.sb_blocksize;
-		buf->dt_blocks = INT_GET(dic->di_nblocks, ARCH_CONVERT);
+		buf->dt_blocks = XFS_FSB_TO_BB(mp,
+				INT_GET(dic->di_nblocks, ARCH_CONVERT));
 		break;
 	}
 
@@ -494,7 +495,8 @@ xfs_ip_to_stat(
 	case XFS_DINODE_FMT_BTREE:
 		buf->dt_rdev = 0;
 		buf->dt_blksize = mp->m_sb.sb_blocksize;
-		buf->dt_blocks = dic->di_nblocks + ip->i_delayed_blks;
+		buf->dt_blocks = XFS_FSB_TO_BB(mp,
+				(dic->di_nblocks + ip->i_delayed_blks));
 		break;
 	}
#1 lore raw

The patch is looking good Dave.

Regards,
Vlad

Quoted 12 lines · David Chinner

The recent bulkstat improvements introduced a minor regression - they changed the units of the dt_count field from 512 byte blocks to filesystem blocks. This changes the userspace visible fields and can break existing applications that use bulkstat.

Comments?

Cheers,

Dave.