reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Shapovalov <intelfx100@gmail.com>
To: reiserfs-devel@vger.kernel.org
Cc: Ivan Shapovalov <intelfx100@gmail.com>
Subject: [PATCHv5 06/10] reiser4: txnmgr: move "empty atom" shortcut slightly below.
Date: Fri, 13 Feb 2015 03:48:15 +0300	[thread overview]
Message-ID: <1423788499-30430-7-git-send-email-intelfx100@gmail.com> (raw)
In-Reply-To: <1423788499-30430-1-git-send-email-intelfx100@gmail.com>

reiser4_trim_fs() generate empty (atom->capture_count == 0) atoms which
still have non-empty delete sets. That is, such atoms take a "goto done"
shortcut in commit_current_atom().

First, this shortcut must not preclude calling current_atom_complete_writes()
to process and detach atom's flush queues (otherwise atom_isclean() will
return false).

Second, reiser4_post_write_back_hook() needs to be called explicitly
to process atom's delete sets.

Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
 fs/reiser4/txnmgr.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/fs/reiser4/txnmgr.c b/fs/reiser4/txnmgr.c
index 2862940..5084722 100644
--- a/fs/reiser4/txnmgr.c
+++ b/fs/reiser4/txnmgr.c
@@ -1064,9 +1064,6 @@ static int commit_current_atom(long *nr_submitted, txn_atom ** atom)
 		return RETERR(-E_REPEAT);
 	}
 
-	if ((*atom)->capture_count == 0)
-		goto done;
-
 	/* Up to this point we have been flushing and after flush is called we
 	   return -E_REPEAT.  Now we can commit.  We cannot return -E_REPEAT
 	   at this point, commit should be successful. */
@@ -1078,6 +1075,14 @@ static int commit_current_atom(long *nr_submitted, txn_atom ** atom)
 	if (ret)
 		return ret;
 
+	if ((*atom)->capture_count == 0) {
+		/* Process the atom's delete set.
+		 * Even if the atom has no captured nodes, the delete set may
+		 * still be non-empty (see e. g. reiser4_trim_fs()). */
+		reiser4_post_write_back_hook();
+		goto done;
+	}
+
 	assert("zam-906", list_empty(ATOM_WB_LIST(*atom)));
 
 	/* isolate critical code path which should be executed by only one
@@ -1100,8 +1105,8 @@ static int commit_current_atom(long *nr_submitted, txn_atom ** atom)
 	reiser4_invalidate_list(ATOM_WB_LIST(*atom));
 	assert("zam-927", list_empty(&(*atom)->inodes));
 
+done:
 	spin_lock_atom(*atom);
- done:
 	reiser4_atom_set_stage(*atom, ASTAGE_DONE);
 	ON_DEBUG((*atom)->committer = NULL);
 
-- 
2.3.0


  parent reply	other threads:[~2015-02-13  0:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13  0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
2015-02-13  0:48 ` [PATCHv5 01/10] reiser4: block_alloc: add BA_SOME_SPACE flag for grabbing a fixed amount of space Ivan Shapovalov
2015-02-13  0:48 ` [PATCHv5 02/10] reiser4: block_alloc: add a "monotonic_forward" parameter to reiser4_blocknr_hint to allocate blocks only in forward direction Ivan Shapovalov
2015-02-13  0:48 ` [PATCHv5 03/10] reiser4: block_alloc: move block accounting by pre-commit hook into block_alloc.c and document BA_DEFER behavior Ivan Shapovalov
2015-02-13  0:48 ` [PATCHv5 04/10] reiser4: txnmgr: free allocated but unneeded atom in atom_begin_and_assign_to_txnh() Ivan Shapovalov
2015-02-13  0:48 ` [PATCHv5 05/10] reiser4: txnmgr: add reiser4_create_atom() which creates an empty atom without capturing any nodes Ivan Shapovalov
2015-02-13  0:48 ` Ivan Shapovalov [this message]
2015-02-13  0:48 ` [PATCHv5 07/10] reiser4: batch discard support: add a dummy FITRIM ioctl handler for directories Ivan Shapovalov
2015-02-13  0:48 ` [PATCHv5 08/10] reiser4: batch discard support: actually implement the FITRIM ioctl handler Ivan Shapovalov
2015-02-13  0:48 ` [PATCHv5 09/10] reiser4: block_alloc: add a "min_len" parameter to reiser4_blocknr_hint to limit allocated extent length from below Ivan Shapovalov
2015-02-13  0:48 ` [PATCHv5 10/10] reiser4: batch discard support: honor minimal extent length passed from the userspace Ivan Shapovalov
2015-02-13  2:11 ` When is the patch set included in the reiser4-for-3.x... release ? doiggl
2015-02-13  3:01   ` Ivan Shapovalov
2015-02-13  5:08     ` help with testing doiggl
2015-02-13  9:39 ` [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov

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=1423788499-30430-7-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).