From: Jan Kara <jack@suse.cz>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
Jan Kara <jack@suse.cz>
Subject: [PATCH 3/4] ext4: Use unmap_underlying_metadata_ext() instead of iteration
Date: Fri, 21 Oct 2016 13:55:40 +0200 [thread overview]
Message-ID: <1477050941-29682-4-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1477050941-29682-1-git-send-email-jack@suse.cz>
Use unmap_underlying_metadata_ext() instead of iterating through blocks
one by one.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/extents.c | 10 +---------
fs/ext4/inode.c | 13 ++++---------
2 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index c930a0110fb4..0cd47355d919 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3777,14 +3777,6 @@ static int ext4_convert_unwritten_extents_endio(handle_t *handle,
return err;
}
-static void unmap_underlying_metadata_blocks(struct block_device *bdev,
- sector_t block, int count)
-{
- int i;
- for (i = 0; i < count; i++)
- unmap_underlying_metadata(bdev, block + i);
-}
-
/*
* Handle EOFBLOCKS_FL flag, clearing it if necessary
*/
@@ -4121,7 +4113,7 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
* new.
*/
if (allocated > map->m_len) {
- unmap_underlying_metadata_blocks(inode->i_sb->s_bdev,
+ unmap_underlying_metadata_ext(inode->i_sb->s_bdev,
newblock + map->m_len,
allocated - map->m_len);
allocated = map->m_len;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9c064727ed62..e2046742a564 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -654,12 +654,9 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
if (flags & EXT4_GET_BLOCKS_ZERO &&
map->m_flags & EXT4_MAP_MAPPED &&
map->m_flags & EXT4_MAP_NEW) {
- ext4_lblk_t i;
-
- for (i = 0; i < map->m_len; i++) {
- unmap_underlying_metadata(inode->i_sb->s_bdev,
- map->m_pblk + i);
- }
+ unmap_underlying_metadata_ext(inode->i_sb->s_bdev,
+ map->m_pblk,
+ map->m_len);
ret = ext4_issue_zeroout(inode, map->m_lblk,
map->m_pblk, map->m_len);
if (ret) {
@@ -2361,10 +2358,8 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd)
BUG_ON(map->m_len == 0);
if (map->m_flags & EXT4_MAP_NEW) {
struct block_device *bdev = inode->i_sb->s_bdev;
- int i;
- for (i = 0; i < map->m_len; i++)
- unmap_underlying_metadata(bdev, map->m_pblk + i);
+ unmap_underlying_metadata_ext(bdev, map->m_pblk, map->m_len);
}
return 0;
}
--
2.6.6
next prev parent reply other threads:[~2016-10-21 11:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-21 11:55 [PATCH 0/4] fs: Provide function to unmap metadata for a range of blocks Jan Kara
2016-10-21 11:55 ` [PATCH 1/4] " Jan Kara
2016-10-21 12:05 ` Christoph Hellwig
2016-10-24 11:45 ` Jan Kara
2016-10-21 11:55 ` [PATCH 2/4] direct-io: Use unmap_underlying_metadata_ext() instead of handmade iteration Jan Kara
2016-10-21 11:55 ` Jan Kara [this message]
2016-10-21 11:55 ` [PATCH 4/4] ext2: Use unmap_underlying_metadata_ext() instead of iteration Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1477050941-29682-4-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=axboe@kernel.dk \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).