Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6
[powerpc.git] / fs / ocfs2 / cluster / heartbeat.c
index 504595d..4cd9a95 100644 (file)
@@ -141,7 +141,7 @@ struct o2hb_region {
         * recognizes a node going up and down in one iteration */
        u64                     hr_generation;
 
-       struct work_struct      hr_write_timeout_work;
+       struct delayed_work     hr_write_timeout_work;
        unsigned long           hr_last_timeout_start;
 
        /* Used during o2hb_check_slot to hold a copy of the block
@@ -156,9 +156,11 @@ struct o2hb_bio_wait_ctxt {
        int               wc_error;
 };
 
-static void o2hb_write_timeout(void *arg)
+static void o2hb_write_timeout(struct work_struct *work)
 {
-       struct o2hb_region *reg = arg;
+       struct o2hb_region *reg =
+               container_of(work, struct o2hb_region,
+                            hr_write_timeout_work.work);
 
        mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u "
             "milliseconds\n", reg->hr_dev_name,
@@ -320,8 +322,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);
 
@@ -1400,7 +1406,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
                goto out;
        }
 
-       INIT_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout, reg);
+       INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout);
 
        /*
         * A node is considered live after it has beat LIVE_THRESHOLD