Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcache: add set_uuid in struct cache_set

This patch adds a separated set_uuid[16] in struct cache_set, to store
the uuid of the cache set. This is the preparation to remove the
embedded struct cache_sb from struct cache_set.

Signed-off-by: Coly Li <colyli@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Coly Li and committed by
Jens Axboe
1132e56e 08fdb2cd

+16 -15
+1
drivers/md/bcache/bcache.h
··· 668 668 struct mutex verify_lock; 669 669 #endif 670 670 671 + uint8_t set_uuid[16]; 671 672 unsigned int nr_uuids; 672 673 struct uuid_entry *uuids; 673 674 BKEY_PADDED(uuid_bucket);
+1 -1
drivers/md/bcache/debug.c
··· 238 238 if (!IS_ERR_OR_NULL(bcache_debug)) { 239 239 char name[50]; 240 240 241 - snprintf(name, 50, "bcache-%pU", c->sb.set_uuid); 241 + snprintf(name, 50, "bcache-%pU", c->set_uuid); 242 242 c->debug = debugfs_create_file(name, 0400, bcache_debug, c, 243 243 &cache_set_debug_ops); 244 244 }
+12 -12
drivers/md/bcache/super.c
··· 1189 1189 struct cached_dev *exist_dc, *t; 1190 1190 int ret = 0; 1191 1191 1192 - if ((set_uuid && memcmp(set_uuid, c->sb.set_uuid, 16)) || 1193 - (!set_uuid && memcmp(dc->sb.set_uuid, c->sb.set_uuid, 16))) 1192 + if ((set_uuid && memcmp(set_uuid, c->set_uuid, 16)) || 1193 + (!set_uuid && memcmp(dc->sb.set_uuid, c->set_uuid, 16))) 1194 1194 return -ENOENT; 1195 1195 1196 1196 if (dc->disk.c) { ··· 1262 1262 u->first_reg = u->last_reg = rtime; 1263 1263 bch_uuid_write(c); 1264 1264 1265 - memcpy(dc->sb.set_uuid, c->sb.set_uuid, 16); 1265 + memcpy(dc->sb.set_uuid, c->set_uuid, 16); 1266 1266 SET_BDEV_STATE(&dc->sb, BDEV_STATE_CLEAN); 1267 1267 1268 1268 bch_write_bdev_super(dc, &cl); ··· 1324 1324 pr_info("Caching %s as %s on set %pU\n", 1325 1325 dc->backing_dev_name, 1326 1326 dc->disk.disk->disk_name, 1327 - dc->disk.c->sb.set_uuid); 1327 + dc->disk.c->set_uuid); 1328 1328 return 0; 1329 1329 } 1330 1330 ··· 1631 1631 vaf.va = &args; 1632 1632 1633 1633 pr_err("error on %pU: %pV, disabling caching\n", 1634 - c->sb.set_uuid, &vaf); 1634 + c->set_uuid, &vaf); 1635 1635 1636 1636 va_end(args); 1637 1637 ··· 1684 1684 list_del(&c->list); 1685 1685 mutex_unlock(&bch_register_lock); 1686 1686 1687 - pr_info("Cache set %pU unregistered\n", c->sb.set_uuid); 1687 + pr_info("Cache set %pU unregistered\n", c->set_uuid); 1688 1688 wake_up(&unregister_wait); 1689 1689 1690 1690 closure_debug_destroy(&c->cl); ··· 1754 1754 { 1755 1755 if (dc->stop_when_cache_set_failed == BCH_CACHED_DEV_STOP_ALWAYS) { 1756 1756 pr_warn("stop_when_cache_set_failed of %s is \"always\", stop it for failed cache set %pU.\n", 1757 - d->disk->disk_name, c->sb.set_uuid); 1757 + d->disk->disk_name, c->set_uuid); 1758 1758 bcache_device_stop(d); 1759 1759 } else if (atomic_read(&dc->has_dirty)) { 1760 1760 /* ··· 1861 1861 1862 1862 bch_cache_accounting_init(&c->accounting, &c->cl); 1863 1863 1864 - memcpy(c->sb.set_uuid, sb->set_uuid, 16); 1864 + memcpy(c->set_uuid, sb->set_uuid, 16); 1865 1865 c->sb.block_size = sb->block_size; 1866 1866 c->sb.bucket_size = sb->bucket_size; 1867 1867 c->sb.nr_in_set = sb->nr_in_set; ··· 2144 2144 struct cache_set *c; 2145 2145 2146 2146 list_for_each_entry(c, &bch_cache_sets, list) 2147 - if (!memcmp(c->sb.set_uuid, ca->sb.set_uuid, 16)) { 2147 + if (!memcmp(c->set_uuid, ca->sb.set_uuid, 16)) { 2148 2148 if (c->cache) 2149 2149 return "duplicate cache set member"; 2150 2150 ··· 2162 2162 return err; 2163 2163 2164 2164 err = "error creating kobject"; 2165 - if (kobject_add(&c->kobj, bcache_kobj, "%pU", c->sb.set_uuid) || 2165 + if (kobject_add(&c->kobj, bcache_kobj, "%pU", c->set_uuid) || 2166 2166 kobject_add(&c->internal, &c->kobj, "internal")) 2167 2167 goto err; 2168 2168 ··· 2187 2187 */ 2188 2188 if (ca->sb.seq > c->sb.seq || c->sb.seq == 0) { 2189 2189 c->sb.version = ca->sb.version; 2190 - memcpy(c->sb.set_uuid, ca->sb.set_uuid, 16); 2190 + memcpy(c->set_uuid, ca->sb.set_uuid, 16); 2191 2191 c->sb.flags = ca->sb.flags; 2192 2192 c->sb.seq = ca->sb.seq; 2193 2193 pr_debug("set version = %llu\n", c->sb.version); ··· 2702 2702 list_for_each_entry_safe(pdev, tpdev, &pending_devs, list) { 2703 2703 list_for_each_entry_safe(c, tc, &bch_cache_sets, list) { 2704 2704 char *pdev_set_uuid = pdev->dc->sb.set_uuid; 2705 - char *set_uuid = c->sb.uuid; 2705 + char *set_uuid = c->set_uuid; 2706 2706 2707 2707 if (!memcmp(pdev_set_uuid, set_uuid, 16)) { 2708 2708 list_del(&pdev->list);
+2 -2
include/trace/events/bcache.h
··· 164 164 ), 165 165 166 166 TP_fast_assign( 167 - memcpy(__entry->uuid, c->sb.set_uuid, 16); 167 + memcpy(__entry->uuid, c->set_uuid, 16); 168 168 __entry->inode = inode; 169 169 __entry->sector = bio->bi_iter.bi_sector; 170 170 __entry->nr_sector = bio->bi_iter.bi_size >> 9; ··· 200 200 ), 201 201 202 202 TP_fast_assign( 203 - memcpy(__entry->uuid, c->sb.set_uuid, 16); 203 + memcpy(__entry->uuid, c->set_uuid, 16); 204 204 ), 205 205 206 206 TP_printk("%pU", __entry->uuid)