FSTests Archive mirror
 help / color / mirror / Atom feed
From: "Pankaj Raghav (Samsung)" <kernel@pankajraghav.com>
To: fstests@vger.kernel.org
Cc: kernel@pankajraghav.com, gost.dev@samsung.com, mcgrof@kernel.org,
	ritesh.list@gmail.com, djwong@kernel.org, zlang@redhat.com,
	Pankaj Raghav <p.raghav@samsung.com>
Subject: [PATCH v2 2/3] generic/436: round up bufsz to nearest filesystem blksz
Date: Mon, 13 May 2024 07:12:53 -0600	[thread overview]
Message-ID: <20240513131254.92412-3-kernel@pankajraghav.com> (raw)
In-Reply-To: <20240513131254.92412-1-kernel@pankajraghav.com>

From: Pankaj Raghav <p.raghav@samsung.com>

SEEK_HOLE and SEEK_DATA work in filesystem block size granularity. So
while filling up the buffer for test 13 - 16, round up the bufsz to the
closest filesystem blksz.

As we only allowed blocksizes lower than the pagesize, this was never an
issue and it always aligned. Once we have blocksize > pagesize, this
assumption will break.

Fixes the test for LBS configuration.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 src/seek_sanity_test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c
index 48b3ccc0..a61ed3da 100644
--- a/src/seek_sanity_test.c
+++ b/src/seek_sanity_test.c
@@ -541,7 +541,7 @@ static int test16(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE);
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE), alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
@@ -591,7 +591,7 @@ static int test15(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE);
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE), alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
@@ -643,7 +643,7 @@ static int test14(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE) * 14;
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE) * 14, alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
@@ -692,7 +692,7 @@ static int test13(int fd, int testnum)
 {
 	int ret = 0;
 	char *buf = NULL;
-	int bufsz = sysconf(_SC_PAGE_SIZE) * 14;
+	int bufsz = roundup(sysconf(_SC_PAGE_SIZE) * 14, alloc_size);
 	int filsz = 4 << 20;
 
 	if (!unwritten_extents) {
-- 
2.34.1


  parent reply	other threads:[~2024-05-13 13:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13 13:12 [PATCH v2 0/3] more lbs test fixes Pankaj Raghav (Samsung)
2024-05-13 13:12 ` [PATCH v2 1/3] xfs/161: adapt the test case for 64k FS blocksize Pankaj Raghav (Samsung)
2024-05-14 12:19   ` Ritesh Harjani
2024-05-13 13:12 ` Pankaj Raghav (Samsung) [this message]
2024-05-17 15:54   ` [PATCH v2 2/3] generic/436: round up bufsz to nearest filesystem blksz Darrick J. Wong
2024-05-22 20:48   ` Ritesh Harjani
2024-05-13 13:12 ` [PATCH v2 3/3] xfs/008: use block size instead of the pagesize Pankaj Raghav (Samsung)
2024-05-23  4:25   ` Ritesh Harjani
2024-05-27 11:42     ` Pankaj Raghav (Samsung)
2024-05-25  5:48 ` [PATCH v2 0/3] more lbs test fixes Zorro Lang

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=20240513131254.92412-3-kernel@pankajraghav.com \
    --to=kernel@pankajraghav.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=gost.dev@samsung.com \
    --cc=mcgrof@kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=ritesh.list@gmail.com \
    --cc=zlang@redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).