|
@@ -58,6 +58,7 @@ static wait_queue_head_t unregister_wait;
|
|
struct workqueue_struct *bcache_wq;
|
|
struct workqueue_struct *bcache_wq;
|
|
|
|
|
|
#define BTREE_MAX_PAGES (256 * 1024 / PAGE_SIZE)
|
|
#define BTREE_MAX_PAGES (256 * 1024 / PAGE_SIZE)
|
|
|
|
+#define BCACHE_MINORS 16 /* partition support */
|
|
|
|
|
|
/* Superblock */
|
|
/* Superblock */
|
|
|
|
|
|
@@ -783,8 +784,10 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,
|
|
if (minor < 0)
|
|
if (minor < 0)
|
|
return minor;
|
|
return minor;
|
|
|
|
|
|
|
|
+ minor *= BCACHE_MINORS;
|
|
|
|
+
|
|
if (!(d->bio_split = bioset_create(4, offsetof(struct bbio, bio))) ||
|
|
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);
|
|
ida_simple_remove(&bcache_minor, minor);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
@@ -1489,6 +1492,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb)
|
|
mutex_init(&c->bucket_lock);
|
|
mutex_init(&c->bucket_lock);
|
|
init_waitqueue_head(&c->btree_cache_wait);
|
|
init_waitqueue_head(&c->btree_cache_wait);
|
|
init_waitqueue_head(&c->bucket_wait);
|
|
init_waitqueue_head(&c->bucket_wait);
|
|
|
|
+ init_waitqueue_head(&c->gc_wait);
|
|
sema_init(&c->uuid_write_mutex, 1);
|
|
sema_init(&c->uuid_write_mutex, 1);
|
|
|
|
|
|
spin_lock_init(&c->btree_gc_time.lock);
|
|
spin_lock_init(&c->btree_gc_time.lock);
|
|
@@ -1548,6 +1552,7 @@ static void run_cache_set(struct cache_set *c)
|
|
|
|
|
|
for_each_cache(ca, c, i)
|
|
for_each_cache(ca, c, i)
|
|
c->nbuckets += ca->sb.nbuckets;
|
|
c->nbuckets += ca->sb.nbuckets;
|
|
|
|
+ set_gc_sectors(c);
|
|
|
|
|
|
if (CACHE_SYNC(&c->sb)) {
|
|
if (CACHE_SYNC(&c->sb)) {
|
|
LIST_HEAD(journal);
|
|
LIST_HEAD(journal);
|