Various fixes to allow xfsdump/xfsrestore to work with 64K
page size. This is essentially Chinner's patch from a while
back.
Signed-off-by: Bill Kendall <wkendall@xxxxxxx>
---
xfsdump/dump/content.c | 2 +-
xfsdump/restore/inomap.c | 6 ------
xfsprogs/libhandle/handle.c | 5 ++++-
xfsprogs/libhandle/jdm.c | 4 ++++
4 files changed, 9 insertions(+), 8 deletions(-)
Index: xfs-cmds/xfsdump/restore/inomap.c
===================================================================
--- xfs-cmds.orig/xfsdump/restore/inomap.c
+++ xfs-cmds/xfsdump/restore/inomap.c
@@ -197,8 +197,6 @@ inomap_restore_pers( drive_t *drivep,
*/
ASSERT( INOPERSEG == ( sizeof( (( seg_t * )0 )->lobits ) * NBBY ));
ASSERT( sizeof( hnk_t ) == HNKSZ );
- ASSERT( HNKSZ >= pgsz );
- ASSERT( ! ( HNKSZ % pgsz ));
ASSERT( sizeof( pers_t ) <= PERSSZ );
/* get inomap info from media hdr
@@ -224,8 +222,6 @@ inomap_restore_pers( drive_t *drivep,
/* mmap the persistent hdr and space for the map
*/
- ASSERT( sizeof( hnk_t ) * ( size_t )hnkcnt >= pgsz );
- ASSERT( ! ( sizeof( hnk_t ) * ( size_t )hnkcnt % pgsz ));
persp = ( pers_t * ) mmap_autogrow(
PERSSZ
+
@@ -355,8 +351,6 @@ inomap_sync_pers( char *hkdir )
/* sanity checks
*/
ASSERT( sizeof( hnk_t ) == HNKSZ );
- ASSERT( HNKSZ >= pgsz );
- ASSERT( ! ( HNKSZ % pgsz ));
/* only needed once per session
*/
Index: xfs-cmds/xfsdump/dump/content.c
===================================================================
--- xfs-cmds.orig/xfsdump/dump/content.c
+++ xfs-cmds/xfsdump/dump/content.c
@@ -210,7 +210,7 @@ typedef struct extent_group_context exte
/* minimum sizes for extended attributes buffers
*/
-#define EXTATTR_LISTBUF_SZ ( 4 * pgsz )
+#define EXTATTR_LISTBUF_SZ ( XATTR_LIST_MAX )
#define EXTATTR_RTRVARRAY_LEN ( 1 * pgsz )
#define EXTATTR_DUMPBUF_SZ ( 4 * pgsz )
Index: xfs-cmds/xfsprogs/libhandle/handle.c
===================================================================
--- xfs-cmds.orig/xfsprogs/libhandle/handle.c
+++ xfs-cmds/xfsprogs/libhandle/handle.c
@@ -360,8 +360,11 @@ attr_list_by_handle(
memcpy(&alhreq.pos, cursor, sizeof(alhreq.pos));
alhreq.flags = flags;
- alhreq.buflen = bufsize;
alhreq.buffer = buf;
+ alhreq.buflen = bufsize;
+ /* prevent needless EINVAL from the kernel */
+ if (alhreq.buflen > XATTR_LIST_MAX)
+ alhreq.buflen = XATTR_LIST_MAX;
error = xfsctl(path, fd, XFS_IOC_ATTRLIST_BY_HANDLE, &alhreq);
Index: xfs-cmds/xfsprogs/libhandle/jdm.c
===================================================================
--- xfs-cmds.orig/xfsprogs/libhandle/jdm.c
+++ xfs-cmds/xfsprogs/libhandle/jdm.c
@@ -166,6 +166,10 @@ jdm_attr_list( jdm_fshandle_t *fshp,
filehandle_t filehandle;
int rval;
+ /* prevent needless EINVAL from the kernel */
+ if (bufsz > XATTR_LIST_MAX)
+ bufsz = XATTR_LIST_MAX;
+
jdm_fill_filehandle( &filehandle, fshandlep, statp );
rval = attr_list_by_handle (( void * )&filehandle,
sizeof( filehandle ),
|