From: Zheng Liu <gnehzuil.liu@gmail.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 3/6] libext2fs: iterate past lower extents during punch
Date: Tue, 21 Jan 2014 15:40:11 +0800 [thread overview]
Message-ID: <20140121074011.GD1819@gmail.com> (raw)
In-Reply-To: <20140121062158.20507.50066.stgit@birch.djwong.org>
On Mon, Jan 20, 2014 at 10:21:58PM -0800, Darrick J. Wong wrote:
> When we're iterating extents during a punch operation, the loop exits
> if the punch region is entirely to the right of the extent we're
> looking at. This can happen if the punch region starts in the middle
> of a hole and covers mapped extents. When this happens, we want to
> skip to the next extent, because it might be punchable.
>
> Also, if we've totally passed the punch range, stop.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
- Zheng
> ---
> lib/ext2fs/punch.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
>
> diff --git a/lib/ext2fs/punch.c b/lib/ext2fs/punch.c
> index 25d7953..657cb53 100644
> --- a/lib/ext2fs/punch.c
> +++ b/lib/ext2fs/punch.c
> @@ -288,8 +288,12 @@ static errcode_t ext2fs_punch_extent(ext2_filsys fs, ext2_ino_t ino,
> (unsigned long long) end,
> (unsigned long long) next);
> if (start <= extent.e_lblk) {
> + /*
> + * Have we iterated past the end of the punch region?
> + * If so, we can stop.
> + */
> if (end < extent.e_lblk)
> - goto next_extent;
> + break;
> dbg_printf("Case #%d\n", 1);
> /* Start of deleted region before extent;
> adjust beginning of extent */
> @@ -303,8 +307,13 @@ static errcode_t ext2fs_punch_extent(ext2_filsys fs, ext2_ino_t ino,
> extent.e_lblk += free_count;
> extent.e_pblk += free_count;
> } else if (end >= next-1) {
> + /*
> + * Is the punch region beyond this extent? This can
> + * happen if start is already inside a hole. Try to
> + * advance to the next extent if this is the case.
> + */
> if (start >= next)
> - break;
> + goto next_extent;
> /* End of deleted region after extent;
> adjust end of extent */
> dbg_printf("Case #%d\n", 2);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-01-21 7:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-21 6:21 [PATCH 0/6] miscellaneous e2fsprogs fixes Darrick J. Wong
2014-01-21 6:21 ` [PATCH 1/6] misc: fix resource leaks in e2fsprogs Darrick J. Wong
2014-01-21 7:25 ` Zheng Liu
2014-01-21 18:18 ` Darrick J. Wong
2014-01-21 6:21 ` [PATCH 2/6] mke2fs: clean up kernel version tests Darrick J. Wong
2014-01-21 7:32 ` Zheng Liu
2014-02-06 20:28 ` Theodore Ts'o
2014-01-21 6:21 ` [PATCH 3/6] libext2fs: iterate past lower extents during punch Darrick J. Wong
2014-01-21 7:40 ` Zheng Liu [this message]
2014-02-06 20:29 ` Theodore Ts'o
2014-01-21 6:22 ` [PATCH 4/6] libext2fs: during punch, fix parent extents after modifying extent Darrick J. Wong
2014-01-21 7:43 ` Zheng Liu
2014-02-06 20:31 ` Theodore Ts'o
2014-01-21 6:22 ` [PATCH 5/6] libext2fs: don't hang on to unmapped block if extent tree update fails Darrick J. Wong
2014-01-21 7:45 ` Zheng Liu
2014-01-21 6:22 ` [PATCH 6/6] libext2fs: try to roll back when splitting an extent fails Darrick J. Wong
2014-01-21 7:49 ` Zheng Liu
2014-02-06 20:34 ` Theodore Ts'o
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=20140121074011.GD1819@gmail.com \
--to=gnehzuil.liu@gmail.com \
--cc=darrick.wong@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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).