xfs: get new buffer for secondary superblocks from the first new AG
PATCH 1/1 xfs: get new buffer for secondary superblocks from the first new AG
In growfs operation, the unused parts of superblocks in the latest old AG are zero filled, hence we can safely read the secondary superblock buffer of it rather than getting a new buffer for it again.
This is a small refinement for commits 1375cb65.
--- fs/xfs/xfs_fsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_fsops.c +1 -1
@@ -449,7 +449,7 @@ xfs_growfs_data_private(* disk as the contents of the new area we are growing into is * completely unknown. */ -if (agno < oagcount) { +if (agno <= oagcount) { error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)), XFS_FSS_TO_BB(mp, 1), 0, &bp,
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Jeff Liu
In growfs operation, the unused parts of superblocks in the latest old AG are zero filled, hence we can safely read the secondary superblock buffer of it rather than getting a new buffer for it again.
From the code:
oagcount = mp->m_sb.sb_agcount;
And because the AG indexes are zero numbered, the index of the last original AGs is (oagcount - 1). Hence we shoul donly be reading from the AG headers if the current AG index is less than oagcount.
Quoted 13 lines
This is a small refinement for commits
1375cb65.Cc Dave Chinner <[email protected]>Signed-off-by Jie Liu <[email protected]>--- fs/xfs/xfs_fsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_fsops.c +0
-0
fs/xfs/xfs_fsops.c xfs_growfs_data_private( · line 452
Quoted 5 lines
fs/xfs/xfs_fsops.c +1
-1@@ -449,7 +449,7 @@ xfs_growfs_data_private(* disk as the contents of the new area we are growing into is * completely unknown. */ -if (agno < oagcount) { +if (agno <= oagcount) {
With this change, when agno == oagcount we are one AG beyond the original filesystem size and so if we read that space, we are reading uninitialised data.
AFAICT, the current code is correct...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 36 lines · Dave Chinner
Quoted 3 lines · Jeff Liu
In growfs operation, the unused parts of superblocks in the latest old AG are zero filled, hence we can safely read the secondary superblock buffer of it rather than getting a new buffer for it again.
From the code:
oagcount = mp->m_sb.sb_agcount;And because the AG indexes are zero numbered, the index of the last original AGs is (oagcount - 1). Hence we shoul donly be reading from the AG headers if the current AG index is less than oagcount.
Quoted 13 lines
This is a small refinement for commits
1375cb65.Cc Dave Chinner <[email protected]>Signed-off-by Jie Liu <[email protected]>--- fs/xfs/xfs_fsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_fsops.c +0
-0fs/xfs/xfs_fsops.c xfs_growfs_data_private( · line 452
Quoted 5 lines
fs/xfs/xfs_fsops.c +1
-1@@ -449,7 +449,7 @@ xfs_growfs_data_private(* disk as the contents of the new area we are growing into is * completely unknown. */ -if (agno < oagcount) { +if (agno <= oagcount) {With this change, when agno == oagcount we are one AG beyond the original filesystem size and so if we read that space, we are reading uninitialised data.
Quoted 1 line
AFAICT, the current code is correct...
Oops, I made a stupid mistake. The index of the last original AGs is (oagcount - 1) rather than oagcount...
Sorry for the noise!
Thanks,
-Jeff
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs