All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <Laurent.Vivier@bull.net>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Modify loop device to be able to manage partitions of the disk image
Date: Thu, 06 Mar 2008 11:16:25 +0100	[thread overview]
Message-ID: <1204798585.4325.8.camel@frecb07144> (raw)
In-Reply-To: <200803062057.50181.nickpiggin@yahoo.com.au>


Le jeudi 06 mars 2008 à 20:57 +1100, Nick Piggin a écrit :
> On Thursday 06 March 2008 20:43, Laurent Vivier wrote:
> > This patch allows to use loop device with partitionned disk image.
> >
> > Original behavior of loop is not modified.
> >
> > A new parameter is introduced to define how many partition we want to be
> > able to manage per loop device. This parameter is "max_part".
> >
> > For instance, to manage 63 partitions / loop device, we will do:
> > # modprobe max_part=63
> > # ls -l /dev/loop?*
> > brw-rw---- 1 root disk 7,   0 2008-03-05 14:55 /dev/loop0
> > brw-rw---- 1 root disk 7,  64 2008-03-05 14:55 /dev/loop1
> > brw-rw---- 1 root disk 7, 128 2008-03-05 14:55 /dev/loop2
> > brw-rw---- 1 root disk 7, 192 2008-03-05 14:55 /dev/loop3
> > brw-rw---- 1 root disk 7, 256 2008-03-05 14:55 /dev/loop4
> > brw-rw---- 1 root disk 7, 320 2008-03-05 14:55 /dev/loop5
> > brw-rw---- 1 root disk 7, 384 2008-03-05 14:55 /dev/loop6
> > brw-rw---- 1 root disk 7, 448 2008-03-05 14:55 /dev/loop7
> >
> > And to attach a raw partitionned disk image, the original losetup is used:
> >
> > # losetup -f etch.img
> > # ls -l /dev/loop?*
> > brw-rw---- 1 root disk 7,   0 2008-03-05 14:55 /dev/loop0
> > brw-rw---- 1 root disk 7,   1 2008-03-05 14:57 /dev/loop0p1
> > brw-rw---- 1 root disk 7,   2 2008-03-05 14:57 /dev/loop0p2
> > brw-rw---- 1 root disk 7,   5 2008-03-05 14:57 /dev/loop0p5
> > brw-rw---- 1 root disk 7,  64 2008-03-05 14:55 /dev/loop1
> > brw-rw---- 1 root disk 7, 128 2008-03-05 14:55 /dev/loop2
> > brw-rw---- 1 root disk 7, 192 2008-03-05 14:55 /dev/loop3
> > brw-rw---- 1 root disk 7, 256 2008-03-05 14:55 /dev/loop4
> > brw-rw---- 1 root disk 7, 320 2008-03-05 14:55 /dev/loop5
> > brw-rw---- 1 root disk 7, 384 2008-03-05 14:55 /dev/loop6
> > brw-rw---- 1 root disk 7, 448 2008-03-05 14:55 /dev/loop7
> > # mount /dev/loop0p1 /mnt
> > # ls /mnt
> > bench  cdrom  home        lib         mnt   root     srv  usr
> > bin    dev    initrd      lost+found  opt   sbin     sys  var
> > boot   etc    initrd.img  media       proc  selinux  tmp  vmlinuz
> > # umount /mnt
> > # losetup -d /dev/loop0
> >
> > Of course, the same behavior can be done using kpartx on a loop device,
> > but modifying loop avoids to stack several layers of block device (loop +
> > device mapper), this is a very light modification (40% of modifications
> > are to manage the new parameter). Moreover all partition tables known
> > by the kernel are managed (kpartx implements only a subset).
> 
> Do you think we do something similar for drivers/block/brd.c too? I'd
> like to try to maintain parity between them where possible...

I think it is possible  (I've the same patch for NBD too), but I think
it is completely useless.

For loop, it is another story because it uses disk images that can be
created from a partition or a real device (or a virtual disk).

Regards,
Laurent
-- 
----------------- Laurent.Vivier@bull.net  ------------------
"Programmers who subconsciously view themselves as artists
 will enjoy what they do and will do it better." D. Knuth


  reply	other threads:[~2008-03-06 10:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06  9:43 [PATCH] Modify loop device to be able to manage partitions of the disk image Laurent Vivier
2008-03-06  9:57 ` Nick Piggin
2008-03-06 10:16   ` Laurent Vivier [this message]
2008-03-06 10:56     ` Nick Piggin
2008-03-06 11:29       ` Laurent Vivier
2008-03-06 11:34 ` Pádraig Brady
2008-03-06 11:45   ` Laurent Vivier
2008-03-06 12:21     ` Pádraig Brady
2008-03-06 12:44       ` Laurent Vivier
2008-03-06 12:35 ` Christoph Hellwig
2008-03-06 12:55   ` Laurent Vivier
     [not found] <a4kTW-44U-25@gated-at.bofh.it>
     [not found] ` <a4l3D-4hn-11@gated-at.bofh.it>
     [not found]   ` <a4lmN-4Xt-7@gated-at.bofh.it>
     [not found]     ` <a4m9d-6iD-7@gated-at.bofh.it>
2008-03-07 11:56       ` Bodo Eggert
2008-03-07 12:08         ` Bart Van Assche
2008-03-07 12:13         ` Laurent Vivier

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=1204798585.4325.8.camel@frecb07144 \
    --to=laurent.vivier@bull.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /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.