Re: [PATCH 18/20] Use FIEMAP for FIBMAP calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > +	if (inode->i_op->fiemap) {
> > +		fextent.fe_logical = 0;
> > +		fextent.fe_physical = 0;
> > +		f_ctx.fc_extents_max = 1;
> > +		f_ctx.fc_extents_mapped = 0;
> > +		f_ctx.fc_data = &fextent;
> > +		f_ctx.fc_start = start;
> > +		f_ctx.fc_len = 1;
> 
> Should this be "fc_len = 1 << inode->i_blkbits" to map a single block?

D'oh, yeah, I just re-read fiemap implementation, and yeah, len is supposed to
be byte-sized, not block sized, so you are right. It doesn't really make much
difference here, due the purpose of the fiemap call here, but still it's wrong.
I'll update it on a future review.

> On the one hand, this might return multiple blocks, but on the other
> hand FIBMAP shouldn't be allowed if that is the case so this code should
> detect that situation and consider it an error.

Well, FIEMAP interface is used internally to get the block mapping requested by
the user via FIBMAP, so, yes, FIEMAP  interface will return the whole extent,
but to the user, the ioctl will return just the mapping of the requested block.

Which is basically what we do here:

> > +		*block = (fextent.fe_physical +
> > +			(start - fextent.fe_logical)) >> inode->i_blkbits;
> > +

We only return a single address back, not the whole extent map.


Again, thanks for the review, much appreciated

-- 
Carlos



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux