All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: remove pointless pointer increment in xfs_dir2_block_compact()
@ 2014-04-09 20:30 Eric Sandeen
  2014-04-09 21:34 ` Mark Tinguely
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2014-04-09 20:30 UTC (permalink / raw)
  To: xfs-oss

xfs_dir2_block_compact() is passed a pointer to *blp, and
advances it locally - but nobody uses the pointer (locally)
after that.

This behavior came about as part of prior refactoring,

20f7e9f xfs: factor dir2 block read operations

and looking at the code as it was before, it seems quite clear
that this change introduced a bug; the pre-refactoring code
expects blp to be modified after compaction.
And indeed it did; see this commit which fixed it:

37f1356 xfs: recalculate leaf entry pointer after compacting a dir2 block

So the bug was introduced & resolved in the 3.8 cycle.

Whoops.  Well, it's fixed now, and mystery solved; just remove
the now-pointless local increment of the blp pointer.

(I guess we should have run clang earlier!)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index 4f6a38c..5259939 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -319,7 +319,6 @@ xfs_dir2_block_compact(
 		(xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr),
 		(xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)),
 		needlog, &needscan);
-	blp += be32_to_cpu(btp->stale) - 1;
 	btp->stale = cpu_to_be32(1);
 	/*
 	 * If we now need to rebuild the bestfree map, do so.

_______________________________________________
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: remove pointless pointer increment in xfs_dir2_block_compact()
  2014-04-09 20:30 [PATCH] xfs: remove pointless pointer increment in xfs_dir2_block_compact() Eric Sandeen
@ 2014-04-09 21:34 ` Mark Tinguely
  2014-04-09 21:35   ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Tinguely @ 2014-04-09 21:34 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On 04/09/14 15:30, Eric Sandeen wrote:
> xfs_dir2_block_compact() is passed a pointer to *blp, and
> advances it locally - but nobody uses the pointer (locally)
> after that.
>
> This behavior came about as part of prior refactoring,
>
> 20f7e9f xfs: factor dir2 block read operations
>
> and looking at the code as it was before, it seems quite clear
> that this change introduced a bug; the pre-refactoring code
> expects blp to be modified after compaction.
> And indeed it did; see this commit which fixed it:
>
> 37f1356 xfs: recalculate leaf entry pointer after compacting a dir2 block
>
> So the bug was introduced & resolved in the 3.8 cycle.
>
> Whoops.  Well, it's fixed now, and mystery solved; just remove
> the now-pointless local increment of the blp pointer.
>
> (I guess we should have run clang earlier!)
>
> Signed-off-by: Eric Sandeen<sandeen@redhat.com>
> ---

Harmless, but yes it should be removed.

Reviewed-by: Mark Tinguely <tinguely@sgi.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: remove pointless pointer increment in xfs_dir2_block_compact()
  2014-04-09 21:34 ` Mark Tinguely
@ 2014-04-09 21:35   ` Eric Sandeen
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2014-04-09 21:35 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs-oss

On 4/9/14, 4:34 PM, Mark Tinguely wrote:
> On 04/09/14 15:30, Eric Sandeen wrote:
>> xfs_dir2_block_compact() is passed a pointer to *blp, and
>> advances it locally - but nobody uses the pointer (locally)
>> after that.
>>
>> This behavior came about as part of prior refactoring,
>>
>> 20f7e9f xfs: factor dir2 block read operations
>>
>> and looking at the code as it was before, it seems quite clear
>> that this change introduced a bug; the pre-refactoring code
>> expects blp to be modified after compaction.
>> And indeed it did; see this commit which fixed it:
>>
>> 37f1356 xfs: recalculate leaf entry pointer after compacting a dir2 block
>>
>> So the bug was introduced & resolved in the 3.8 cycle.
>>
>> Whoops.  Well, it's fixed now, and mystery solved; just remove
>> the now-pointless local increment of the blp pointer.
>>
>> (I guess we should have run clang earlier!)
>>
>> Signed-off-by: Eric Sandeen<sandeen@redhat.com>
>> ---
> 
> Harmless, but yes it should be removed.

Harmless now that we fixed it the hard way back in January...  ;)

thanks for the reviews,
-Eric

> Reviewed-by: Mark Tinguely <tinguely@sgi.com>

_______________________________________________
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:[~2014-04-09 21:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-09 20:30 [PATCH] xfs: remove pointless pointer increment in xfs_dir2_block_compact() Eric Sandeen
2014-04-09 21:34 ` Mark Tinguely
2014-04-09 21:35   ` Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.