x86/cpu: Rename "WESTMERE2" family to "NEHALEM_G"
[cascardo/linux.git] / fs / direct-io.c
index 3bf3f20..f3b4408 100644 (file)
@@ -628,11 +628,11 @@ static int get_more_blocks(struct dio *dio, struct dio_submit *sdio,
                map_bh->b_size = fs_count << i_blkbits;
 
                /*
-                * For writes inside i_size on a DIO_SKIP_HOLES filesystem we
-                * forbid block creations: only overwrites are permitted.
-                * We will return early to the caller once we see an
-                * unmapped buffer head returned, and the caller will fall
-                * back to buffered I/O.
+                * For writes that could fill holes inside i_size on a
+                * DIO_SKIP_HOLES filesystem we forbid block creations: only
+                * overwrites are permitted. We will return early to the caller
+                * once we see an unmapped buffer head returned, and the caller
+                * will fall back to buffered I/O.
                 *
                 * Otherwise the decision is left to the get_blocks method,
                 * which may decide to handle it or also return an unmapped
@@ -640,8 +640,8 @@ static int get_more_blocks(struct dio *dio, struct dio_submit *sdio,
                 */
                create = dio->rw & WRITE;
                if (dio->flags & DIO_SKIP_HOLES) {
-                       if (sdio->block_in_file < (i_size_read(dio->inode) >>
-                                                       sdio->blkbits))
+                       if (fs_startblk <= ((i_size_read(dio->inode) - 1) >>
+                                                       i_blkbits))
                                create = 0;
                }