diff options
author | Alex Elder <elder@inktank.com> | 2012-08-30 15:42:15 -0400 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2012-10-01 15:30:51 -0400 |
commit | c9aadfe7860f83ee17e55fe17398f3fe948a0a84 (patch) | |
tree | 37bf444e7bb006a7643050c6b33000797a76bae0 /drivers/block | |
parent | 98cec111c08d8d52168e28648b4a1c2f5011cd70 (diff) |
rbd: kill rbd_image_header->total_snaps
The "total_snaps" field in an rbd header structure is never any
different from the value of "num_snaps" stored within a snapshot
context. Avoid any confusion by just using the value held within
the snapshot context, and get rid of the "total_snaps" field.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 774a36bb00ed..eb6b7723906b 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -87,7 +87,6 @@ struct rbd_image_header { | |||
87 | __u8 crypt_type; | 87 | __u8 crypt_type; |
88 | __u8 comp_type; | 88 | __u8 comp_type; |
89 | struct ceph_snap_context *snapc; | 89 | struct ceph_snap_context *snapc; |
90 | u32 total_snaps; | ||
91 | 90 | ||
92 | char *snap_names; | 91 | char *snap_names; |
93 | u64 *snap_sizes; | 92 | u64 *snap_sizes; |
@@ -588,7 +587,6 @@ static int rbd_header_from_disk(struct rbd_image_header *header, | |||
588 | header->obj_order = ondisk->options.order; | 587 | header->obj_order = ondisk->options.order; |
589 | header->crypt_type = ondisk->options.crypt_type; | 588 | header->crypt_type = ondisk->options.crypt_type; |
590 | header->comp_type = ondisk->options.comp_type; | 589 | header->comp_type = ondisk->options.comp_type; |
591 | header->total_snaps = snap_count; | ||
592 | 590 | ||
593 | /* Allocate and fill in the snapshot context */ | 591 | /* Allocate and fill in the snapshot context */ |
594 | 592 | ||
@@ -624,7 +622,8 @@ static int snap_by_name(struct rbd_image_header *header, const char *snap_name, | |||
624 | int i; | 622 | int i; |
625 | char *p = header->snap_names; | 623 | char *p = header->snap_names; |
626 | 624 | ||
627 | for (i = 0; i < header->total_snaps; i++) { | 625 | rbd_assert(header->snapc != NULL); |
626 | for (i = 0; i < header->snapc->num_snaps; i++) { | ||
628 | if (!strcmp(snap_name, p)) { | 627 | if (!strcmp(snap_name, p)) { |
629 | 628 | ||
630 | /* Found it. Pass back its id and/or size */ | 629 | /* Found it. Pass back its id and/or size */ |
@@ -1839,7 +1838,6 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev, u64 *hver) | |||
1839 | *hver = h.obj_version; | 1838 | *hver = h.obj_version; |
1840 | rbd_dev->header.obj_version = h.obj_version; | 1839 | rbd_dev->header.obj_version = h.obj_version; |
1841 | rbd_dev->header.image_size = h.image_size; | 1840 | rbd_dev->header.image_size = h.image_size; |
1842 | rbd_dev->header.total_snaps = h.total_snaps; | ||
1843 | rbd_dev->header.snapc = h.snapc; | 1841 | rbd_dev->header.snapc = h.snapc; |
1844 | rbd_dev->header.snap_names = h.snap_names; | 1842 | rbd_dev->header.snap_names = h.snap_names; |
1845 | rbd_dev->header.snap_sizes = h.snap_sizes; | 1843 | rbd_dev->header.snap_sizes = h.snap_sizes; |