All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Richard Weinberger <richard@nod.at>,
	Anton Ivanov <anton.ivanov@cambridgegreys.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Jens Axboe <axboe@kernel.dk>
Cc: linux-um@lists.infradead.org, linux-block@vger.kernel.org
Subject: [PATCH 4/7] ubd: move setting the variable queue limits to ubd_add
Date: Thu, 22 Feb 2024 08:24:14 +0100	[thread overview]
Message-ID: <20240222072417.3773131-5-hch@lst.de> (raw)
In-Reply-To: <20240222072417.3773131-1-hch@lst.de>

No reason to delay this until open time.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/um/drivers/ubd_kern.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 9dcf41f7d49606..26bc8306356263 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -772,8 +772,6 @@ static int ubd_open_dev(struct ubd *ubd_dev)
 	ubd_dev->fd = fd;
 
 	if(ubd_dev->cow.file != NULL){
-		blk_queue_max_hw_sectors(ubd_dev->queue, 8 * sizeof(long));
-
 		err = -ENOMEM;
 		ubd_dev->cow.bitmap = vmalloc(ubd_dev->cow.bitmap_len);
 		if(ubd_dev->cow.bitmap == NULL){
@@ -795,10 +793,6 @@ static int ubd_open_dev(struct ubd *ubd_dev)
 		if(err < 0) goto error;
 		ubd_dev->cow.fd = err;
 	}
-	if (ubd_dev->no_trim == 0) {
-		blk_queue_max_discard_sectors(ubd_dev->queue, UBD_MAX_REQUEST);
-		blk_queue_max_write_zeroes_sectors(ubd_dev->queue, UBD_MAX_REQUEST);
-	}
 	return 0;
  error:
 	os_close_file(ubd_dev->fd);
@@ -867,6 +861,13 @@ static int ubd_add(int n, char **error_out)
 	if(ubd_dev->file == NULL)
 		goto out;
 
+	if (ubd_dev->cow.file)
+		lim.max_hw_sectors = 8 * sizeof(long);
+	if (!ubd_dev->no_trim) {
+		lim.max_hw_discard_sectors = UBD_MAX_REQUEST;
+		lim.max_write_zeroes_sectors = UBD_MAX_REQUEST;
+	}
+
 	err = ubd_file_size(ubd_dev, &ubd_dev->size);
 	if(err < 0){
 		*error_out = "Couldn't determine size of device's file";
-- 
2.39.2


  parent reply	other threads:[~2024-02-22  7:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22  7:24 ubd cleanups Christoph Hellwig
2024-02-22  7:24 ` [PATCH 1/7] ubd: remove the ubd_gendisk array Christoph Hellwig
2024-02-27 20:52   ` Richard Weinberger
2024-02-22  7:24 ` [PATCH 2/7] ubd: remove ubd_disk_register Christoph Hellwig
2024-02-27 20:56   ` Richard Weinberger
2024-02-22  7:24 ` [PATCH 3/7] ubd: move setting the nonrot flag to ubd_add Christoph Hellwig
2024-02-27 20:56   ` Richard Weinberger
2024-02-22  7:24 ` Christoph Hellwig [this message]
2024-02-27 21:00   ` [PATCH 4/7] ubd: move setting the variable queue limits " Richard Weinberger
2024-02-22  7:24 ` [PATCH 5/7] ubd: move set_disk_ro " Christoph Hellwig
2024-02-27 21:00   ` Richard Weinberger
2024-02-22  7:24 ` [PATCH 6/7] ubd: remove the queue pointer in struct ubd Christoph Hellwig
2024-02-27 21:01   ` Richard Weinberger
2024-02-22  7:24 ` [PATCH 7/7] ubd: open the backing files in ubd_add Christoph Hellwig
2024-02-27 21:05   ` Richard Weinberger
2024-02-27 21:21 ` ubd cleanups Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240222072417.3773131-5-hch@lst.de \
    --to=hch@lst.de \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=axboe@kernel.dk \
    --cc=johannes@sipsolutions.net \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.