From: Alex Elder <aelder@sgi.com>
To: Grazvydas Ignotas <notasas@gmail.com>
Cc: <xfs@oss.sgi.com>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] xfstests: add new getdents test
Date: Thu, 22 Sep 2011 15:18:22 -0500 [thread overview]
Message-ID: <1316722702.2009.59.camel@doink> (raw)
In-Reply-To: <1315786747-12109-1-git-send-email-notasas@gmail.com>
On Mon, 2011-09-12 at 03:19 +0300, Grazvydas Ignotas wrote:
> The test checks if no duplicate d_off values are returned and that
> those values are seekable to the right inodes.
>
> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
I have two minor comments on the C program below,
but even if you don't want to address them this
looks good.
Reviewed-by: Alex Elder <aelder@sgi.com>
. . .
> +#include <sys/syscall.h>
> +
> +struct linux_dirent64 {
> + uint64_t d_ino;
> + uint64_t d_off;
> + unsigned short d_reclen;
> + unsigned char d_type;
> + char d_name[0];
> +};
> +
> +#define BUF_SIZE 4096
> +#define HISTORY_LEN 1024
> +
> +static uint64_t d_off_histoty[HISTORY_LEN];
> +static uint64_t d_ino_histoty[HISTORY_LEN];
Is "histoty" intentional or a typo?
> +int
> +main(int argc, char *argv[])
> +{
> + int fd, nread;
> + char buf[BUF_SIZE];
. . .
> +
> + /* check if seek works correctly */
> + d = (struct linux_dirent64 *)buf;
> + for (i = total - 1; i >= 0; i--)
> + {
> + lret = lseek(fd, i > 0 ? d_off_histoty[i - 1] : 0, SEEK_SET);
> + if (lret == -1) {
> + perror("lseek");
> + exit(EXIT_FAILURE);
> + }
> +
> + nread = syscall(SYS_getdents64, fd, buf, BUF_SIZE);
You could just use sizeof (struct linux_dirent_64) rather than
BUF_SIZE here. I suppose it doesn't hurt but there's no real
sense in reading more than the one you're going to look at.
> + if (nread == -1) {
> + perror("getdents");
> + exit(EXIT_FAILURE);
> + }
> +
. . .
WARNING: multiple messages have this Message-ID (diff)
From: Alex Elder <aelder@sgi.com>
To: Grazvydas Ignotas <notasas@gmail.com>
Cc: linux-btrfs@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH] xfstests: add new getdents test
Date: Thu, 22 Sep 2011 15:18:22 -0500 [thread overview]
Message-ID: <1316722702.2009.59.camel@doink> (raw)
In-Reply-To: <1315786747-12109-1-git-send-email-notasas@gmail.com>
On Mon, 2011-09-12 at 03:19 +0300, Grazvydas Ignotas wrote:
> The test checks if no duplicate d_off values are returned and that
> those values are seekable to the right inodes.
>
> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
I have two minor comments on the C program below,
but even if you don't want to address them this
looks good.
Reviewed-by: Alex Elder <aelder@sgi.com>
. . .
> +#include <sys/syscall.h>
> +
> +struct linux_dirent64 {
> + uint64_t d_ino;
> + uint64_t d_off;
> + unsigned short d_reclen;
> + unsigned char d_type;
> + char d_name[0];
> +};
> +
> +#define BUF_SIZE 4096
> +#define HISTORY_LEN 1024
> +
> +static uint64_t d_off_histoty[HISTORY_LEN];
> +static uint64_t d_ino_histoty[HISTORY_LEN];
Is "histoty" intentional or a typo?
> +int
> +main(int argc, char *argv[])
> +{
> + int fd, nread;
> + char buf[BUF_SIZE];
. . .
> +
> + /* check if seek works correctly */
> + d = (struct linux_dirent64 *)buf;
> + for (i = total - 1; i >= 0; i--)
> + {
> + lret = lseek(fd, i > 0 ? d_off_histoty[i - 1] : 0, SEEK_SET);
> + if (lret == -1) {
> + perror("lseek");
> + exit(EXIT_FAILURE);
> + }
> +
> + nread = syscall(SYS_getdents64, fd, buf, BUF_SIZE);
You could just use sizeof (struct linux_dirent_64) rather than
BUF_SIZE here. I suppose it doesn't hurt but there's no real
sense in reading more than the one you're going to look at.
> + if (nread == -1) {
> + perror("getdents");
> + exit(EXIT_FAILURE);
> + }
> +
. . .
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-09-22 20:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-12 0:19 [PATCH] xfstests: add new getdents test Grazvydas Ignotas
2011-09-12 0:19 ` Grazvydas Ignotas
2011-09-13 12:58 ` Christoph Hellwig
2011-09-13 12:58 ` Christoph Hellwig
2011-09-22 20:18 ` Alex Elder [this message]
2011-09-22 20:18 ` Alex Elder
2011-09-23 13:03 ` Grazvydas Ignotas
2011-09-23 13:03 ` Grazvydas Ignotas
2011-09-23 13:56 ` Alex Elder
2011-09-23 13:56 ` Alex Elder
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=1316722702.2009.59.camel@doink \
--to=aelder@sgi.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=notasas@gmail.com \
--cc=xfs@oss.sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.