浏览代码

[SG] Add debug check for page alignment

Suggested by Boaz Harrosh <bharrosh@panasas.com>

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe 17 年之前
父节点
当前提交
de26103de5
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      include/linux/scatterlist.h

+ 5 - 0
include/linux/scatterlist.h

@@ -41,6 +41,11 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page)
 {
 	unsigned long page_link = sg->page_link & 0x3;
 
+	/*
+	 * In order for the low bit stealing approach to work, pages
+	 * must be aligned at a 32-bit boundary as a minimum.
+	 */
+	BUG_ON((unsigned long) page & 0x03);
 #ifdef CONFIG_DEBUG_SG
 	BUG_ON(sg->sg_magic != SG_MAGIC);
 #endif