On Mon, Nov 19, 2018 at 01:50:28PM +0100, Carlos Maiolino wrote: > On Fri, Nov 16, 2018 at 05:06:43PM +0100, Christoph Hellwig wrote: > > On Tue, Oct 30, 2018 at 02:18:21PM +0100, Carlos Maiolino wrote: > > > + 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; > > > + f_ctx.fc_flags = 0; > > > + f_ctx.fc_cb = fiemap_fill_kernel_extent; > > > + > > > + error = inode->i_op->fiemap(inode, &f_ctx); > > > + > > > + if (error) > > > + goto out; > > > + > > > + *block = (fextent.fe_physical + > > > + (start - fextent.fe_logical)) >> inode->i_blkbits; > > > + > > > > I think this code needs to be split into a helper. > > > > Yup, my idea is to try to reduce as much as possible the shared code between > usr/kernel helpers, I just didn't want to spend more time thinking about it > without having a review of the overall design :P Well, the code in this branch should not change at all by being moved into a helper function..