Skip to content

Commit

Permalink
btrfs: simplify some assignments of inode numbers
Browse files Browse the repository at this point in the history
There are several places when the btrfs inode is converted to the
generic inode, back to btrfs and then passed to btrfs_ino. We can remove
the extra back and forth conversions.

Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
David Sterba committed Aug 6, 2018
1 parent 8f6c72a commit 3750851
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4242,17 +4242,17 @@ static void btrfs_prune_dentries(struct btrfs_root *root)
prev = node;
entry = rb_entry(node, struct btrfs_inode, rb_node);

if (objectid < btrfs_ino(BTRFS_I(&entry->vfs_inode)))
if (objectid < btrfs_ino(entry))
node = node->rb_left;
else if (objectid > btrfs_ino(BTRFS_I(&entry->vfs_inode)))
else if (objectid > btrfs_ino(entry))
node = node->rb_right;
else
break;
}
if (!node) {
while (prev) {
entry = rb_entry(prev, struct btrfs_inode, rb_node);
if (objectid <= btrfs_ino(BTRFS_I(&entry->vfs_inode))) {
if (objectid <= btrfs_ino(entry)) {
node = prev;
break;
}
Expand All @@ -4261,7 +4261,7 @@ static void btrfs_prune_dentries(struct btrfs_root *root)
}
while (node) {
entry = rb_entry(node, struct btrfs_inode, rb_node);
objectid = btrfs_ino(BTRFS_I(&entry->vfs_inode)) + 1;
objectid = btrfs_ino(entry) + 1;
inode = igrab(&entry->vfs_inode);
if (inode) {
spin_unlock(&root->inode_lock);
Expand Down Expand Up @@ -5614,9 +5614,9 @@ static void inode_tree_add(struct inode *inode)
parent = *p;
entry = rb_entry(parent, struct btrfs_inode, rb_node);

if (ino < btrfs_ino(BTRFS_I(&entry->vfs_inode)))
if (ino < btrfs_ino(entry))
p = &parent->rb_left;
else if (ino > btrfs_ino(BTRFS_I(&entry->vfs_inode)))
else if (ino > btrfs_ino(entry))
p = &parent->rb_right;
else {
WARN_ON(!(entry->vfs_inode.i_state &
Expand Down

0 comments on commit 3750851

Please sign in to comment.