Message ID | 20180620090230.10757-1-fdmanana@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On 20.06.2018 12:02, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > <snip> > So fix this by ensuring the physical offset is always set to 0 when we > are processing an extent with a special block_start value. > > Fixes: 9d311e11fc1f ("Btrfs: fiemap: pass correct bytenr when fm_extent_count is zero") > Signed-off-by: Filipe Manana <fdmanana@suse.com> At first I was "wtf" since I had missed the u64 cast. After realising that the constants are in fact always parsed as positive numbers then it makes sense. Reviewed-by: Nikolay Borisov <nborisov@suse.com> > --- > > v2: Set the physical offset to 0 for other extent maps with a special > block_start value as well. > > fs/btrfs/extent_io.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > index 8e4a7cdbc9f5..1aa91d57404a 100644 > --- a/fs/btrfs/extent_io.c > +++ b/fs/btrfs/extent_io.c > @@ -4545,8 +4545,11 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, > offset_in_extent = em_start - em->start; > em_end = extent_map_end(em); > em_len = em_end - em_start; > - disko = em->block_start + offset_in_extent; > flags = 0; > + if (em->block_start < EXTENT_MAP_LAST_BYTE) > + disko = em->block_start + offset_in_extent; > + else > + disko = 0; > > /* > * bump off for our next call to get_extent > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8e4a7cdbc9f5..1aa91d57404a 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4545,8 +4545,11 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, offset_in_extent = em_start - em->start; em_end = extent_map_end(em); em_len = em_end - em_start; - disko = em->block_start + offset_in_extent; flags = 0; + if (em->block_start < EXTENT_MAP_LAST_BYTE) + disko = em->block_start + offset_in_extent; + else + disko = 0; /* * bump off for our next call to get_extent