From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 7/8] btrfs: Rename find_oldest_super_backup to init_backup_root_slot
Date: Tue, 15 Oct 2019 18:42:23 +0300 [thread overview]
Message-ID: <20191015154224.21537-8-nborisov@suse.com> (raw)
In-Reply-To: <20191015154224.21537-1-nborisov@suse.com>
The old name name was an awful misnomer because it didn't really find
the oldest super backup per se but rather its slot. For example if we
have:
slot0: gen - 2
slot1: gen - 1
slot2: gen
slot3: empty
init_backup_root_slot will return slot3 and not slot0.
The new name is more appropriate since the function doesn't care whether
there is a valid backup in the returned slot or not.
---
fs/btrfs/disk-io.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index bcb21a35d30c..ac899fdb1414 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1786,13 +1786,11 @@ static int find_newest_super_backup(struct btrfs_fs_info *info)
return -EINVAL;
}
-
/*
- * find the oldest backup so we know where to store new entries
- * in the backup array. This will set the backup_root_index
- * field in the fs_info struct
+ * Initialize backup_root_index with the next available slot, where subsequent
+ * transaction commit will store the back up root
*/
-static void find_oldest_super_backup(struct btrfs_fs_info *info)
+static void init_backup_root_slot(struct btrfs_fs_info *info)
{
int newest_index;
@@ -2904,7 +2902,7 @@ int __cold open_ctree(struct super_block *sb,
* run through our array of backup supers and setup
* our ring pointer to the oldest one
*/
- find_oldest_super_backup(fs_info);
+ init_backup_root_slot(fs_info);
/*
* In the long term, we'll store the compression type in the super
--
2.17.1
next prev parent reply other threads:[~2019-10-15 15:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 15:42 [PATCH 0/8] tree reading cleanups in mount Nikolay Borisov
2019-10-15 15:42 ` [PATCH 1/8] btrfs: Cleanup and simplify find_newest_super_backup Nikolay Borisov
2019-10-17 13:56 ` David Sterba
2019-10-15 15:42 ` [PATCH 2/8] btrfs: Remove newest_gen argument from find_oldest_super_backup Nikolay Borisov
2019-10-15 15:42 ` [PATCH 3/8] btrfs: Add read_backup_root Nikolay Borisov
2019-10-15 15:42 ` [PATCH 4/8] btrfs: Factor out tree roots initialization during mount Nikolay Borisov
2019-10-15 15:42 ` [PATCH 5/8] btrfs: Don't use objectid_mutex " Nikolay Borisov
2019-10-15 15:42 ` [PATCH 6/8] btrfs: Remove unused next_root_backup function Nikolay Borisov
2019-10-15 15:42 ` Nikolay Borisov [this message]
2019-10-15 15:42 ` [PATCH 8/8] btrfs: Streamline btrfs_fs_info::backup_root_index semantics Nikolay Borisov
2019-10-29 16:42 ` [PATCH 0/8] tree reading cleanups in mount 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=20191015154224.21537-8-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;
as well as URLs for NNTP newsgroup(s).