]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ocfs2: Fix heartbeat sector calculation
authorMathieu Avila <mathieu.avila@seanodes.com>
Wed, 13 Sep 2006 18:11:27 +0000 (11:11 -0700)
committerMark Fasheh <mark.fasheh@oracle.com>
Wed, 20 Sep 2006 22:50:53 +0000 (15:50 -0700)
This fixes things for devices which set max_sectors to 8.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/ocfs2/cluster/heartbeat.c

index 504595d6cf65c0f966aaf0d8ee3ce725837ac020..305cba3681fe0126b4d1e33dd58c3b0cc3bea8a5 100644 (file)
@@ -320,8 +320,12 @@ static int compute_max_sectors(struct block_device *bdev)
                max_pages = q->max_hw_segments;
        max_pages--; /* Handle I/Os that straddle a page */
 
-       max_sectors = max_pages << (PAGE_SHIFT - 9);
-
+       if (max_pages) {
+               max_sectors = max_pages << (PAGE_SHIFT - 9);
+       } else {
+               /* If BIO contains 1 or less than 1 page. */
+               max_sectors = q->max_sectors;
+       }
        /* Why is fls() 1-based???? */
        pow_two_sectors = 1 << (fls(max_sectors) - 1);