diff mbox series

[6/8] loop: remove extra variable in lo_fallocate()

Message ID 20210921092123.13632-7-chaitanyak@nvidia.com (mailing list archive)
State New, archived
Headers show
Series loop: small clenaup | expand

Commit Message

Chaitanya Kulkarni Sept. 21, 2021, 9:21 a.m. UTC
From: Chaitanya Kulkarni <kch@nvidia.com>

The local variable q is used to pass it to the blk_queue_discard(). We
can get away with using lo->lo_queue instead of storing in a local
variable which is not used anywhere else.

No functional change in this patch.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/block/loop.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Himanshu Madhani Sept. 21, 2021, 1:36 p.m. UTC | #1
> On Sep 21, 2021, at 4:21 AM, Chaitanya Kulkarni <chaitanyak@nvidia.com> wrote:
> 
> From: Chaitanya Kulkarni <kch@nvidia.com>
> 
> The local variable q is used to pass it to the blk_queue_discard(). We
> can get away with using lo->lo_queue instead of storing in a local
> variable which is not used anywhere else.
> 
> No functional change in this patch.
> 
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
> drivers/block/loop.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index fedb8d63b4c6..51c42788731a 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -480,12 +480,11 @@ static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos,
> 	 * information.
> 	 */
> 	struct file *file = lo->lo_backing_file;
> -	struct request_queue *q = lo->lo_queue;
> 	int ret;
> 
> 	mode |= FALLOC_FL_KEEP_SIZE;
> 
> -	if (!blk_queue_discard(q)) {
> +	if (!blk_queue_discard(lo->lo_queue)) {
> 		ret = -EOPNOTSUPP;
> 		goto out;
> 	}
> -- 
> 2.29.0
> 

Looks good.

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
--
Himanshu Madhani	 Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index fedb8d63b4c6..51c42788731a 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -480,12 +480,11 @@  static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos,
 	 * information.
 	 */
 	struct file *file = lo->lo_backing_file;
-	struct request_queue *q = lo->lo_queue;
 	int ret;
 
 	mode |= FALLOC_FL_KEEP_SIZE;
 
-	if (!blk_queue_discard(q)) {
+	if (!blk_queue_discard(lo->lo_queue)) {
 		ret = -EOPNOTSUPP;
 		goto out;
 	}