On Fri, Aug 02, 2019 at 08:29:02AM -0700, Darrick J. Wong wrote: > It's harder for me to tell when I don't have a branch containing the > final product to look at, 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? That works fine for small, fixed-sized structures. But for large variable sized structures it is very inefficient, as we need to do a possibly large kernel allocation and just copy it on. Thus I told Carlos to follow the readdir model with the ->actor (used to be ->filldir) callback that can fill out the actual kernel or user data directly. Another example of this high-level model is our struct iov_iter used in the I/O path.