summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-exception-store.h
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2009-04-02 20:55:33 +0200
committerAlasdair G Kergon <agk@redhat.com>2009-04-02 20:55:33 +0200
commit71fab00a6bef7fb53119271a8abdbaf40970d28a (patch)
tree4881f8f6d1b1c42528889d7a56fb8674d2aa7723 /drivers/md/dm-exception-store.h
parentdm exception store: move cow pointer (diff)
downloadlinux-71fab00a6bef7fb53119271a8abdbaf40970d28a.tar.xz
linux-71fab00a6bef7fb53119271a8abdbaf40970d28a.zip
dm snapshot: remove dm_snap header use
Move useful functions out of dm-snap.h and stop using dm-snap.h. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-exception-store.h')
-rw-r--r--drivers/md/dm-exception-store.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
index 4dbf3577408e..835f402d9470 100644
--- a/drivers/md/dm-exception-store.h
+++ b/drivers/md/dm-exception-store.h
@@ -97,8 +97,6 @@ struct dm_exception_store {
struct dm_exception_store_type *type;
struct dm_target *ti;
- struct dm_snapshot *snap;
-
struct dm_dev *cow;
/* Size of data blocks saved - must be a power of 2 */
@@ -152,6 +150,20 @@ static inline void dm_consecutive_chunk_count_inc(struct dm_snap_exception *e)
# endif
+/*
+ * Return the number of sectors in the device.
+ */
+static inline sector_t get_dev_size(struct block_device *bdev)
+{
+ return bdev->bd_inode->i_size >> SECTOR_SHIFT;
+}
+
+static inline chunk_t sector_to_chunk(struct dm_exception_store *store,
+ sector_t sector)
+{
+ return (sector & ~store->chunk_mask) >> store->chunk_shift;
+}
+
int dm_exception_store_type_register(struct dm_exception_store_type *type);
int dm_exception_store_type_unregister(struct dm_exception_store_type *type);