Thread (30 messages) 30 messages, 3 authors, 2020-08-25

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

From: Omar Sandoval <osandov@osandov.com>
Date: 2020-08-24 21:24:00
Also in: linux-btrfs, linux-fsdevel

On Mon, Aug 24, 2020 at 03:54:29PM -0400, Josef Bacik wrote:
On 8/21/20 3:38 AM, Omar Sandoval wrote:
quoted
From: Omar Sandoval <redacted>

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 <redacted>

<snip>
quoted
+	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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help