]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/direct-io.c
block/fs/drivers: remove rw argument from submit_bio
[mirror_ubuntu-artful-kernel.git] / fs / direct-io.c
index 3bf3f20f8ecccee8d4219c44a405787bb624bb53..1bcdd5dde00d1a2b432e1a907a656a71b0760f8d 100644 (file)
@@ -375,6 +375,7 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio,
 
        bio->bi_bdev = bdev;
        bio->bi_iter.bi_sector = first_sector;
+       bio->bi_rw = dio->rw;
        if (dio->is_async)
                bio->bi_end_io = dio_bio_end_aio;
        else
@@ -412,7 +413,7 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio)
                               sdio->logical_offset_in_bio);
                dio->bio_cookie = BLK_QC_T_NONE;
        } else
-               dio->bio_cookie = submit_bio(dio->rw, bio);
+               dio->bio_cookie = submit_bio(bio);
 
        sdio->bio = NULL;
        sdio->boundary = 0;
@@ -628,11 +629,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 +641,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;
                }