Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f277d01 authored by Martijn Coenen's avatar Martijn Coenen
Browse files

BACKPORT: loop: Remove figure_loop_size()



This function was now only used by loop_set_capacity(). Just open code
the remaining code in the caller instead.

Signed-off-by: default avatarMartijn Coenen <maco@android.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
(cherry picked from commit 0a6ed1b5ff6757f11ad2d57906ceb40488a5ee52)
Bug: 148607611
Change-Id: Icc5ef56a5f0264b9bfa15fbbe8062a74a59d88cb
parent 94ae498c
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -240,14 +240,6 @@ static void loop_set_size(struct loop_device *lo, loff_t size)
	kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
}

static void
figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit)
{
	loff_t size = get_size(offset, sizelimit, lo->lo_backing_file);

	loop_set_size(lo, size);
}

static inline int
lo_do_transfer(struct loop_device *lo, int cmd,
	       struct page *rpage, unsigned roffs,
@@ -1164,6 +1156,8 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
	if (err)
		goto exit;

	lo->lo_offset = info->lo_offset;
	lo->lo_sizelimit = info->lo_sizelimit;
	memcpy(lo->lo_file_name, info->lo_file_name, LO_NAME_SIZE);
	memcpy(lo->lo_crypt_name, info->lo_crypt_name, LO_NAME_SIZE);
	lo->lo_file_name[LO_NAME_SIZE-1] = 0;
@@ -1352,10 +1346,13 @@ loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) {

static int loop_set_capacity(struct loop_device *lo, struct block_device *bdev)
{
	loff_t size;

	if (unlikely(lo->lo_state != Lo_bound))
		return -ENXIO;

	figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit);
	size = get_loop_size(lo, lo->lo_backing_file);
	loop_set_size(lo, size);

	return 0;
}