diff options
author | Alex Elder <elder@inktank.com> | 2012-10-26 00:34:41 -0400 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2012-10-30 09:34:29 -0400 |
commit | 971f839a7670197366c04e99472943532caeb0dc (patch) | |
tree | 7e1a7edc3502a564939e3127c292d8e6d8e50534 /drivers | |
parent | 86992098e7fdb97d01feb51495a952b264a55b7c (diff) |
rbd: move snap info out of rbd_mapping struct
Moving the snap_id and snap_name fields into the separate
rbd_mapping structure was misguided. (And in time, perhaps
we'll do away with that structure altogether...)
Move these fields back into struct rbd_device.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/rbd.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index ef82e9091f4d..7d28ce33056f 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -166,8 +166,6 @@ struct rbd_snap { | |||
166 | }; | 166 | }; |
167 | 167 | ||
168 | struct rbd_mapping { | 168 | struct rbd_mapping { |
169 | char *snap_name; | ||
170 | u64 snap_id; | ||
171 | u64 size; | 169 | u64 size; |
172 | u64 features; | 170 | u64 features; |
173 | bool snap_exists; | 171 | bool snap_exists; |
@@ -199,6 +197,9 @@ struct rbd_device { | |||
199 | char *pool_name; | 197 | char *pool_name; |
200 | u64 pool_id; | 198 | u64 pool_id; |
201 | 199 | ||
200 | char *snap_name; | ||
201 | u64 snap_id; | ||
202 | |||
202 | struct ceph_osd_event *watch_event; | 203 | struct ceph_osd_event *watch_event; |
203 | struct ceph_osd_request *watch_request; | 204 | struct ceph_osd_request *watch_request; |
204 | 205 | ||
@@ -669,7 +670,7 @@ static int snap_by_name(struct rbd_device *rbd_dev, const char *snap_name) | |||
669 | 670 | ||
670 | list_for_each_entry(snap, &rbd_dev->snaps, node) { | 671 | list_for_each_entry(snap, &rbd_dev->snaps, node) { |
671 | if (!strcmp(snap_name, snap->name)) { | 672 | if (!strcmp(snap_name, snap->name)) { |
672 | rbd_dev->mapping.snap_id = snap->id; | 673 | rbd_dev->snap_id = snap->id; |
673 | rbd_dev->mapping.size = snap->size; | 674 | rbd_dev->mapping.size = snap->size; |
674 | rbd_dev->mapping.features = snap->features; | 675 | rbd_dev->mapping.features = snap->features; |
675 | 676 | ||
@@ -686,7 +687,7 @@ static int rbd_dev_set_mapping(struct rbd_device *rbd_dev, char *snap_name) | |||
686 | 687 | ||
687 | if (!memcmp(snap_name, RBD_SNAP_HEAD_NAME, | 688 | if (!memcmp(snap_name, RBD_SNAP_HEAD_NAME, |
688 | sizeof (RBD_SNAP_HEAD_NAME))) { | 689 | sizeof (RBD_SNAP_HEAD_NAME))) { |
689 | rbd_dev->mapping.snap_id = CEPH_NOSNAP; | 690 | rbd_dev->snap_id = CEPH_NOSNAP; |
690 | rbd_dev->mapping.size = rbd_dev->header.image_size; | 691 | rbd_dev->mapping.size = rbd_dev->header.image_size; |
691 | rbd_dev->mapping.features = rbd_dev->header.features; | 692 | rbd_dev->mapping.features = rbd_dev->header.features; |
692 | rbd_dev->mapping.snap_exists = false; | 693 | rbd_dev->mapping.snap_exists = false; |
@@ -698,7 +699,7 @@ static int rbd_dev_set_mapping(struct rbd_device *rbd_dev, char *snap_name) | |||
698 | rbd_dev->mapping.snap_exists = true; | 699 | rbd_dev->mapping.snap_exists = true; |
699 | rbd_dev->mapping.read_only = true; | 700 | rbd_dev->mapping.read_only = true; |
700 | } | 701 | } |
701 | rbd_dev->mapping.snap_name = snap_name; | 702 | rbd_dev->snap_name = snap_name; |
702 | done: | 703 | done: |
703 | return ret; | 704 | return ret; |
704 | } | 705 | } |
@@ -1278,7 +1279,7 @@ static int rbd_do_op(struct request *rq, | |||
1278 | opcode = CEPH_OSD_OP_READ; | 1279 | opcode = CEPH_OSD_OP_READ; |
1279 | flags = CEPH_OSD_FLAG_READ; | 1280 | flags = CEPH_OSD_FLAG_READ; |
1280 | snapc = NULL; | 1281 | snapc = NULL; |
1281 | snapid = rbd_dev->mapping.snap_id; | 1282 | snapid = rbd_dev->snap_id; |
1282 | payload_len = 0; | 1283 | payload_len = 0; |
1283 | } | 1284 | } |
1284 | 1285 | ||
@@ -1561,7 +1562,7 @@ static void rbd_rq_fn(struct request_queue *q) | |||
1561 | 1562 | ||
1562 | down_read(&rbd_dev->header_rwsem); | 1563 | down_read(&rbd_dev->header_rwsem); |
1563 | 1564 | ||
1564 | if (rbd_dev->mapping.snap_id != CEPH_NOSNAP && | 1565 | if (rbd_dev->snap_id != CEPH_NOSNAP && |
1565 | !rbd_dev->mapping.snap_exists) { | 1566 | !rbd_dev->mapping.snap_exists) { |
1566 | up_read(&rbd_dev->header_rwsem); | 1567 | up_read(&rbd_dev->header_rwsem); |
1567 | dout("request for non-existent snapshot"); | 1568 | dout("request for non-existent snapshot"); |
@@ -1800,7 +1801,7 @@ static void rbd_update_mapping_size(struct rbd_device *rbd_dev) | |||
1800 | { | 1801 | { |
1801 | sector_t size; | 1802 | sector_t size; |
1802 | 1803 | ||
1803 | if (rbd_dev->mapping.snap_id != CEPH_NOSNAP) | 1804 | if (rbd_dev->snap_id != CEPH_NOSNAP) |
1804 | return; | 1805 | return; |
1805 | 1806 | ||
1806 | size = (sector_t) rbd_dev->header.image_size / SECTOR_SIZE; | 1807 | size = (sector_t) rbd_dev->header.image_size / SECTOR_SIZE; |
@@ -2011,7 +2012,7 @@ static ssize_t rbd_snap_show(struct device *dev, | |||
2011 | { | 2012 | { |
2012 | struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); | 2013 | struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); |
2013 | 2014 | ||
2014 | return sprintf(buf, "%s\n", rbd_dev->mapping.snap_name); | 2015 | return sprintf(buf, "%s\n", rbd_dev->snap_name); |
2015 | } | 2016 | } |
2016 | 2017 | ||
2017 | static ssize_t rbd_image_refresh(struct device *dev, | 2018 | static ssize_t rbd_image_refresh(struct device *dev, |
@@ -2567,12 +2568,11 @@ static int rbd_dev_snaps_update(struct rbd_device *rbd_dev) | |||
2567 | 2568 | ||
2568 | /* Existing snapshot not in the new snap context */ | 2569 | /* Existing snapshot not in the new snap context */ |
2569 | 2570 | ||
2570 | if (rbd_dev->mapping.snap_id == snap->id) | 2571 | if (rbd_dev->snap_id == snap->id) |
2571 | rbd_dev->mapping.snap_exists = false; | 2572 | rbd_dev->mapping.snap_exists = false; |
2572 | rbd_remove_snap_dev(snap); | 2573 | rbd_remove_snap_dev(snap); |
2573 | dout("%ssnap id %llu has been removed\n", | 2574 | dout("%ssnap id %llu has been removed\n", |
2574 | rbd_dev->mapping.snap_id == snap->id ? | 2575 | rbd_dev->snap_id == snap->id ? "mapped " : "", |
2575 | "mapped " : "", | ||
2576 | (unsigned long long) snap->id); | 2576 | (unsigned long long) snap->id); |
2577 | 2577 | ||
2578 | /* Done with this list entry; advance */ | 2578 | /* Done with this list entry; advance */ |
@@ -3256,7 +3256,7 @@ err_out_client: | |||
3256 | rbd_put_client(rbd_dev); | 3256 | rbd_put_client(rbd_dev); |
3257 | kfree(rbd_dev->image_id); | 3257 | kfree(rbd_dev->image_id); |
3258 | err_out_args: | 3258 | err_out_args: |
3259 | kfree(rbd_dev->mapping.snap_name); | 3259 | kfree(rbd_dev->snap_name); |
3260 | kfree(rbd_dev->image_name); | 3260 | kfree(rbd_dev->image_name); |
3261 | kfree(rbd_dev->pool_name); | 3261 | kfree(rbd_dev->pool_name); |
3262 | err_out_mem: | 3262 | err_out_mem: |
@@ -3309,7 +3309,7 @@ static void rbd_dev_release(struct device *dev) | |||
3309 | rbd_header_free(&rbd_dev->header); | 3309 | rbd_header_free(&rbd_dev->header); |
3310 | 3310 | ||
3311 | /* done with the id, and with the rbd_dev */ | 3311 | /* done with the id, and with the rbd_dev */ |
3312 | kfree(rbd_dev->mapping.snap_name); | 3312 | kfree(rbd_dev->snap_name); |
3313 | kfree(rbd_dev->image_id); | 3313 | kfree(rbd_dev->image_id); |
3314 | kfree(rbd_dev->header_name); | 3314 | kfree(rbd_dev->header_name); |
3315 | kfree(rbd_dev->pool_name); | 3315 | kfree(rbd_dev->pool_name); |