diff options
author | Alex Elder <elder@inktank.com> | 2012-07-19 09:49:18 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-07-30 21:15:43 -0400 |
commit | 505cbb9bedc8c609c31d86ff4f8f656e5a0f9c49 (patch) | |
tree | 460fca717d94ec4b897078e8201dca35b3fdcdcc /drivers/block/rbd.c | |
parent | 78dc447d3ca3701206a1dd813c901556a3fad451 (diff) |
rbd: set snapc->seq only when refreshing header
In rbd_header_add_snap() there is code to set snapc->seq to the
just-added snapshot id. This is the only remnant left of the
use of that field for recording which snapshot an rbd_dev was
associated with. That functionality is no longer supported,
so get rid of that final bit of code.
Doing so means we never actually set snapc->seq any more. On the
server, the snapshot context's sequence value represents the highest
snapshot id ever issued for a particular rbd image. So we'll make
it have that meaning here as well. To do so, set this value
whenever the rbd header is (re-)read. That way it will always be
consistent with the rest of the snapshot context we maintain.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index ac8a83fc2ad9..c299a55e3ff1 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -537,6 +537,7 @@ static int rbd_header_from_disk(struct rbd_image_header *header, | |||
537 | 537 | ||
538 | atomic_set(&header->snapc->nref, 1); | 538 | atomic_set(&header->snapc->nref, 1); |
539 | header->snap_seq = le64_to_cpu(ondisk->snap_seq); | 539 | header->snap_seq = le64_to_cpu(ondisk->snap_seq); |
540 | header->snapc->seq = le64_to_cpu(ondisk->snap_seq); | ||
540 | header->snapc->num_snaps = snap_count; | 541 | header->snapc->num_snaps = snap_count; |
541 | header->total_snaps = snap_count; | 542 | header->total_snaps = snap_count; |
542 | 543 | ||
@@ -1685,14 +1686,7 @@ static int rbd_header_add_snap(struct rbd_device *rbd_dev, | |||
1685 | 1686 | ||
1686 | kfree(data); | 1687 | kfree(data); |
1687 | 1688 | ||
1688 | if (ret < 0) | 1689 | return ret < 0 ? ret : 0; |
1689 | return ret; | ||
1690 | |||
1691 | down_write(&rbd_dev->header_rwsem); | ||
1692 | rbd_dev->header.snapc->seq = new_snapid; | ||
1693 | up_write(&rbd_dev->header_rwsem); | ||
1694 | |||
1695 | return 0; | ||
1696 | bad: | 1690 | bad: |
1697 | return -ERANGE; | 1691 | return -ERANGE; |
1698 | } | 1692 | } |