mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
btrfs: move need_log_inode() to above log_conflicting_inodes()
The static function need_log_inode() is defined below btrfs_log_inode() and log_conflicting_inodes(), but in the next patches in the series we will need to call need_log_inode() in a couple new functions that will be used by btrfs_log_inode(). So move its definition to a location above log_conflicting_inodes(). Also make its arguments 'const', since they are not supposed to be modified. Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
193df62457
commit
a375102426
|
|
@ -5425,6 +5425,41 @@ static int btrfs_check_ref_name_override(struct extent_buffer *eb,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if we need to log an inode. This is used in contexts where while
|
||||
* logging an inode we need to log another inode (either that it exists or in
|
||||
* full mode). This is used instead of btrfs_inode_in_log() because the later
|
||||
* requires the inode to be in the log and have the log transaction committed,
|
||||
* while here we do not care if the log transaction was already committed - our
|
||||
* caller will commit the log later - and we want to avoid logging an inode
|
||||
* multiple times when multiple tasks have joined the same log transaction.
|
||||
*/
|
||||
static bool need_log_inode(const struct btrfs_trans_handle *trans,
|
||||
const struct btrfs_inode *inode)
|
||||
{
|
||||
/*
|
||||
* If a directory was not modified, no dentries added or removed, we can
|
||||
* and should avoid logging it.
|
||||
*/
|
||||
if (S_ISDIR(inode->vfs_inode.i_mode) && inode->last_trans < trans->transid)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* If this inode does not have new/updated/deleted xattrs since the last
|
||||
* time it was logged and is flagged as logged in the current transaction,
|
||||
* we can skip logging it. As for new/deleted names, those are updated in
|
||||
* the log by link/unlink/rename operations.
|
||||
* In case the inode was logged and then evicted and reloaded, its
|
||||
* logged_trans will be 0, in which case we have to fully log it since
|
||||
* logged_trans is a transient field, not persisted.
|
||||
*/
|
||||
if (inode->logged_trans == trans->transid &&
|
||||
!test_bit(BTRFS_INODE_COPY_EVERYTHING, &inode->runtime_flags))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct btrfs_ino_list {
|
||||
u64 ino;
|
||||
u64 parent;
|
||||
|
|
@ -6061,41 +6096,6 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if we need to log an inode. This is used in contexts where while
|
||||
* logging an inode we need to log another inode (either that it exists or in
|
||||
* full mode). This is used instead of btrfs_inode_in_log() because the later
|
||||
* requires the inode to be in the log and have the log transaction committed,
|
||||
* while here we do not care if the log transaction was already committed - our
|
||||
* caller will commit the log later - and we want to avoid logging an inode
|
||||
* multiple times when multiple tasks have joined the same log transaction.
|
||||
*/
|
||||
static bool need_log_inode(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_inode *inode)
|
||||
{
|
||||
/*
|
||||
* If a directory was not modified, no dentries added or removed, we can
|
||||
* and should avoid logging it.
|
||||
*/
|
||||
if (S_ISDIR(inode->vfs_inode.i_mode) && inode->last_trans < trans->transid)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* If this inode does not have new/updated/deleted xattrs since the last
|
||||
* time it was logged and is flagged as logged in the current transaction,
|
||||
* we can skip logging it. As for new/deleted names, those are updated in
|
||||
* the log by link/unlink/rename operations.
|
||||
* In case the inode was logged and then evicted and reloaded, its
|
||||
* logged_trans will be 0, in which case we have to fully log it since
|
||||
* logged_trans is a transient field, not persisted.
|
||||
*/
|
||||
if (inode->logged_trans == trans->transid &&
|
||||
!test_bit(BTRFS_INODE_COPY_EVERYTHING, &inode->runtime_flags))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct btrfs_dir_list {
|
||||
u64 ino;
|
||||
struct list_head list;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user