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

[dm-devel] [patch 11/11] dm-snap: Fix snapshot compilation with CONFIG_LBD



The snapshot code validates the snapshot chunksize against the device block
size. Since the block size is usually a power of 2 we don't need to use modulo
here which would let the compiler emit a call to __umoddi3(). Therefore this
patch changes to the test to use a bitmask instead.

Signed-off-by: Jan Blunck <jblunck suse de>
---
 drivers/md/dm-snap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -397,7 +397,7 @@ static int set_chunk_size(struct dm_snap
 	}
 
 	/* Validate the chunk size against the device block size */
-	if (chunk_size % (bdev_hardsect_size(s->cow->bdev) >> 9)) {
+	if (chunk_size & ((bdev_hardsect_size(s->cow->bdev) >> 9) - 1)) {
 		*error = "Chunk size is not a multiple of device blocksize";
 		return -EINVAL;
 	}

-- 


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