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

2 messages, 2 authors, 2009-08-06 · open the first message on its own page

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

From: Martin K. Petersen <hidden>
Date: 2009-08-04 05:28:49

quoted
quoted
quoted
quoted
"Andre" == Andre Noll [off-list ref] 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.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

From: Andre Noll <hidden>
Date: 2009-08-06 08:37:10

On 01:28, Martin K. Petersen wrote:
quoted
quoted
quoted
quoted
quoted
"Andre" == Andre Noll [off-list ref] 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 [off-list ref]
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help