From: Asias He <asias.hejun@gmail.com> To: Ren Mingxin <renmx@cn.fujitsu.com> Cc: Jens Axboe <axboe@kernel.dk>, "Michael S. Tsirkin" <mst@redhat.com>, Rusty Russell <rusty@rustcorp.com.au>, Tejun Heo <tj@kernel.org>, LKML <linux-kernel@vger.kernel.org>, SCSI <linux-scsi@vger.kernel.org>, KVM <kvm@vger.kernel.org>, VIRTUAL <virtualization@lists.linux-foundation.org> Subject: Re: [PATCH 4/4] virtio_blk: use disk_name_format() to support mass of disks naming Date: Fri, 30 Mar 2012 19:22:39 +0800 [thread overview] Message-ID: <CAFO3S427vWXHBDaRmfwqZrGZ2Y8RPUn7CQswQou9EGMh43jU8Q@mail.gmail.com> (raw) In-Reply-To: <4F7582B0.5010609@cn.fujitsu.com> Hi, Ren On Fri, Mar 30, 2012 at 5:53 PM, Ren Mingxin <renmx@cn.fujitsu.com> wrote: > The current virtblk's naming algorithm only supports 263 disks. > If there are mass of virtblks(exceeding 263), there will be disks > with the same name. This fix is pretty nice. However, current virtblk's naming still supports up to 18278 disks, no? ( index 0 -> vda, index 18277 -> vdzzz ). > By renaming "sd_format_disk_name()" to "disk_name_format()" > and moving it into block core, virtio_blk can use this function to > support mass of disks. > > Signed-off-by: Ren Mingxin <renmx@cn.fujitsu.com> > --- > virtio_blk.c | 13 +------------ > 1 file changed, 1 insertion(+), 12 deletions(-) > > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c > index c4a60ba..54612c2 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -442,18 +442,7 @@ static int __devinit virtblk_probe(struct virtio_device > *vdev) > > q->queuedata = vblk; > > - if (index < 26) { > - sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); > - } else if (index < (26 + 1) * 26) { > - sprintf(vblk->disk->disk_name, "vd%c%c", > - 'a' + index / 26 - 1, 'a' + index % 26); > - } else { > - const unsigned int m1 = (index / 26 - 1) / 26 - 1; > - const unsigned int m2 = (index / 26 - 1) % 26; > - const unsigned int m3 = index % 26; > - sprintf(vblk->disk->disk_name, "vd%c%c%c", > - 'a' + m1, 'a' + m2, 'a' + m3); > - } > + disk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); > > vblk->disk->major = major; > vblk->disk->first_minor = index_to_minor(index); > > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Asias He
WARNING: multiple messages have this Message-ID (diff)
From: Asias He <asias.hejun@gmail.com> To: Ren Mingxin <renmx@cn.fujitsu.com> Cc: Jens Axboe <axboe@kernel.dk>, KVM <kvm@vger.kernel.org>, SCSI <linux-scsi@vger.kernel.org>, "Michael S. Tsirkin" <mst@redhat.com>, LKML <linux-kernel@vger.kernel.org>, VIRTUAL <virtualization@lists.linux-foundation.org>, Tejun Heo <tj@kernel.org> Subject: Re: [PATCH 4/4] virtio_blk: use disk_name_format() to support mass of disks naming Date: Fri, 30 Mar 2012 19:22:39 +0800 [thread overview] Message-ID: <CAFO3S427vWXHBDaRmfwqZrGZ2Y8RPUn7CQswQou9EGMh43jU8Q@mail.gmail.com> (raw) In-Reply-To: <4F7582B0.5010609@cn.fujitsu.com> Hi, Ren On Fri, Mar 30, 2012 at 5:53 PM, Ren Mingxin <renmx@cn.fujitsu.com> wrote: > The current virtblk's naming algorithm only supports 263 disks. > If there are mass of virtblks(exceeding 263), there will be disks > with the same name. This fix is pretty nice. However, current virtblk's naming still supports up to 18278 disks, no? ( index 0 -> vda, index 18277 -> vdzzz ). > By renaming "sd_format_disk_name()" to "disk_name_format()" > and moving it into block core, virtio_blk can use this function to > support mass of disks. > > Signed-off-by: Ren Mingxin <renmx@cn.fujitsu.com> > --- > virtio_blk.c | 13 +------------ > 1 file changed, 1 insertion(+), 12 deletions(-) > > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c > index c4a60ba..54612c2 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -442,18 +442,7 @@ static int __devinit virtblk_probe(struct virtio_device > *vdev) > > q->queuedata = vblk; > > - if (index < 26) { > - sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); > - } else if (index < (26 + 1) * 26) { > - sprintf(vblk->disk->disk_name, "vd%c%c", > - 'a' + index / 26 - 1, 'a' + index % 26); > - } else { > - const unsigned int m1 = (index / 26 - 1) / 26 - 1; > - const unsigned int m2 = (index / 26 - 1) % 26; > - const unsigned int m3 = index % 26; > - sprintf(vblk->disk->disk_name, "vd%c%c%c", > - 'a' + m1, 'a' + m2, 'a' + m3); > - } > + disk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); > > vblk->disk->major = major; > vblk->disk->first_minor = index_to_minor(index); > > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Asias He _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2012-03-30 11:23 UTC|newest] Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-30 9:50 [PATCH 0/4] block: move sd_format_disk_name() into block core as disk_name_format() Ren Mingxin 2012-03-30 9:52 ` [PATCH 1/4] block: add function disk_name_format() into block core Ren Mingxin 2012-03-30 9:52 ` Ren Mingxin 2012-03-30 9:53 ` [PATCH 2/4] scsi: replace sd_format_disk_name() to disk_name_format() Ren Mingxin 2012-03-30 9:53 ` Ren Mingxin 2012-03-30 9:53 ` [PATCH 3/4] block: replace rssd_disk_name_format() " Ren Mingxin 2012-03-30 9:53 ` Ren Mingxin 2012-03-30 23:54 ` Asai Thambi Samymuthu Pattrayasamy (asamymuthupa) [CONT - Type 2] 2012-03-30 23:54 ` Asai Thambi Samymuthu Pattrayasamy (asamymuthupa) [CONT - Type 2] 2012-03-30 23:54 ` Asai Thambi Samymuthu Pattrayasamy (asamymuthupa) [CONT - Type 2] 2012-04-02 1:21 ` Ren Mingxin 2012-04-02 1:21 ` Ren Mingxin 2012-04-02 1:21 ` Ren Mingxin 2012-03-30 9:53 ` [PATCH 4/4] virtio_blk: use disk_name_format() to support mass of disks naming Ren Mingxin 2012-03-30 9:53 ` Ren Mingxin 2012-03-30 11:22 ` Asias He [this message] 2012-03-30 11:22 ` Asias He 2012-03-31 1:14 ` Ren Mingxin 2012-03-31 1:14 ` Ren Mingxin 2012-03-31 3:03 ` Asias He 2012-03-31 3:03 ` Asias He 2012-03-30 15:26 ` Tejun Heo 2012-03-30 15:26 ` Tejun Heo 2012-03-30 15:28 ` Tejun Heo 2012-03-30 15:28 ` Tejun Heo 2012-04-02 1:19 ` Ren Mingxin 2012-04-02 1:19 ` Ren Mingxin 2012-04-02 7:20 ` Michael S. Tsirkin 2012-04-02 7:20 ` Michael S. Tsirkin 2012-04-02 18:52 ` Tejun Heo 2012-04-02 18:52 ` Tejun Heo 2012-04-02 18:56 ` James Bottomley 2012-04-02 19:00 ` Tejun Heo 2012-04-02 19:00 ` Tejun Heo 2012-04-04 8:01 ` Michael S. Tsirkin 2012-04-04 8:01 ` Michael S. Tsirkin 2012-04-09 3:47 ` Ren Mingxin 2012-04-09 3:47 ` Ren Mingxin 2012-04-09 7:33 ` Michael S. Tsirkin 2012-04-09 7:33 ` Michael S. Tsirkin 2012-04-09 7:50 ` Michael S. Tsirkin 2012-04-09 7:50 ` Michael S. Tsirkin 2012-04-02 18:56 ` James Bottomley 2012-03-30 15:38 ` Tejun Heo 2012-03-30 15:38 ` Tejun Heo 2012-04-02 1:18 ` Ren Mingxin 2012-04-02 1:18 ` Ren Mingxin 2012-04-02 7:15 ` Michael S. Tsirkin 2012-04-02 7:15 ` Michael S. Tsirkin 2012-04-12 20:17 ` Jeff Garzik 2012-04-12 20:17 ` Jeff Garzik 2012-03-30 9:56 ` [PATCH 0/4] block: move sd_format_disk_name() into block core as disk_name_format() James Bottomley 2012-03-30 10:10 ` Ren Mingxin 2012-03-30 10:10 ` Ren Mingxin 2012-03-30 9:56 ` James Bottomley 2012-04-01 11:20 ` Michael S. Tsirkin 2012-04-01 11:20 ` Michael S. Tsirkin
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=CAFO3S427vWXHBDaRmfwqZrGZ2Y8RPUn7CQswQou9EGMh43jU8Q@mail.gmail.com \ --to=asias.hejun@gmail.com \ --cc=axboe@kernel.dk \ --cc=kvm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-scsi@vger.kernel.org \ --cc=mst@redhat.com \ --cc=renmx@cn.fujitsu.com \ --cc=rusty@rustcorp.com.au \ --cc=tj@kernel.org \ --cc=virtualization@lists.linux-foundation.org \ /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: linkBe 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.