On Fri, Nov 04, 2016 at 05:28:44PM -0700, Darrick J. Wong wrote: > Create a filesystem scrubbing tool that walks the directory tree, > queries every file's extents, extended attributes, and stat data. For > generic (non-XFS) filesystems this depends on the kernel to do nearly > all the validation. Optionally, we can (try to) read all the file > data. > > For XFS, we perform sequential scans of each AG's metadata, inodes, > extent maps, and file data. Being XFS specific, we can work with > the in-kernel scrubbers to perform much stronger > metadata checking and cross-referencing. We can also take advantage > of newer ioctls such as GETFSMAP to perform faster read verification. > > In the future we will be able to take advantage of (still unwritten) > features such as parent directory pointers to fully validate all > metadata. However, this tool /should/ work for most non-XFS > filesystems such as ext4 and btrfs. > > Note also that the scrub tool can shut down the filesystem if errors > are found. This is not a default option since scrubbing is very > immature at this time. It can also ask the XFS driver in the kernel > to optimize or repair metadata, though this may not be successful. > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > --- [snip] > --- /dev/null > +++ b/scrub/scrub.c > @@ -0,0 +1,1009 @@ > +/* > + * Copyright (C) 2016 Oracle. All Rights Reserved. > + * > + * Author: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version 2 > + * of the License, or (at your option) any later version. > + * > + * This program is distributed in the hope that it would be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write the Free Software Foundation, > + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. > + */ > +#include "libxfs.h" > +#include <stdio.h> > +#include <mntent.h> > +#include <unistd.h> > +#include <sys/types.h> > +#include <sys/stat.h> > +#include <sys/time.h> > +#include <sys/resource.h> > +#include <sys/statvfs.h> > +#include <sys/vfs.h> > +#include <fcntl.h> > +#include <dirent.h> > +#include "disk.h" > +#include "scrub.h" > +#include "../../repair/threads.h" I have trouble compiling the djwong-devel branch, it failed to find "../../repair/threads.h", seems it should be "../repair/threads.h" here. Thanks, Eryu -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html