Browse Source

ocfs2: Fix heartbeat sector calculation

This fixes things for devices which set max_sectors to 8.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Mathieu Avila 18 years ago
parent
commit
471e3f5728
1 changed files with 6 additions and 2 deletions
  1. 6 2
      fs/ocfs2/cluster/heartbeat.c

+ 6 - 2
fs/ocfs2/cluster/heartbeat.c

@@ -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);