On Mon, Aug 24, 2020 at 03:54:29PM -0400, Josef Bacik wrote: > On 8/21/20 3:38 AM, Omar Sandoval wrote: > > From: Omar Sandoval <osandov@xxxxxx> > > > > There are 4 main cases: > > > > 1. Inline extents: we copy the data straight out of the extent buffer. > > 2. Hole/preallocated extents: we fill in zeroes. > > 3. Regular, uncompressed extents: we read the sectors we need directly > > from disk. > > 4. Regular, compressed extents: we read the entire compressed extent > > from disk and indicate what subset of the decompressed extent is in > > the file. > > > > This initial implementation simplifies a few things that can be improved > > in the future: > > > > - We hold the inode lock during the operation. > > - Cases 1, 3, and 4 allocate temporary memory to read into before > > copying out to userspace. > > > > Signed-off-by: Omar Sandoval <osandov@xxxxxx> > > > <snip> > > > + tmp = kmalloc(count, GFP_NOFS); > > + if (!tmp) { > > + ret = -ENOMEM; > > + goto out; > > + } > > + read_extent_buffer(leaf, tmp, ptr, count); > > + btrfs_free_path(path); > > Why not just btrfs_release_path(), you're freeing below anyway. Oh that's nicer, fixed. > Also a mention that we're explicitly not handling read repairs and backup > copies would be good in the changelog as well. Thanks, > > Josef Will do, thanks.