public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/2] fallocate05: Check that deallocated file range is marked as a hole
Date: Fri, 6 Sep 2024 10:36:28 +0200	[thread overview]
Message-ID: <20240906083628.GA990068@pevik> (raw)
In-Reply-To: <ee93e6ab-6f7c-4241-bb29-7c834935fbd8@suse.cz>

> On 06. 09. 24 10:17, Petr Vorel wrote:
> > Hi Martin,

> > > The new lseek(SEEK_HOLE/SEEK_DATA) checks will be useful for diagnosing
> > > why the final write() check fails with ENOSPC. If the hole doesn't get
> > > created at all, the lseek() checks will fail.

> > Thank you!

> > ...
> > > +	/* Check that the deallocated file range is marked as a hole */
> > > +	TEST(lseek(fd, 0, SEEK_HOLE));
> > > +
> > > +	if (TST_RET == 0) {
> > > +		tst_res(TPASS, "Test file contains hole at offset 0");
> > > +	} else if (TST_RET == -1) {
> > > +		tst_res(TFAIL | TTERRNO, "lseek(SEEK_HOLE) failed");
> > > +	} else {
> > > +		tst_res(TFAIL | TTERRNO,
> > > +			"Unexpected lseek(SEEK_HOLE) return value %ld",
> > > +			TST_RET);
> > > +	}
> > nit: maybe just using SAFE_LSEEK()?

> Definitely no SAFE_LSEEK() here because I want to continue to the second
> lseek() even if the first one fails.

OK, fair enough.

> > > +
> > > +	TEST(lseek(fd, 0, SEEK_DATA));
> > > +
> > > +	if (TST_RET == holesize) {
> > > +		tst_res(TPASS, "Test file data start at offset %ld", TST_RET);
> > > +	} else if (TST_RET == -1) {
> > > +		tst_res(TFAIL | TTERRNO, "lseek(SEEK_DATA) failed");
> > > +	} else {
> > > +		tst_res(TFAIL | TTERRNO,
> > > +			"Unexpected lseek(SEEK_DATA) return value %ld",
> > > +			TST_RET);
> > > +	}

> > nit: and here just:

> > TEST(SAFE_LSEEK(fd, 0, SEEK_DATA));
> > if (TST_RET == holesize)
> > 	tst_res(TPASS, "Test file data start at offset %ld", TST_RET);

> We could use SAFE_LSEEK() here at least until someone decides to add another
> sanity check below it. But we still need the "else" branch to report wrong
> hole size. I'd say it's slightly better to keep it as is for the more
> descriptive error messages.

Fair enough, thx for info.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2024-09-06  8:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05 13:44 [LTP] [PATCH 1/2] fallocate05: Check that deallocated file range is marked as a hole Martin Doucha
2024-09-05 13:45 ` [LTP] [PATCH 2/2] fallocate05: Deallocate whole file on bcachefs Martin Doucha
2024-09-06  3:18   ` Li Wang
2024-09-06  8:02   ` Petr Vorel
2024-09-06 10:12     ` Kent Overstreet
2024-09-10  2:39       ` Li Wang
2024-09-06  1:53 ` [LTP] [PATCH 1/2] fallocate05: Check that deallocated file range is marked as a hole Li Wang
2024-09-06  8:17 ` Petr Vorel
2024-09-06  8:28   ` Martin Doucha
2024-09-06  8:36     ` Petr Vorel [this message]

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=20240906083628.GA990068@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.cz \
    /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