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

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

 



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@xxxxxxx>
---
 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;
 	}

-- 

--
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