diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 17:09:00 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 17:09:00 -0800 |
commit | 80eabba70260dcb55b05098f6c1fecbe5c0e518b (patch) | |
tree | c9f5d19803a3387d2b9d8a6998eb9c58bad2a15a /fs/direct-io.c | |
parent | 852d21ae1fcdf0e4de6b5bfa730d29cb013c7ff3 (diff) | |
parent | ce98321bf7d274a470642ef99e1d82512673ce7c (diff) | |
download | linux-80eabba70260dcb55b05098f6c1fecbe5c0e518b.tar.bz2 |
Merge branch 'for-4.10/fs-unmap' of git://git.kernel.dk/linux-block
Pull fs meta data unmap optimization from Jens Axboe:
"A series from Jan Kara, providing a more efficient way for unmapping
meta data from in the buffer cache than doing it block-by-block.
Provide a general helper that existing callers can use"
* 'for-4.10/fs-unmap' of git://git.kernel.dk/linux-block:
fs: Remove unmap_underlying_metadata
fs: Add helper to clean bdev aliases under a bh and use it
ext2: Use clean_bdev_aliases() instead of iteration
ext4: Use clean_bdev_aliases() instead of iteration
direct-io: Use clean_bdev_aliases() instead of handmade iteration
fs: Provide function to unmap metadata for a range of blocks
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r-- | fs/direct-io.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c index 835e23a4ee4b..86aa79859d4d 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -843,24 +843,6 @@ out: } /* - * Clean any dirty buffers in the blockdev mapping which alias newly-created - * file blocks. Only called for S_ISREG files - blockdevs do not set - * buffer_new - */ -static void clean_blockdev_aliases(struct dio *dio, struct buffer_head *map_bh) -{ - unsigned i; - unsigned nblocks; - - nblocks = map_bh->b_size >> dio->inode->i_blkbits; - - for (i = 0; i < nblocks; i++) { - unmap_underlying_metadata(map_bh->b_bdev, - map_bh->b_blocknr + i); - } -} - -/* * If we are not writing the entire block and get_block() allocated * the block for us, we need to fill-in the unused portion of the * block with zeros. This happens only if user-buffer, fileoffset or @@ -960,11 +942,15 @@ static int do_direct_IO(struct dio *dio, struct dio_submit *sdio, goto do_holes; sdio->blocks_available = - map_bh->b_size >> sdio->blkbits; + map_bh->b_size >> blkbits; sdio->next_block_for_io = map_bh->b_blocknr << sdio->blkfactor; - if (buffer_new(map_bh)) - clean_blockdev_aliases(dio, map_bh); + if (buffer_new(map_bh)) { + clean_bdev_aliases( + map_bh->b_bdev, + map_bh->b_blocknr, + map_bh->b_size >> blkbits); + } if (!sdio->blkfactor) goto do_holes; |