Re: [PATCH v5 8/9] btrfs: implement RWF_ENCODED reads

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

 



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.

Also a mention that we're explicitly not handling read repairs and backup copies would be good in the changelog as well. Thanks,

Josef



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux