Re: [PATCH/Resend] md: Push down data integrity code to personalities.

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

 



On 01:28, Martin K. Petersen wrote:
> >>>>> "Andre" == Andre Noll <maan@xxxxxxxxxxxxxxx> writes:
> 
> [Inlining blk_get_integrity]
> 
> Andre> IMO this second alternative is be a bit cleaner and it might help
> Andre> other users of blk_get_integrity() as well. Martin, are you OK
> Andre> with this change to blkdev.h?
> 
> Yeah, that's fine.

So here's a patch that replaces the dummy macros for data integrity
by inline functions. The patch is only compile-tesed, but that's
hopefully OK as the new functions are only used if data integrity is
not compiled in and are thrown away by gcc anyway.

Thanks
Andre

commit e550b6fe0850933d1be4c430a22d25f9040c7627
Author: Andre Noll <maan@xxxxxxxxxxxxxxx>
Date:   Thu Aug 6 10:32:37 2009 +0200

    [blkdev.h] Replace dummy macros by inline functions.
    
    This avoids complaints about unused variables and improves type checking.

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 69103e0..81d683f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1191,14 +1191,47 @@ static inline int blk_integrity_rq(struct request *rq)
 
 #else /* CONFIG_BLK_DEV_INTEGRITY */
 
-#define blk_integrity_rq(rq)			(0)
-#define blk_rq_count_integrity_sg(a)		(0)
-#define blk_rq_map_integrity_sg(a, b)		(0)
-#define bdev_get_integrity(a)			(0)
-#define blk_get_integrity(a)			(0)
-#define blk_integrity_compare(a, b)		(0)
-#define blk_integrity_register(a, b)		(0)
-#define blk_integrity_unregister(a)		do { } while (0);
+static inline int blk_integrity_rq(struct request *rq)
+{
+	return 0;
+}
+
+static inline int blk_rq_count_integrity_sg(struct request *rq)
+{
+	return 0;
+}
+
+static inline
+int blk_rq_map_integrity_sg(struct request *rq, struct scatterlist *sglist)
+{
+	return 0;
+}
+
+static inline
+struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
+{
+	return NULL;
+}
+
+static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
+{
+	return NULL;
+}
+
+static inline int blk_integrity_compare(struct gendisk *gd1, struct gendisk *gd2)
+{
+	return 0;
+}
+
+static inline
+int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
+{
+	return 0;
+}
+
+static inline void blk_integrity_unregister(struct gendisk *disk)
+{
+}
 
 #endif /* CONFIG_BLK_DEV_INTEGRITY */
 
-- 
The only person who always got his work done by Friday was Robinson Crusoe

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux