/* * Copyright (C) 2017 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. */ #ifndef __XFS_SCRUB_COMMON_H__ #define __XFS_SCRUB_COMMON_H__ /* * We /could/ terminate a scrub/repair operation early. If we're not * in a good place to continue (fatal signal, etc.) then bail out. * Note that we're careful not to make any judgements about *error. */ static inline bool xfs_scrub_should_terminate( struct xfs_scrub_context *sc, int *error) { if (fatal_signal_pending(current)) { if (*error == 0) *error = -EAGAIN; return true; } return false; } /* * Grab an empty transaction so that we can re-grab locked buffers if * one of our btrees turns out to be cyclic. */ static inline int xfs_scrub_trans_alloc( struct xfs_scrub_metadata *sm, struct xfs_mount *mp, struct xfs_trans **tpp) { return xfs_trans_alloc_empty(mp, tpp); } /* Setup functions */ int xfs_scrub_setup_fs(struct xfs_scrub_context *sc, struct xfs_inode *ip); #endif /* __XFS_SCRUB_COMMON_H__ */