On Fri, 14 Oct 2016, Wido den Hollander wrote: > > Op 29 september 2016 om 19:11 schreef Emmanuel Florac <eflorac@xxxxxxxxxxxxxx>: > > Le Thu, 29 Sep 2016 18:52:14 +0200 (CEST) > > Wido den Hollander <wido@xxxxxxxx> écrivait: > > > > I agree, but usually you wouldn't partition an MD-RAID either, would > > > > you? OSDs are still holding (so far) ordinary filesystems locally > > > > mounted on the nodes (except for BlueStore AFAIK). > > > I have partitioned MD-RAID before, works just fine. > > > > Yes, sure. It just doesn't feel right, my grey-bearded Unix instinct > > tingles :) > > > > > The question still remains, can bcache be patched that it allocates > > > the right minor in the kernel so that it allows for partitions. > > > > Even looks easy... As Sam Yaple made a patch. > > > > > I'm not a kernel nor bcache developer, just looking for somebody who > > > would be willing to do this. Happy to assist, support and test! > > > > Well if I have some time I may give it a try next week :) > > > > I was wondering if you were able to take a look at this? Hi Wido, See below and please test. It works for me, but I've not done any more than create a partition and verify that it was detected. Use-case opinions aside, some may or may not wish to use partitions atop of bcache. (If you do, just make sure they are aligned correctly!). I'll add your tested-by and request a pull for v4.9 unless someone has good reason to implement this differently. Kent, is there any reason to change this implementation? -- Eric Wheeler diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 849ad44..6e53afd 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -58,6 +58,7 @@ struct workqueue_struct *bcache_wq; #define BTREE_MAX_PAGES (256 * 1024 / PAGE_SIZE) +#define BCACHE_MINORS 16 /* partition support */ /* Superblock */ @@ -783,8 +784,10 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size, if (minor < 0) return minor; + minor *= BCACHE_MINORS; + if (!(d->bio_split = bioset_create(4, offsetof(struct bbio, bio))) || - !(d->disk = alloc_disk(1))) { + !(d->disk = alloc_disk(BCACHE_MINORS))) { ida_simple_remove(&bcache_minor, minor); return -ENOMEM; }