/* ARGSUSED */ static intgen_t cb_add( void *arg1, jdm_fshandle_t *fshandlep, intgen_t fsfd, xfs_bstat_t *statp ) { register time32_t mtime = statp->bs_mtime.tv_sec; register time32_t ctime = statp->bs_ctime.tv_sec; register time32_t ltime = max( mtime, ctime ); register mode_t mode = statp->bs_mode & S_IFMT; xfs_off_t estimated_size = 0; xfs_ino_t ino = statp->bs_ino; bool_t changed; bool_t resumed; ( *inomap_statdonep )++; /* skip if no links */ if ( statp->bs_nlink == 0 ) { return 0; } /* if no portion of this ino is in the resume range, * then only dump it if it has changed since the interrupted * dump. * * otherwise, if some or all of this ino is in the resume range, * and has changed since the base dump upon which the original * increment was based, dump it if it has changed since that * original base dump. */ if ( cb_resume && ! cb_inoinresumerange( ino )) { if ( ltime >= cb_resumetime ) { changed = BOOL_TRUE; } else { changed = BOOL_FALSE; } } else if ( cb_last ) { if ( ltime >= cb_lasttime ) { changed = BOOL_TRUE; } else { changed = BOOL_FALSE; } } else { changed = BOOL_TRUE; } /* this is redundant: make sure any ino partially dumped * is completed. */ if ( cb_resume && cb_inoresumed( ino )) { resumed = BOOL_TRUE; } else { resumed = BOOL_FALSE; } if ( changed ) { if ( mode == S_IFDIR ) { inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_DIR_CHANGE ); cb_dircnt++; } else { estimated_size = estimate_dump_space( statp ); /* skip if size is greater than prune size */ if ( maxdumpfilesize > 0 && estimated_size > maxdumpfilesize ) { mlog( MLOG_DEBUG | MLOG_EXCLFILES, "pruned ino %llu, owner %u, estimated size %llu: maximum size exceeded\n", statp->bs_ino, statp->bs_uid, estimated_size ); inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_NDR_NOCHNG ); inomap_exclude_filesize++; return 0; } if (allowexcludefiles_pr && statp->bs_xflags & XFS_XFLAG_NODUMP) { mlog( MLOG_DEBUG | MLOG_EXCLFILES, "pruned ino %llu, owner %u, estimated size %llu: skip flag set\n", statp->bs_ino, statp->bs_uid, estimated_size ); inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_NDR_NOCHNG ); inomap_exclude_skipattr++; return 0; } else if (allowexcludefiles_pr && (statp->bs_xflags & XFS_XFLAG_HASATTR)) { int rval; attr_multiop_t attrop; static char *skip_attr_name = "SGI_XFSDUMP_SKIP_FILE"; static int deprecated_msg_issued = 0; attrop.am_attrname = skip_attr_name; attrop.am_attrvalue = NULL; attrop.am_length = 0; attrop.am_error = 0; attrop.am_flags = 0; attrop.am_opcode = ATTR_OP_GET; rval = jdm_attr_multi( fshandlep, statp, (char *)&attrop, 1, 0 ); if ( !rval && (!attrop.am_error || attrop.am_error == E2BIG || attrop.am_error == ERANGE) ) { mlog( MLOG_DEBUG | MLOG_EXCLFILES, "pruned ino %llu, owner %u, estimated size %llu: skip attribute set\n", statp->bs_ino, statp->bs_uid, estimated_size ); if ( !deprecated_msg_issued ) { deprecated_msg_issued = 1; mlog( MLOG_SILENT | MLOG_WARNING, "excluding files using %s attribute is deprecated\n", skip_attr_name ); } inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_NDR_NOCHNG ); inomap_exclude_skipattr++; return 0; } } inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_NDR_CHANGE ); cb_nondircnt++; cb_datasz += estimated_size; cb_hdrsz += ( EXTENTHDR_SZ * (statp->bs_extents + 1) ); } } else if ( resumed ) { ASSERT( mode != S_IFDIR ); ASSERT( changed ); } else { if ( mode == S_IFDIR ) { *cb_pruneneededp = BOOL_TRUE; inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_DIR_SUPPRT ); cb_dircnt++; } else { inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_NDR_NOCHNG ); } } return 0; }
/* ARGSUSED */ static intgen_t cb_add( void *arg1, jdm_fshandle_t *fshandlep, intgen_t fsfd, xfs_bstat_t *statp ) { register time32_t mtime = statp->bs_mtime.tv_sec; register time32_t ctime = statp->bs_ctime.tv_sec; register time32_t ltime = max( mtime, ctime ); register mode_t mode = statp->bs_mode & S_IFMT; xfs_off_t estimated_size = 0; xfs_ino_t ino = statp->bs_ino; bool_t changed; bool_t resumed; ( *inomap_statdonep )++; /* skip if no links */ if ( statp->bs_nlink == 0 ) { return 0; } /* if no portion of this ino is in the resume range, * then only dump it if it has changed since the interrupted * dump. * * otherwise, if some or all of this ino is in the resume range, * and has changed since the base dump upon which the original * increment was based, dump it if it has changed since that * original base dump. */ if ( cb_resume && ! cb_inoinresumerange( ino )) { if ( ltime >= cb_resumetime ) { changed = BOOL_TRUE; } else { changed = BOOL_FALSE; } } else if ( cb_last ) { if ( ltime >= cb_lasttime ) { changed = BOOL_TRUE; } else { changed = BOOL_FALSE; } } else { changed = BOOL_TRUE; } /* this is redundant: make sure any ino partially dumped * is completed. */ if ( cb_resume && cb_inoresumed( ino )) { resumed = BOOL_TRUE; } else { resumed = BOOL_FALSE; } if ( changed ) { if ( mode == S_IFDIR ) { inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_DIR_CHANGE ); cb_dircnt++; } else { estimated_size = estimate_dump_space( statp ); /* skip if size is greater than prune size. quota * files are exempt from the check. */ if ( maxdumpfilesize > 0 && estimated_size > maxdumpfilesize && !is_quota_file(statp->bs_ino) ) { mlog( MLOG_DEBUG | MLOG_EXCLFILES, "pruned ino %llu, owner %u, estimated size %llu: maximum size exceeded\n", statp->bs_ino, statp->bs_uid, estimated_size ); inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_NDR_NOCHNG ); inomap_exclude_filesize++; return 0; } if (allowexcludefiles_pr && statp->bs_xflags & XFS_XFLAG_NODUMP) { mlog( MLOG_DEBUG | MLOG_EXCLFILES, "pruned ino %llu, owner %u, estimated size %llu: skip flag set\n", statp->bs_ino, statp->bs_uid, estimated_size ); inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_NDR_NOCHNG ); inomap_exclude_skipattr++; return 0; } inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_NDR_CHANGE ); cb_nondircnt++; cb_datasz += estimated_size; cb_hdrsz += ( EXTENTHDR_SZ * (statp->bs_extents + 1) ); } } else if ( resumed ) { ASSERT( mode != S_IFDIR ); ASSERT( changed ); } else { if ( mode == S_IFDIR ) { if ( cb_skip_unchanged_dirs ) { inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_DIR_NOCHNG ); } else { *cb_pruneneededp = BOOL_TRUE; inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_DIR_SUPPRT ); cb_dircnt++; } } else { inomap_add( cb_inomap_contextp, ino, (gen_t)statp->bs_gen, MAP_NDR_NOCHNG ); } } return 0; }