From: David Sterba <dsterba@suse.cz>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.cz>
Subject: [PATCH 2/6 v2] btrfs: do commit in sync_fs if there are pending changes
Date: Fri, 14 Nov 2014 13:34:44 +0100 [thread overview]
Message-ID: <1415968484-9648-1-git-send-email-dsterba@suse.cz> (raw)
In-Reply-To: <6b5fe46dfa52441f49c7432b1c1b1cb767834708.1415894837.git.dsterba@suse.cz>
If a pending change is requested, it's not processed unless there is a
transaction commit about to happen, not even after sync or SYNC_FS
ioctl. For example a remount that toggles the inode_cache option will
not take effect after sync on a quiescent filesystem.
Signed-off-by: David Sterba <dsterba@suse.cz>
---
v2: catch error from btrfs_start_transaction
fs/btrfs/super.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 54bd91ece35b..0cf589402d8d 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -993,9 +993,17 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
trans = btrfs_attach_transaction_barrier(root);
if (IS_ERR(trans)) {
/* no transaction, don't bother */
- if (PTR_ERR(trans) == -ENOENT)
- return 0;
- return PTR_ERR(trans);
+ if (PTR_ERR(trans) == -ENOENT) {
+ /*
+ * Exit unless we have some pending changes
+ * that need to go through commit
+ */
+ if (fs_info->pending_changes == 0)
+ return 0;
+ trans = btrfs_start_transaction(root, 0);
+ }
+ if (IS_ERR(trans))
+ return PTR_ERR(trans);
}
return btrfs_commit_transaction(trans, root);
}
--
2.1.3
next prev parent reply other threads:[~2014-11-14 12:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 10:33 [PULL] [PATCH 0/6] Support for 'pending changes' David Sterba
2014-11-14 10:33 ` [PATCH 1/6] btrfs: add support for processing pending changes David Sterba
2015-01-20 4:24 ` Qu Wenruo
2014-11-14 10:33 ` [PATCH 2/6] btrfs: do commit in sync_fs if there are " David Sterba
2014-11-14 10:51 ` Filipe David Manana
2014-11-14 12:34 ` David Sterba [this message]
2015-01-16 13:29 ` [PATCH 2/6 v2] " Filipe David Manana
2014-11-14 10:33 ` [PATCH 3/6] btrfs: switch inode_cache option handling to " David Sterba
2014-11-14 10:33 ` [PATCH 4/6] btrfs: introduce pending action: commit David Sterba
2014-11-14 10:33 ` [PATCH 5/6] btrfs: move commit out of sysfs when changing features David Sterba
2014-11-14 10:33 ` [PATCH 6/6] btrfs: move commit out of sysfs when changing label 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=1415968484-9648-1-git-send-email-dsterba@suse.cz \
--to=dsterba@suse.cz \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.