Thread (4 messages) 4 messages, 3 authors, 2021-07-28

Re: [PATCH] btrfs: Introduce btrfs_search_backwards function

From: David Sterba <hidden>
Date: 2021-07-28 17:50:18

On Wed, Jul 28, 2021 at 01:41:30PM -0300, Marcos Paulo de Souza wrote:
On Wed, 2021-07-28 at 15:10 +0200, David Sterba wrote:
quoted
On Mon, Jul 26, 2021 at 11:03:17AM -0300, Marcos Paulo de Souza
wrote:
quoted
+/*
+ * Execute search and call btrfs_previous_item to traverse
backwards if the item
+ * was not found. If found, convert the stored item to the correct
endianness.
+ *
+ * Return 0 if found, 1 if not found and < 0 if error.
+ */
+int btrfs_search_backwards(struct btrfs_root *root,
+				struct btrfs_key *key,
+				struct btrfs_key *found_key,
Is it necessary to have 2 keys? All calls pass the same one, so
either
this should be just one or you have other patches that make use of
two
distinct keys?
Yes, in these cases yes, but I can see sometimes other places in the
btrfs codebase where the key used convert to cpu is different from the
key used in the search path, so I wanted to make it flexible to future
users.
We can do that once there's need for this flexibility.
I believe that we can extent this in the future if needed, so
I'll send a v2 using only one key argument, and use the same argument
to convert to the correct endianness.
Thanks, you can also drop the notices about endianness because that's
assumed that all keys normally used are ind the CPU order, the disk keys
are explicitly called 'disk_key' as their use is limited.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help