SG: clear termination bit in sg_chain()
authorJens Axboe <jens.axboe@oracle.com>
Fri, 26 Oct 2007 07:32:16 +0000 (09:32 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 29 Oct 2007 08:18:03 +0000 (09:18 +0100)
Since we are using the last entry in the list, clear any possible
termination bit that may have already been set. Pointed out by Rusty.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
include/linux/scatterlist.h

index 4571231..b2ec842 100644 (file)
@@ -179,7 +179,11 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
 #ifndef ARCH_HAS_SG_CHAIN
        BUG();
 #endif
-       prv[prv_nents - 1].page_link = (unsigned long) sgl | 0x01;
+       /*
+        * Set lowest bit to indicate a link pointer, and make sure to clear
+        * the termination bit if it happens to be set.
+        */
+       prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02;
 }
 
 /**