Re: [PATCH] xfsdump/xfsrestore: don't use O_DIRECT on the RT device

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

 



On Wed, Feb 28, 2024 at 05:53:13AM -0800, Christoph Hellwig wrote:
> For undocumented reasons xfsdump and xfsrestore use O_DIRECT for RT
> files.  On a rt device with 4k sector size this runs into alignment
> issues, e.g. xfs/060 fails with this message:
> 
> xfsrestore: attempt to write 237568 bytes to dumpdir/large000 at offset 54947844 failed: Invalid argument
> 
> Switch to using buffered I/O to match the main device and make these
> alignment issues go away.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Hah, I have an (never submitted) patch in my xfsdump repo that does
exactly this.  Now I don't have to find someone to review mine,
excellent. :)

Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>

--D

> ---
>  doc/xfsdump.html  | 1 -
>  dump/content.c    | 3 ---
>  restore/content.c | 3 ---
>  3 files changed, 7 deletions(-)
> 
> diff --git a/doc/xfsdump.html b/doc/xfsdump.html
> index efd3890..eec7dac 100644
> --- a/doc/xfsdump.html
> +++ b/doc/xfsdump.html
> @@ -884,7 +884,6 @@ Initialize the mmap files of:
>                     <ul>
>                     <li> S_IFREG -> <b>restore_reg</b> - restore regular file
>                        <ul>
> -                      <li>if realtime set O_DIRECT
>                        <li>truncate file to bs_size
>                        <li>set the bs_xflags for extended attributes
>                        <li>set DMAPI fields if necessary
> diff --git a/dump/content.c b/dump/content.c
> index 9117d39..f06dda1 100644
> --- a/dump/content.c
> +++ b/dump/content.c
> @@ -4325,9 +4325,6 @@ init_extent_group_context(jdm_fshandle_t *fshandlep,
>  
>  	isrealtime = (bool_t)(statp->bs_xflags & XFS_XFLAG_REALTIME);
>  	oflags = O_RDONLY;
> -	if (isrealtime) {
> -		oflags |= O_DIRECT;
> -	}
>  	(void)memset((void *)gcp, 0, sizeof(*gcp));
>  	gcp->eg_bmap[0].bmv_offset = 0;
>  	gcp->eg_bmap[0].bmv_length = -1;
> diff --git a/restore/content.c b/restore/content.c
> index 488ae20..c80ff34 100644
> --- a/restore/content.c
> +++ b/restore/content.c
> @@ -7471,9 +7471,6 @@ restore_reg(drive_t *drivep,
>  		return BOOL_TRUE;
>  
>  	oflags = O_CREAT | O_RDWR;
> -	if (persp->a.dstdirisxfspr && bstatp->bs_xflags & XFS_XFLAG_REALTIME)
> -		oflags |= O_DIRECT;
> -
>  	*fdp = open(path, oflags, S_IRUSR | S_IWUSR);
>  	if (*fdp < 0) {
>  		mlog(MLOG_NORMAL | MLOG_WARNING,
> -- 
> 2.39.2
> 
> 




[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