Merge a781ffe410 ("loop: factor out a loop_assign_backing_file helper") into android16-6.12-lts
Steps on the way to 6.12.29 Change-Id: I6c4f253048ee20e8f0f510cb211a4899c8baaa6b Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
+10
-10
@@ -500,6 +500,14 @@ static int loop_validate_file(struct file *file, struct block_device *bdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void loop_assign_backing_file(struct loop_device *lo, struct file *file)
|
||||||
|
{
|
||||||
|
lo->lo_backing_file = file;
|
||||||
|
lo->old_gfp_mask = mapping_gfp_mask(file->f_mapping);
|
||||||
|
mapping_set_gfp_mask(file->f_mapping,
|
||||||
|
lo->old_gfp_mask & ~(__GFP_IO | __GFP_FS));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* loop_change_fd switched the backing store of a loopback device to
|
* loop_change_fd switched the backing store of a loopback device to
|
||||||
* a new file. This is useful for operating system installers to free up
|
* a new file. This is useful for operating system installers to free up
|
||||||
@@ -552,10 +560,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
|
|||||||
disk_force_media_change(lo->lo_disk);
|
disk_force_media_change(lo->lo_disk);
|
||||||
blk_mq_freeze_queue(lo->lo_queue);
|
blk_mq_freeze_queue(lo->lo_queue);
|
||||||
mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
|
mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
|
||||||
lo->lo_backing_file = file;
|
loop_assign_backing_file(lo, file);
|
||||||
lo->old_gfp_mask = mapping_gfp_mask(file->f_mapping);
|
|
||||||
mapping_set_gfp_mask(file->f_mapping,
|
|
||||||
lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
|
|
||||||
loop_update_dio(lo);
|
loop_update_dio(lo);
|
||||||
blk_mq_unfreeze_queue(lo->lo_queue);
|
blk_mq_unfreeze_queue(lo->lo_queue);
|
||||||
partscan = lo->lo_flags & LO_FLAGS_PARTSCAN;
|
partscan = lo->lo_flags & LO_FLAGS_PARTSCAN;
|
||||||
@@ -947,7 +952,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
|
|||||||
const struct loop_config *config)
|
const struct loop_config *config)
|
||||||
{
|
{
|
||||||
struct file *file = fget(config->fd);
|
struct file *file = fget(config->fd);
|
||||||
struct address_space *mapping;
|
|
||||||
struct queue_limits lim;
|
struct queue_limits lim;
|
||||||
int error;
|
int error;
|
||||||
loff_t size;
|
loff_t size;
|
||||||
@@ -983,8 +987,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
|
|||||||
if (error)
|
if (error)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
mapping = file->f_mapping;
|
|
||||||
|
|
||||||
if ((config->info.lo_flags & ~LOOP_CONFIGURE_SETTABLE_FLAGS) != 0) {
|
if ((config->info.lo_flags & ~LOOP_CONFIGURE_SETTABLE_FLAGS) != 0) {
|
||||||
error = -EINVAL;
|
error = -EINVAL;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
@@ -1016,9 +1018,7 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
|
|||||||
|
|
||||||
lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO;
|
lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO;
|
||||||
lo->lo_device = bdev;
|
lo->lo_device = bdev;
|
||||||
lo->lo_backing_file = file;
|
loop_assign_backing_file(lo, file);
|
||||||
lo->old_gfp_mask = mapping_gfp_mask(mapping);
|
|
||||||
mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
|
|
||||||
|
|
||||||
lim = queue_limits_start_update(lo->lo_queue);
|
lim = queue_limits_start_update(lo->lo_queue);
|
||||||
loop_update_limits(lo, &lim, config->block_size);
|
loop_update_limits(lo, &lim, config->block_size);
|
||||||
|
|||||||
Reference in New Issue
Block a user