Commit f1e81ba8 authored by Jan Kara's avatar Jan Kara Committed by Greg Kroah-Hartman

loop: Fold __loop_release into loop_release

commit 967d1dc1 upstream.

__loop_release() has a single call site. Fold it there. This is
currently not a huge win but it will make following replacement of
loop_index_mutex more obvious.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 57da9a97
...@@ -1603,12 +1603,15 @@ static int lo_open(struct block_device *bdev, fmode_t mode) ...@@ -1603,12 +1603,15 @@ static int lo_open(struct block_device *bdev, fmode_t mode)
return err; return err;
} }
static void __lo_release(struct loop_device *lo) static void lo_release(struct gendisk *disk, fmode_t mode)
{ {
struct loop_device *lo;
int err; int err;
mutex_lock(&loop_index_mutex);
lo = disk->private_data;
if (atomic_dec_return(&lo->lo_refcnt)) if (atomic_dec_return(&lo->lo_refcnt))
return; goto unlock_index;
mutex_lock(&loop_ctl_mutex); mutex_lock(&loop_ctl_mutex);
if (lo->lo_flags & LO_FLAGS_AUTOCLEAR) { if (lo->lo_flags & LO_FLAGS_AUTOCLEAR) {
...@@ -1618,7 +1621,7 @@ static void __lo_release(struct loop_device *lo) ...@@ -1618,7 +1621,7 @@ static void __lo_release(struct loop_device *lo)
*/ */
err = loop_clr_fd(lo); err = loop_clr_fd(lo);
if (!err) if (!err)
return; goto unlock_index;
} else if (lo->lo_state == Lo_bound) { } else if (lo->lo_state == Lo_bound) {
/* /*
* Otherwise keep thread (if running) and config, * Otherwise keep thread (if running) and config,
...@@ -1629,12 +1632,7 @@ static void __lo_release(struct loop_device *lo) ...@@ -1629,12 +1632,7 @@ static void __lo_release(struct loop_device *lo)
} }
mutex_unlock(&loop_ctl_mutex); mutex_unlock(&loop_ctl_mutex);
} unlock_index:
static void lo_release(struct gendisk *disk, fmode_t mode)
{
mutex_lock(&loop_index_mutex);
__lo_release(disk->private_data);
mutex_unlock(&loop_index_mutex); mutex_unlock(&loop_index_mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment