diff mbox

[SRU,Xenial,1/1] bcache: partition support: add 16 minors per bcacheN device

Message ID 5d46f6ce4be3808ab35f1f90e4e80d6de30b9d7b.1500559727.git.joseph.salisbury@canonical.com
State New
Headers show

Commit Message

Joseph Salisbury July 30, 2017, 2:52 p.m. UTC
From: Eric Wheeler <git@linux.ewheeler.net>

BugLink: http://bugs.launchpad.net/bugs/1705493

Signed-off-by: Eric Wheeler <bcache@linux.ewheeler.net>
Tested-by: Wido den Hollander <wido@widodh.nl>
(cherry picked from commit b8c0d911ac5285e6be8967713271a51bdc5a936a)
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
---
 drivers/md/bcache/super.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Stefan Bader July 31, 2017, 6:04 a.m. UTC | #1
On 30.07.2017 16:52, Joseph Salisbury wrote:
> From: Eric Wheeler <git@linux.ewheeler.net>
> 
> BugLink: http://bugs.launchpad.net/bugs/1705493

This alone causes device naming to become incorrect. In Zesty we carry a SAUCE
patch for that:

commit 457dac7806c34ce037a8c50b5adaa2abf8d86ebc
Author: Stefan Bader <stefan.bader@canonical.com>
Date:   Thu Mar 2 15:38:24 2017 +0100

    UBUNTU: SAUCE: bcache: Fix bcache device names

BugLink: https://bugs.launchpad.net/bugs/1667078

It looks like upstream bcache is/was working on a slightly different fix but I
have not seen anything going into any upstream Linux kernel, yet.

https://www.spinics.net/lists/linux-bcache/msg04816.html

-Stefan

> 
> Signed-off-by: Eric Wheeler <bcache@linux.ewheeler.net>
> Tested-by: Wido den Hollander <wido@widodh.nl>
> (cherry picked from commit b8c0d911ac5285e6be8967713271a51bdc5a936a)
> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
> ---
>  drivers/md/bcache/super.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index cc55e08..11e976e 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -58,6 +58,7 @@ static wait_queue_head_t unregister_wait;
>  struct workqueue_struct *bcache_wq;
>  
>  #define BTREE_MAX_PAGES		(256 * 1024 / PAGE_SIZE)
> +#define BCACHE_MINORS		16 /* partition support */
>  
>  /* Superblock */
>  
> @@ -781,8 +782,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;
>  	}
>
diff mbox

Patch

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index cc55e08..11e976e 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -58,6 +58,7 @@  static wait_queue_head_t unregister_wait;
 struct workqueue_struct *bcache_wq;
 
 #define BTREE_MAX_PAGES		(256 * 1024 / PAGE_SIZE)
+#define BCACHE_MINORS		16 /* partition support */
 
 /* Superblock */
 
@@ -781,8 +782,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;
 	}