[PATCH 05/10] dm snapshot: Split up origin_resume()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Split the origin_resume() code which calculates the minimum chunk size
of all related snapshots into a separate function, min_chunk_size().

This function will be used by the resume() function for the merged
target.

Signed-off-by: Mark McLoughlin <markmc@xxxxxxxxxx>
---
 drivers/md/dm-snap.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 20f12a8..7684f8f 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1275,13 +1275,8 @@ static int origin_map(struct dm_target *ti, struct bio *bio,
 
 #define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r))
 
-/*
- * Set the target "split_io" field to the minimum of all the snapshots'
- * chunk sizes.
- */
-static void origin_resume(struct dm_target *ti)
+static chunk_t min_chunk_size(struct dm_dev *dev)
 {
-	struct dm_dev *dev = ti->private;
 	struct dm_snapshot *snap;
 	struct origin *o;
 	chunk_t chunk_size = 0;
@@ -1293,7 +1288,18 @@ static void origin_resume(struct dm_target *ti)
 			chunk_size = min_not_zero(chunk_size, snap->chunk_size);
 	up_read(&_origins_lock);
 
-	ti->split_io = chunk_size;
+	return chunk_size;
+}
+
+/*
+ * Set the target "split_io" field to the minimum of all the snapshots'
+ * chunk sizes.
+ */
+static void origin_resume(struct dm_target *ti)
+{
+	struct dm_dev *dev = ti->private;
+
+	ti->split_io = min_chunk_size(dev);
 }
 
 static int origin_status(struct dm_target *ti, status_type_t type, char *result,
-- 
1.5.4.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux