On Sun, Oct 28, 2018 at 3:36 PM Stefan Ring <stefanrin@xxxxxxxxx> wrote: > > Ok, this is a better replacement for the fifth patch (copy/pasted into > in-browser e-mail editor, might have broken formatting). I've also put it up at https://github.com/Ringdingcoder/xfsprogs-dev/commits/metadump-stale-data-v5-prelim for now. > Apparently the dev's inode contents are xfs_dev_t, and the rest of the > data fork can be cleared. The attribute fork is handled later in > process_inode. > > --- a/db/metadump.c > +++ b/db/metadump.c > @@ -2270,6 +2270,25 @@ process_inode_data( > return 1; > } > > +static int > +process_dev_inode( > + xfs_dinode_t *dip) > +{ > + if (XFS_DFORK_NEXTENTS(dip, XFS_DATA_FORK)) { > + if (show_warnings) > + print_warning("inode %llu has unexpected extents", > + (unsigned long long)cur_ino); > + return 0; > + } else { > + if (zero_stale_data) { > + unsigned int size = sizeof(xfs_dev_t); > + memset(XFS_DFORK_DPTR(dip) + size, 0, > + XFS_DFORK_DSIZE(dip, mp) - size); > + } > + return 1; > + } > +} > + > /* > * when we process the inode, we may change the data in the data and/or > * attribute fork if they are in short form and we are obfuscating names. > @@ -2322,7 +2341,10 @@ process_inode( > case S_IFREG: > success = process_inode_data(dip, TYP_DATA); > break; > - default: ; > + default: > + success = process_dev_inode(dip); > + need_new_crc = 1; > + break; > } > nametable_clear();