> > > > > > Why doesn't this function just call fiemap_fill_kernel_extent to fill > > > out the onstack @extent structure? We've now implemented "fill out out > > > a struct fiemap_extent" twice. > > > > fiemap_fill_{user, kernel}_extent() have different purposes, and the big > > difference is one handles a userspace pointer memory and the other don't. IIRC > > the original proposal was some sort of sharing a single function, but then > > Christoph suggested a new design, using different functions as callbacks. > > It's harder for me to tell when I don't have a branch containing the > final product to look at, Good, I though I was the only one having issues with it :) You can see the work here: https://github.com/cmaiolino/linux/commits/FIEMAP_V5 ^ This already includes changes addressing your concerns as we discussed int this thread btw. > but I'd have thought that _fill_kernel fills > out an in-kernel fiemap extent; and then _fill_user would declare one on > the stack, call _fill_kernel to set the fields, and then copy_to_user? None of those functions will declare a fiemap_extent, the fiemap extent will be declared before (in ioctl_fiemap() or bmap_fiemap()) calling either function and then passed to the proper callback via fieinfo.fi_cb_data. This will be a user or a kernel memory address, and the callbacks will handle the memory accordingly. Cheers -- Carlos