Message ID | 20240222072417.3773131-6-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:15 > Betreff: [PATCH 5/7] ubd: move set_disk_ro to ubd_add > No need to delay this until open time. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > arch/um/drivers/ubd_kern.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c > index 26bc8306356263..c5d32e75426366 100644 > --- a/arch/um/drivers/ubd_kern.c > +++ b/arch/um/drivers/ubd_kern.c > @@ -903,6 +903,7 @@ static int ubd_add(int n, char **error_out) > set_capacity(disk, ubd_dev->size / 512); > sprintf(disk->disk_name, "ubd%c", 'a' + n); > disk->private_data = ubd_dev; > + set_disk_ro(disk, !ubd_dev->openflags.w); > > ubd_dev->pdev.id = n; > ubd_dev->pdev.name = DRIVER_NAME; > @@ -1159,7 +1160,6 @@ static int ubd_open(struct gendisk *disk, blk_mode_t mode) > } > } > ubd_dev->count++; > - set_disk_ro(disk, !ubd_dev->openflags.w); > out: > mutex_unlock(&ubd_mutex); > return err; > -- > 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 26bc8306356263..c5d32e75426366 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -903,6 +903,7 @@ static int ubd_add(int n, char **error_out) set_capacity(disk, ubd_dev->size / 512); sprintf(disk->disk_name, "ubd%c", 'a' + n); disk->private_data = ubd_dev; + set_disk_ro(disk, !ubd_dev->openflags.w); ubd_dev->pdev.id = n; ubd_dev->pdev.name = DRIVER_NAME; @@ -1159,7 +1160,6 @@ static int ubd_open(struct gendisk *disk, blk_mode_t mode) } } ubd_dev->count++; - set_disk_ro(disk, !ubd_dev->openflags.w); out: mutex_unlock(&ubd_mutex); return err;
No need to delay this until open time. Signed-off-by: Christoph Hellwig <hch@lst.de> --- arch/um/drivers/ubd_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)