From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp1040.oracle.com ([141.146.126.69]:42368 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932280AbcKHIhT (ORCPT ); Tue, 8 Nov 2016 03:37:19 -0500 Date: Tue, 8 Nov 2016 00:37:07 -0800 From: "Darrick J. Wong" Subject: Re: [PATCH 39/39] xfs_scrub: create online filesystem scrub program Message-ID: <20161108083706.GB20710@birch.djwong.org> References: <147830546754.4165.17790362300876898017.stgit@birch.djwong.org> <147830572454.4165.18074642184555452652.stgit@birch.djwong.org> <20161105052256.GB27776@eguan.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161105052256.GB27776@eguan.usersys.redhat.com> Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: Eryu Guan Cc: david@fromorbit.com, linux-xfs@vger.kernel.org On Sat, Nov 05, 2016 at 01:22:56PM +0800, Eryu Guan wrote: > 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 > > --- > [snip] > > --- /dev/null > > +++ b/scrub/scrub.c > > @@ -0,0 +1,1009 @@ > > +/* > > + * Copyright (C) 2016 Oracle. All Rights Reserved. > > + * > > + * Author: Darrick J. Wong > > + * > > + * 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 > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#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. Doh. Yeah. I'll fix that in the morning. Sorry about that. In a nutshell: I build xfsprogs git for each arch in a build-$arch/ subdirs containing symlinks to everything in the parent, which is why I never tripped on this. :/ --D > > Thanks, > Eryu