From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/2] preadv/preadv03.c: Add new testcase
Date: Fri, 6 Apr 2018 15:02:48 +0200 [thread overview]
Message-ID: <20180406130248.GB6328@rei> (raw)
In-Reply-To: <1523011818-5412-1-git-send-email-yangx.jy@cn.fujitsu.com>
Hi!
> +static void setup(void)
> +{
> + pgsz = getpagesize();
> + tst_off1 = pgsz;
> + tst_off2 = pgsz * 3 / 2;
> + exp_sz1 = pgsz;
> + exp_sz2 = pgsz / 2;
> +
> + fd = SAFE_OPEN(FNAME, O_RDWR | O_CREAT | O_DIRECT, 0644);
> +
> + pop_buf = SAFE_MEMALIGN(pgsz, pgsz);
> + memset(pop_buf, 0x61, pgsz);
> + SAFE_WRITE(1, fd, pop_buf, pgsz);
> +
> + memset(pop_buf, 0x62, pgsz);
> + SAFE_WRITE(1, fd, pop_buf, pgsz);
> +
> + rd_iovec = SAFE_MEMALIGN(pgsz, pgsz + sizeof(size_t));
> + rd_iovec->iov_base = SAFE_MEMALIGN(pgsz, pgsz);
> + rd_iovec->iov_len = pgsz;
The open(2) manual page says that O_DIRECT buffers should be aligned to
disk block size which can be queried by BLKSSZGET ioctl(). And I suppose
that the offsets should be multiple of the disk block size as well.
> +}
> +
> +static void cleanup(void)
> +{
> + free(pop_buf);
> + free(rd_iovec->iov_base);
> + free(rd_iovec);
> +
> + if (fd > 0)
> + SAFE_CLOSE(fd);
> +}
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2018-04-06 13:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-30 8:53 [LTP] [PATCH 1/2] syscalls/preadv01: Run test for all filesystems Xiao Yang
2018-03-30 8:53 ` [LTP] [PATCH 2/2] syscalls/pwritev01: " Xiao Yang
2018-04-05 9:52 ` [LTP] [PATCH 1/2] syscalls/preadv01: " Cyril Hrubis
2018-04-05 10:56 ` Xiao Yang
2018-04-05 11:02 ` Cyril Hrubis
2018-04-06 10:50 ` [LTP] [PATCH v2 1/2] preadv/preadv03.c: Add new testcase Xiao Yang
2018-04-06 10:50 ` [LTP] [PATCH v2 2/2] pwritev/pwritev03.c: " Xiao Yang
2018-04-06 13:02 ` Cyril Hrubis [this message]
2018-04-09 3:24 ` [LTP] [PATCH v3 1/2] preadv/preadv03.c: " Xiao Yang
2018-04-09 3:24 ` [LTP] [PATCH v3 2/2] pwritev/pwritev03.c: " Xiao Yang
2018-04-09 12:57 ` [LTP] [PATCH v3 1/2] preadv/preadv03.c: " Cyril Hrubis
2018-04-10 2:32 ` [LTP] [PATCH v4 " Xiao Yang
2018-04-10 2:32 ` [LTP] [PATCH v4 2/2] pwritev/pwritev03.c: " Xiao Yang
2018-04-12 11:15 ` [LTP] [PATCH v4 1/2] preadv/preadv03.c: " Cyril Hrubis
2018-04-10 2:42 ` [LTP] [PATCH v3 " Xiao Yang
2018-04-09 3:34 ` [LTP] [PATCH v2 " Xiao Yang
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=20180406130248.GB6328@rei \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/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