btt.c (f0dc089ce217e7b98e0d2077c548ff08129e7911) btt.c (581388209405902b56d055f644b4dd124a206112)
1/*
2 * Block Translation Table
3 * Copyright (c) 2014-2015, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

--- 1231 unchanged lines hidden (view full) ---

1240 geo->cylinders = get_capacity(bd->bd_disk) >> 11;
1241 return 0;
1242}
1243
1244static const struct block_device_operations btt_fops = {
1245 .owner = THIS_MODULE,
1246 .rw_page = btt_rw_page,
1247 .getgeo = btt_getgeo,
1/*
2 * Block Translation Table
3 * Copyright (c) 2014-2015, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

--- 1231 unchanged lines hidden (view full) ---

1240 geo->cylinders = get_capacity(bd->bd_disk) >> 11;
1241 return 0;
1242}
1243
1244static const struct block_device_operations btt_fops = {
1245 .owner = THIS_MODULE,
1246 .rw_page = btt_rw_page,
1247 .getgeo = btt_getgeo,
1248 .revalidate_disk = nvdimm_revalidate_disk,
1248};
1249
1250static int btt_blk_init(struct btt *btt)
1251{
1252 struct nd_btt *nd_btt = btt->nd_btt;
1253 struct nd_namespace_common *ndns = nd_btt->ndns;
1254
1255 /* create a new disk and request queue for btt */

--- 31 unchanged lines hidden (view full) ---

1287 if (rc) {
1288 del_gendisk(btt->btt_disk);
1289 put_disk(btt->btt_disk);
1290 blk_cleanup_queue(btt->btt_queue);
1291 return rc;
1292 }
1293 }
1294 set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9);
1249};
1250
1251static int btt_blk_init(struct btt *btt)
1252{
1253 struct nd_btt *nd_btt = btt->nd_btt;
1254 struct nd_namespace_common *ndns = nd_btt->ndns;
1255
1256 /* create a new disk and request queue for btt */

--- 31 unchanged lines hidden (view full) ---

1288 if (rc) {
1289 del_gendisk(btt->btt_disk);
1290 put_disk(btt->btt_disk);
1291 blk_cleanup_queue(btt->btt_queue);
1292 return rc;
1293 }
1294 }
1295 set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9);
1296 revalidate_disk(btt->btt_disk);
1295
1296 return 0;
1297}
1298
1299static void btt_blk_cleanup(struct btt *btt)
1300{
1301 blk_integrity_unregister(btt->btt_disk);
1302 del_gendisk(btt->btt_disk);

--- 38 unchanged lines hidden (view full) ---

1341 btt->nd_region = nd_region;
1342
1343 ret = discover_arenas(btt);
1344 if (ret) {
1345 dev_err(dev, "init: error in arena_discover: %d\n", ret);
1346 goto out_free;
1347 }
1348
1297
1298 return 0;
1299}
1300
1301static void btt_blk_cleanup(struct btt *btt)
1302{
1303 blk_integrity_unregister(btt->btt_disk);
1304 del_gendisk(btt->btt_disk);

--- 38 unchanged lines hidden (view full) ---

1343 btt->nd_region = nd_region;
1344
1345 ret = discover_arenas(btt);
1346 if (ret) {
1347 dev_err(dev, "init: error in arena_discover: %d\n", ret);
1348 goto out_free;
1349 }
1350
1349 if (btt->init_state != INIT_READY) {
1351 if (btt->init_state != INIT_READY && nd_region->ro) {
1352 dev_info(dev, "%s is read-only, unable to init btt metadata\n",
1353 dev_name(&nd_region->dev));
1354 goto out_free;
1355 } else if (btt->init_state != INIT_READY) {
1350 btt->num_arenas = (rawsize / ARENA_MAX_SIZE) +
1351 ((rawsize % ARENA_MAX_SIZE) ? 1 : 0);
1352 dev_dbg(dev, "init: %d arenas for %llu rawsize\n",
1353 btt->num_arenas, rawsize);
1354
1355 ret = create_arenas(btt);
1356 if (ret) {
1357 dev_info(dev, "init: create_arenas: %d\n", ret);
1358 goto out_free;
1359 }
1360
1361 ret = btt_meta_init(btt);
1362 if (ret) {
1363 dev_err(dev, "init: error in meta_init: %d\n", ret);
1356 btt->num_arenas = (rawsize / ARENA_MAX_SIZE) +
1357 ((rawsize % ARENA_MAX_SIZE) ? 1 : 0);
1358 dev_dbg(dev, "init: %d arenas for %llu rawsize\n",
1359 btt->num_arenas, rawsize);
1360
1361 ret = create_arenas(btt);
1362 if (ret) {
1363 dev_info(dev, "init: create_arenas: %d\n", ret);
1364 goto out_free;
1365 }
1366
1367 ret = btt_meta_init(btt);
1368 if (ret) {
1369 dev_err(dev, "init: error in meta_init: %d\n", ret);
1364 return NULL;
1370 goto out_free;
1365 }
1366 }
1367
1368 ret = btt_blk_init(btt);
1369 if (ret) {
1370 dev_err(dev, "init: error in blk_init: %d\n", ret);
1371 goto out_free;
1372 }

--- 101 unchanged lines hidden ---
1371 }
1372 }
1373
1374 ret = btt_blk_init(btt);
1375 if (ret) {
1376 dev_err(dev, "init: error in blk_init: %d\n", ret);
1377 goto out_free;
1378 }

--- 101 unchanged lines hidden ---