aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-07-19 09:49:18 -0400
committerSage Weil <sage@inktank.com>2012-07-30 21:15:41 -0400
commit75fe9e19816d6ed3e90f1bd3b741f99bf030e848 (patch)
tree55d3b46400f943e365ff7fe505528f5749233a14 /drivers/block/rbd.c
parenta71b891bc7d77a070e723c8c53d1dd73cf931555 (diff)
rbd: don't use snapc->seq that way
In what appears to be an artifact of a different way of encoding whether an rbd image maps a snapshot, __rbd_refresh_header() has code that arranges to update the seq value in an rbd image's snapshot context to point to the first entry in its snapshot array if that's where it was pointing initially. We now use rbd_dev->snap_id to record the snapshot id--using the special value CEPH_NOSNAP to indicate the rbd_dev is not mapping a snapshot at all. There is therefore no need to check for this case, nor to update the seq value, in __rbd_refresh_header(). Just preserve the seq value that rbd_read_header() provides (which, at the moment, is nothing). 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.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 4d3a1e02130b..8a4659997e05 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1718,8 +1718,6 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev)
1718{ 1718{
1719 int ret; 1719 int ret;
1720 struct rbd_image_header h; 1720 struct rbd_image_header h;
1721 u64 snap_seq;
1722 int follow_seq = 0;
1723 1721
1724 ret = rbd_read_header(rbd_dev, &h); 1722 ret = rbd_read_header(rbd_dev, &h);
1725 if (ret < 0) 1723 if (ret < 0)
@@ -1735,13 +1733,6 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev)
1735 set_capacity(rbd_dev->disk, size); 1733 set_capacity(rbd_dev->disk, size);
1736 } 1734 }
1737 1735
1738 snap_seq = rbd_dev->header.snapc->seq;
1739 if (rbd_dev->header.total_snaps &&
1740 rbd_dev->header.snapc->snaps[0] == snap_seq)
1741 /* pointing at the head, will need to follow that
1742 if head moves */
1743 follow_seq = 1;
1744
1745 /* rbd_dev->header.object_prefix shouldn't change */ 1736 /* rbd_dev->header.object_prefix shouldn't change */
1746 kfree(rbd_dev->header.snap_sizes); 1737 kfree(rbd_dev->header.snap_sizes);
1747 kfree(rbd_dev->header.snap_names); 1738 kfree(rbd_dev->header.snap_names);
@@ -1759,11 +1750,6 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev)
1759 WARN_ON(strcmp(rbd_dev->header.object_prefix, h.object_prefix)); 1750 WARN_ON(strcmp(rbd_dev->header.object_prefix, h.object_prefix));
1760 kfree(h.object_prefix); 1751 kfree(h.object_prefix);
1761 1752
1762 if (follow_seq)
1763 rbd_dev->header.snapc->seq = rbd_dev->header.snapc->snaps[0];
1764 else
1765 rbd_dev->header.snapc->seq = snap_seq;
1766
1767 ret = __rbd_init_snaps_header(rbd_dev); 1753 ret = __rbd_init_snaps_header(rbd_dev);
1768 1754
1769 up_write(&rbd_dev->header_rwsem); 1755 up_write(&rbd_dev->header_rwsem);