Re: [PATCH v2 xfstests 0/3] add generic/795

Zorro Lang <[email protected]> Tue, 21 Jul 2026 16:25:51 +0800
Newsgroups org.kernel.vger.linux-cifs
Message-ID <al8nX7MnPDzmUA5W@zlang-mailbox>
On Mon, Jul 20, 2026 at 04:34:59PM +0000, ChenXiaoSong wrote:
> From: ChenXiaoSong <[email protected]>
> 
> v1->v2:
>   - Add patch#01 patch#02.
>   - Patch#03: some cleanups.
> 
> v1: https://lore.kernel.org/linux-cifs/[email protected]/
> 
> ChenXiaoSong (3):
>   src: factor out common stat code
>   generic/002: clean up the test
>   generic/795: check nlink returned by fstat()
> 
>  src/Makefile          |  13 ++-
>  src/fstat.c           |  42 ++++++++++
>  src/lstat64.c         | 166 +------------------------------------
>  src/stat_common.c     | 185 ++++++++++++++++++++++++++++++++++++++++++
>  src/stat_common.h     |  16 ++++
>  tests/generic/002     |  16 ++--
>  tests/generic/002.out |   2 +-

Hi,

I might not have explained clearly during the review. I wasn't asking you to
rewrite g/002 and lstat64.c. I was suggesting checking whether src/fstat.c in
your previous patch could be replaced by the stat command in xfs_io [1]. Check
`man xfs_io` for the "stat" command to see if it can fulfill your test
requirement.

Due to I noticed you need information like st_nlink from struct stat, so
`xfs_io -c "stat -r" ...` should meet your requirements. Please
give it a try, if it works, it will make the whole patch much cleaner.

P.S. For a new test case, please don't use a specific case number (like
generic/795) in the subject or commit log, as it might get assigned a
different number when merged. You can just use something like:
"[PATCH] generic: new test to ..."

Thanks,
Zorro

[1]
  https://lore.kernel.org/fstests/[email protected]/T/#mff79f3e74e8cefbdda71e6a22f6a20f2dd985661
  "I'm wondering if a specific src/fstat.c is needed. Can we replace the whole
  src/fstat.c with `xfs_io -c stat ` ? Can you give it a try?"

>  tests/generic/795     |  60 ++++++++++++++
>  tests/generic/795.out |   2 +
>  9 files changed, 324 insertions(+), 178 deletions(-)
>  create mode 100644 src/fstat.c
>  create mode 100644 src/stat_common.c
>  create mode 100644 src/stat_common.h
>  create mode 100755 tests/generic/795
>  create mode 100644 tests/generic/795.out
> 
> -- 
> 2.43.0
>