Message ID | 20240222072417.3773131-5-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/7] ubd: remove the ubd_gendisk array | expand |
----- Ursprüngliche Mail ----- > Von: "hch" <hch@lst.de> > An: "richard" <richard@nod.at>, "anton ivanov" <anton.ivanov@cambridgegreys.com>, "Johannes Berg" > <johannes@sipsolutions.net>, "Jens Axboe" <axboe@kernel.dk> > CC: "linux-um" <linux-um@lists.infradead.org>, "linux-block" <linux-block@vger.kernel.org> > Gesendet: Donnerstag, 22. Februar 2024 08:24:14 > Betreff: [PATCH 4/7] ubd: move setting the variable queue limits to ubd_add > 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 Reviewed-by: Richard Weinberger <richard@nod.at> Thanks, //richard
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";
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(-)