Thread (16 messages) 16 messages, 4 authors, 2016-10-25

Re: [PATCH v1] bcache: partition support: add 16 minors per bcacheN device

From: Eric Wheeler <hidden>
Date: 2016-10-24 01:22:50

[ Fixed subject: 
  Really I meant 16 minors per device, not per-major; major hasn't changed.]

On Sun, 23 Oct 2016, Eric Wheeler wrote:
quoted hunk ↗ jump to hunk
On Fri, 14 Oct 2016, Wido den Hollander wrote:
quoted
quoted
Op 29 september 2016 om 19:11 schreef Emmanuel Florac [off-list ref]:
Le Thu, 29 Sep 2016 18:52:14 +0200 (CEST)
Wido den Hollander [off-list ref] écrivait:
quoted
quoted
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 :)
quoted
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.
quoted
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;
 	}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help