public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH v2] btrfs: Document __etree_search
Date: Wed,  5 Jun 2019 14:50:04 +0300	[thread overview]
Message-ID: <20190605115004.2736-1-nborisov@suse.com> (raw)
In-Reply-To: <20190603100602.19362-2-nborisov@suse.com>

The function has a lot of return values and specific conventions making
it cumbersome to understand what's returned. Have a go at documenting
its parameters and return values.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---

* Document 'tree' argument to silence error (Johaness)
* Document that if a range is found then none of the input pointers is 
touched (Qu)
 fs/btrfs/extent_io.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index e56afb826517..d7913f42327c 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -359,6 +359,24 @@ static struct rb_node *tree_insert(struct rb_root *root,
 	return NULL;
 }
 
+/**
+ * __etree_search - searches @tree for an entry that contains @offset. Such
+ * entry would have entry->start <= offset && entry->end >= offset.
+ *
+ * @tree - the tree to search
+ * @offset - offset that should fall within an entry in @tree
+ * @next_ret - pointer to the first entry whose range ends after @offset
+ * @prev - pointer to the first entry whose range begins before @offset
+ * @p_ret - pointer where new node should be anchored (used when inserting an
+ *	    entry in the tree)
+ * @parent_ret - points to entry which would have been the parent of the entry,
+ * containing @offset
+ *
+ * This function returns a pointer to the entry that contains @offset byte
+ * address. If no such entry exists, then NULL is returned and the other
+ * pointer arguments to the function are filled, otherwise the found entry is
+ * return and other pointers are left untouched.
+ */
 static struct rb_node *__etree_search(struct extent_io_tree *tree, u64 offset,
 				      struct rb_node **next_ret,
 				      struct rb_node **prev_ret,
-- 
2.17.1


  parent reply	other threads:[~2019-06-05 11:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 10:05 [PATCH 0/4] Further FITRIM improvements Nikolay Borisov
2019-06-03 10:05 ` [PATCH 1/4] btrfs: Document __etree_search Nikolay Borisov
2019-06-05  8:04   ` Johannes Thumshirn
2019-06-05  9:13   ` Qu Wenruo
2019-06-05 11:50   ` Nikolay Borisov [this message]
2019-06-05 11:51     ` [PATCH v2] " Johannes Thumshirn
2019-06-03 10:06 ` [PATCH 2/4] btrfs: Always trim all unallocated space in btrfs_trim_free_extents Nikolay Borisov
2019-06-05  9:13   ` Qu Wenruo
2019-06-03 10:06 ` [PATCH 3/4] btrfs: Skip first megabyte on device when trimming Nikolay Borisov
2019-06-05  8:06   ` Johannes Thumshirn
2019-06-05  9:14   ` Qu Wenruo
2019-06-05 11:18     ` Nikolay Borisov
2019-06-03 10:06 ` [PATCH 4/4] btrfs: Don't trim returned range based on input value in find_first_clear_extent_bit Nikolay Borisov
2019-06-05  9:25   ` Qu Wenruo
2019-06-07 13:28 ` [PATCH 0/4] Further FITRIM improvements David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190605115004.2736-1-nborisov@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox