update to 2.6.9-rc1
[linux-flexiantxendom0-3.2.10.git] / fs / xfs / linux-2.6 / xfs_aops.c
index 7122efd..ef8bd10 100644 (file)
@@ -234,6 +234,7 @@ xfs_map_at_offset(
        sector_shift = block_bits - BBSHIFT;
        bn = iomapp->iomap_bn >> sector_shift;
        bn += delta;
+       BUG_ON(!bn && !(iomapp->iomap_flags & IOMAP_REALTIME));
        ASSERT((bn << sector_shift) >= iomapp->iomap_bn);
 
        lock_buffer(bh);
@@ -264,7 +265,7 @@ xfs_probe_unwritten_page(
 
        page = find_trylock_page(mapping, index);
        if (!page)
-               return 0;
+               return NULL;
        if (PageWriteback(page))
                goto out;
 
@@ -938,9 +939,8 @@ linvfs_get_block_core(
 
                        bn = iomap.iomap_bn >> (inode->i_blkbits - BBSHIFT);
                        bn += delta;
-
+                       BUG_ON(!bn && !(iomap.iomap_flags & IOMAP_REALTIME));
                        bh_result->b_blocknr = bn;
-                       bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
                        set_buffer_mapped(bh_result);
                }
                if (create && (iomap.iomap_flags & IOMAP_UNWRITTEN)) {
@@ -965,21 +965,18 @@ linvfs_get_block_core(
        }
 
        if (iomap.iomap_flags & IOMAP_DELAY) {
-               if (unlikely(direct))
-                       BUG();
+               BUG_ON(direct);
                if (create) {
                        set_buffer_mapped(bh_result);
                        set_buffer_uptodate(bh_result);
                }
-               bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
                set_buffer_delay(bh_result);
        }
 
        if (blocks) {
-               loff_t iosize;
-               iosize = (iomap.iomap_bsize - iomap.iomap_delta);
-               bh_result->b_size =
-                   (ssize_t)min(iosize, (loff_t)(blocks << inode->i_blkbits));
+               bh_result->b_size = (ssize_t)min(
+                       (loff_t)(iomap.iomap_bsize - iomap.iomap_delta),
+                       (loff_t)(blocks << inode->i_blkbits));
        }
 
        return 0;
@@ -997,17 +994,6 @@ linvfs_get_block(
 }
 
 STATIC int
-linvfs_get_block_sync(
-       struct inode            *inode,
-       sector_t                iblock,
-       struct buffer_head      *bh_result,
-       int                     create)
-{
-       return linvfs_get_block_core(inode, iblock, 0, bh_result,
-                                       create, 0, BMAPI_SYNC|BMAPI_WRITE);
-}
-
-STATIC int
 linvfs_get_blocks_direct(
        struct inode            *inode,
        sector_t                iblock,
@@ -1261,13 +1247,7 @@ linvfs_prepare_write(
        unsigned int            from,
        unsigned int            to)
 {
-       if (file && (file->f_flags & O_SYNC)) {
-               return block_prepare_write(page, from, to,
-                                               linvfs_get_block_sync);
-       } else {
-               return block_prepare_write(page, from, to,
-                                               linvfs_get_block);
-       }
+       return block_prepare_write(page, from, to, linvfs_get_block);
 }
 
 struct address_space_operations linvfs_aops = {