Skip to content

Commit

Permalink
fs/aio.c: eliminate redundant loads in put_aio_ring_file
Browse files Browse the repository at this point in the history
Using a local variable we can prevent gcc from reloading
aio_ring_file->f_inode->i_mapping twice, eliminating 2x2 dependent
loads.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Rasmus Villemoes authored and Al Viro committed Sep 28, 2016
1 parent be218aa commit de04e76
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,17 @@ __initcall(aio_setup);
static void put_aio_ring_file(struct kioctx *ctx)
{
struct file *aio_ring_file = ctx->aio_ring_file;
struct address_space *i_mapping;

if (aio_ring_file) {
truncate_setsize(aio_ring_file->f_inode, 0);

/* Prevent further access to the kioctx from migratepages */
spin_lock(&aio_ring_file->f_inode->i_mapping->private_lock);
aio_ring_file->f_inode->i_mapping->private_data = NULL;
i_mapping = aio_ring_file->f_inode->i_mapping;
spin_lock(&i_mapping->private_lock);
i_mapping->private_data = NULL;
ctx->aio_ring_file = NULL;
spin_unlock(&aio_ring_file->f_inode->i_mapping->private_lock);
spin_unlock(&i_mapping->private_lock);

fput(aio_ring_file);
}
Expand Down

0 comments on commit de04e76

Please sign in to comment.