* [PATCH] xfs: get new buffer for secondary superblocks from the first new AG
@ 2013-03-21 4:12 Jeff Liu
2013-03-21 5:44 ` Dave Chinner
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Liu @ 2013-03-21 4:12 UTC (permalink / raw)
To: xfs@oss.sgi.com
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.
Cc: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
fs/xfs/xfs_fsops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 94eaeed..7d435dd 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -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,
--
1.7.9.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] xfs: get new buffer for secondary superblocks from the first new AG
2013-03-21 4:12 [PATCH] xfs: get new buffer for secondary superblocks from the first new AG Jeff Liu
@ 2013-03-21 5:44 ` Dave Chinner
2013-03-21 6:27 ` Jeff Liu
0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2013-03-21 5:44 UTC (permalink / raw)
To: Jeff Liu; +Cc: xfs@oss.sgi.com
On Thu, Mar 21, 2013 at 12:12:51PM +0800, Jeff Liu wrote:
> 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.
> This is a small refinement for commits 1375cb65.
>
> Cc: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
> ---
> fs/xfs/xfs_fsops.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> index 94eaeed..7d435dd 100644
> --- a/fs/xfs/xfs_fsops.c
> +++ b/fs/xfs/xfs_fsops.c
> @@ -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.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] xfs: get new buffer for secondary superblocks from the first new AG
2013-03-21 5:44 ` Dave Chinner
@ 2013-03-21 6:27 ` Jeff Liu
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Liu @ 2013-03-21 6:27 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs@oss.sgi.com
On 03/21/2013 01:44 PM, Dave Chinner wrote:
> On Thu, Mar 21, 2013 at 12:12:51PM +0800, Jeff Liu wrote:
>> 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.
>
>> This is a small refinement for commits 1375cb65.
>>
>> Cc: Dave Chinner <david@fromorbit.com>
>> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
>> ---
>> fs/xfs/xfs_fsops.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
>> index 94eaeed..7d435dd 100644
>> --- a/fs/xfs/xfs_fsops.c
>> +++ b/fs/xfs/xfs_fsops.c
>> @@ -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...
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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-21 6:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-21 4:12 [PATCH] xfs: get new buffer for secondary superblocks from the first new AG Jeff Liu
2013-03-21 5:44 ` Dave Chinner
2013-03-21 6:27 ` Jeff Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox