A future device-mapper patch will make use of this new argument. No functional changes intended in this patch. Suggested-by: Damien Le Moal <dlemoal@xxxxxxxxxx> Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> --- block/blk-settings.c | 9 +++++++-- drivers/md/dm-table.c | 2 +- drivers/md/md-linear.c | 2 +- drivers/md/raid0.c | 2 +- drivers/md/raid1.c | 2 +- drivers/md/raid10.c | 2 +- drivers/md/raid5.c | 2 +- include/linux/blkdev.h | 3 ++- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index c44dadc35e1e..bad690ef8fec 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -476,16 +476,21 @@ EXPORT_SYMBOL_GPL(queue_limits_commit_update_frozen); * queue_limits_set - apply queue limits to queue * @q: queue to update * @lim: limits to apply + * @old_lim: store previous limits if non-null. * - * Apply the limits in @lim that were freshly initialized to @q. + * Apply the limits in @lim that were freshly initialized to @q, and + * optionally return the previous limits in @old_lim. * To update existing limits use queue_limits_start_update() and * queue_limits_commit_update() instead. * * Returns 0 if successful, else a negative error code. */ -int queue_limits_set(struct request_queue *q, struct queue_limits *lim) +int queue_limits_set(struct request_queue *q, struct queue_limits *lim, + struct queue_limits *old_lim) { mutex_lock(&q->limits_lock); + if (old_lim) + *old_lim = q->limits; return queue_limits_commit_update(q, lim); } EXPORT_SYMBOL_GPL(queue_limits_set); diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 0ef5203387b2..77d8459b2f2a 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1883,7 +1883,7 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, if (dm_table_supports_atomic_writes(t)) limits->features |= BLK_FEAT_ATOMIC_WRITES; - r = queue_limits_set(q, limits); + r = queue_limits_set(q, limits, NULL); if (r) return r; diff --git a/drivers/md/md-linear.c b/drivers/md/md-linear.c index a382929ce7ba..65ceec5b078f 100644 --- a/drivers/md/md-linear.c +++ b/drivers/md/md-linear.c @@ -81,7 +81,7 @@ static int linear_set_limits(struct mddev *mddev) return err; } - return queue_limits_set(mddev->gendisk->queue, &lim); + return queue_limits_set(mddev->gendisk->queue, &lim, NULL); } static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks) diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 8fc9339b00c7..2eb42b2c103b 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -390,7 +390,7 @@ static int raid0_set_limits(struct mddev *mddev) queue_limits_cancel_update(mddev->gendisk->queue); return err; } - return queue_limits_set(mddev->gendisk->queue, &lim); + return queue_limits_set(mddev->gendisk->queue, &lim, NULL); } static int raid0_run(struct mddev *mddev) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 9d57a88dbd26..e8103dbc549c 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -3223,7 +3223,7 @@ static int raid1_set_limits(struct mddev *mddev) queue_limits_cancel_update(mddev->gendisk->queue); return err; } - return queue_limits_set(mddev->gendisk->queue, &lim); + return queue_limits_set(mddev->gendisk->queue, &lim, NULL); } static int raid1_run(struct mddev *mddev) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index efe93b979167..dbc2ee70d0d3 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -4024,7 +4024,7 @@ static int raid10_set_queue_limits(struct mddev *mddev) queue_limits_cancel_update(mddev->gendisk->queue); return err; } - return queue_limits_set(mddev->gendisk->queue, &lim); + return queue_limits_set(mddev->gendisk->queue, &lim, NULL); } static int raid10_run(struct mddev *mddev) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 5c79429acc64..a7cc2ec86793 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7774,7 +7774,7 @@ static int raid5_set_limits(struct mddev *mddev) /* No restrictions on the number of segments in the request */ lim.max_segments = USHRT_MAX; - return queue_limits_set(mddev->gendisk->queue, &lim); + return queue_limits_set(mddev->gendisk->queue, &lim, NULL); } static int raid5_run(struct mddev *mddev) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 248416ecd01c..bb264fd7b2f2 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -953,7 +953,8 @@ int queue_limits_commit_update_frozen(struct request_queue *q, struct queue_limits *lim); int queue_limits_commit_update(struct request_queue *q, struct queue_limits *lim); -int queue_limits_set(struct request_queue *q, struct queue_limits *lim); +int queue_limits_set(struct request_queue *q, struct queue_limits *lim, + struct queue_limits *old_lim); int blk_validate_limits(struct queue_limits *lim); /** -- 2.48.1