| To: | Lukas Czerner <lczerner@xxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH 2/6] xfstests: Add fallocate zero range operation to fsstress |
| From: | Dave Chinner <david@xxxxxxxxxxxxx> |
| Date: | Wed, 26 Feb 2014 07:15:40 +1100 |
| Cc: | linux-ext4@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1393355728-12056-2-git-send-email-lczerner@xxxxxxxxxx> |
| References: | <1393355728-12056-1-git-send-email-lczerner@xxxxxxxxxx> <1393355728-12056-2-git-send-email-lczerner@xxxxxxxxxx> |
| User-agent: | Mutt/1.5.21 (2010-09-15) |
On Tue, Feb 25, 2014 at 08:15:24PM +0100, Lukas Czerner wrote:
> Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx>
commit message?
> @@ -2561,6 +2567,62 @@ punch_f(int opno, long r)
> }
>
> void
> +zero_f(int opno, long r)
> +{
> +#ifdef FALLOCATE
> + int e;
> + pathname_t f;
> + int fd;
> + __int64_t lr;
> + off64_t off;
> + off64_t len;
> + struct stat64 stb;
> + int v;
> + char st[1024];
[snip]
We now have 3 copies of this fallocate code, the only difference
between the copies being the mode:
> + int mode = FALLOC_FL_ZERO_RANGE;
passed into the fallocate function. Please factor.
> +
> + init_pathname(&f);
> + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
> + if (v)
> + printf("%d/%d: zero range - no filename\n", procid,
> opno);
> + free_pathname(&f);
> + return;
> + }
> + fd = open_path(&f, O_RDWR);
> + e = fd < 0 ? errno : 0;
while you are there, get rid of the ternary operations and just use
if (fd < 0)
e = errno;
> + check_cwd();
This can go after we've checked for an error on open, which avoids
needing to save the errno....
Cheers,
Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 6/6] ext4/242: Add ext4 specific test for fallocate zero range, Lukas Czerner |
|---|---|
| Next by Date: | Re: [PATCH 3/6] xfstests: fsstress punch should always have FALLOC_FL_KEEP_SIZE set, Dave Chinner |
| Previous by Thread: | [PATCH 2/6] xfstests: Add fallocate zero range operation to fsstress, Lukas Czerner |
| Next by Thread: | [PATCH 5/6] xfstests: Define fallocate flags locally in fsx, Lukas Czerner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |