From: Ivan Shapovalov <intelfx100@gmail.com>
To: reiserfs-devel@vger.kernel.org
Cc: Ivan Shapovalov <intelfx100@gmail.com>
Subject: [PATCH 1/3] reiser4: discard: signify non-idempotence of check_free_blocks() by changing its name.
Date: Fri, 13 Feb 2015 08:02:56 +0300 [thread overview]
Message-ID: <1423803778-19698-2-git-send-email-intelfx100@gmail.com> (raw)
In-Reply-To: <1423803778-19698-1-git-send-email-intelfx100@gmail.com>
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/discard.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/fs/reiser4/discard.c b/fs/reiser4/discard.c
index b4cd236..a615b7d 100644
--- a/fs/reiser4/discard.c
+++ b/fs/reiser4/discard.c
@@ -185,8 +185,13 @@ static inline struct list_head *get_next_at(struct list_head *pos,
return pos->next == head ? NULL : pos->next;
}
-static inline int check_free_blocks(const reiser4_block_nr start,
- const reiser4_block_nr len)
+/*
+ * Check if a given block range is free (clean) and allocate it.
+ *
+ * NOTE: this operation is not idempotent.
+ */
+static inline int try_allocate_blocks(const reiser4_block_nr start,
+ const reiser4_block_nr len)
{
/*
* NOTE: we do not use BA_PERMANENT in out allocations
@@ -321,7 +326,7 @@ static int discard_precise_extents(struct list_head *head)
}
else if (p_start >= p_headp /* discard unit is complete */ &&
!headp_is_known_dirty &&
- check_free_blocks(start - headp, headp)) {
+ try_allocate_blocks(start - headp, headp)) {
/*
* pad the head
*/
@@ -379,7 +384,7 @@ static int discard_precise_extents(struct list_head *head)
* check space between the extents;
* if it is free, then allocate it
*/
- if (check_free_blocks(end, next_start - end)) {
+ if (try_allocate_blocks(end, next_start - end)) {
/*
* jump to the glued extent
*/
@@ -422,7 +427,7 @@ static int discard_precise_extents(struct list_head *head)
*/
if (tailp == 0)
break;
- else if (check_free_blocks(end, tailp)) {
+ else if (try_allocate_blocks(end, tailp)) {
/*
* tail padding is clean,
* pad the tail
--
2.3.0
next prev parent reply other threads:[~2015-02-13 5:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-13 5:02 [PATCH 0/3] reiser4: precise discard: fixes on top of everything Ivan Shapovalov
2015-02-13 5:02 ` Ivan Shapovalov [this message]
2015-02-13 5:02 ` [PATCH 2/3] reiser4: discard: avoid checking same blocks multiple times Ivan Shapovalov
2015-02-13 9:04 ` Edward Shishkin
2015-02-13 5:02 ` [PATCH 3/3] reiser4: discard: handle incomplete erase units at the end of a partition Ivan Shapovalov
2015-02-13 9:05 ` Edward Shishkin
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=1423803778-19698-2-git-send-email-intelfx100@gmail.com \
--to=intelfx100@gmail.com \
--cc=reiserfs-devel@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;
as well as URLs for NNTP newsgroup(s).