Re: [PATCH 2/4] fsstress: add NOREPLACE and WHITEOUT renameat2 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 24, 2019 at 10:20:49PM +0800, kaixuxia wrote:
> Support the renameat2(NOREPLACE and WHITEOUT) syscall in fsstress.
> 
> Signed-off-by: kaixuxia <kaixuxia@xxxxxxxxxxx>
> ---
>  ltp/fsstress.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 89 insertions(+), 15 deletions(-)
> 
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index 95285f1..5059639 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
...
> @@ -4272,16 +4323,21 @@ rename_f(int opno, long r)
>  		if (flp - flist == FT_DIR)
>  			fix_parent(oldid, id);
>  
> -		del_from_flist(flp - flist, fep - flp->fents);
> -		add_to_flist(flp - flist, id, parid, xattr_counter);
> +		if (mode == RENAME_WHITEOUT)
> +			add_to_flist(flp - flist, id, parid, xattr_counter);

Hmm, so we've added a new devnode for the target and a whiteout was
added in its place. What about the xattr_count of the original devnode?
I wonder if we should reset that to zero. Other than that the rest looks
fine to me.

Brian

> +		else {
> +			del_from_flist(flp - flist, fep - flp->fents);
> +			add_to_flist(flp - flist, id, parid, xattr_counter);
> +		}
>  	}
>  	if (v) {
> -		printf("%d/%d: rename %s to %s %d\n", procid, opno, f.path,
> +		printf("%d/%d: rename(%s) %s to %s %d\n", procid,
> +			opno, translate_renameat2_flags(mode), f.path,
>  			newf.path, e);
>  		if (e == 0) {
> -			printf("%d/%d: rename del entry: id=%d,parent=%d\n",
> +			printf("%d/%d: rename source entry: id=%d,parent=%d\n",
>  				procid, opno, oldid, oldparid);
> -			printf("%d/%d: rename add entry: id=%d,parent=%d\n",
> +			printf("%d/%d: rename target entry: id=%d,parent=%d\n",
>  				procid, opno, id, parid);
>  		}
>  	}
> @@ -4290,6 +4346,24 @@ rename_f(int opno, long r)
>  }
>  
>  void
> +rename_f(int opno, long r)
> +{
> +	do_renameat2(opno, r, 0);
> +}
> +
> +void
> +rnoreplace_f(int opno, long r)
> +{
> +	do_renameat2(opno, r, RENAME_NOREPLACE);
> +}
> +
> +void
> +rwhiteout_f(int opno, long r)
> +{
> +	do_renameat2(opno, r, RENAME_WHITEOUT);
> +}
> +
> +void
>  resvsp_f(int opno, long r)
>  {
>  	int		e;
> -- 
> 1.8.3.1
> 





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux