mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
xfs: new patches for Linux 7.0
Signed-off-by: Carlos Maiolino <cem@kernel.org>
-----BEGIN PGP SIGNATURE-----
iJUEABMJAB0WIQSmtYVZ/MfVMGUq1GNcsMJ8RxYuYwUCaYXRZgAKCRBcsMJ8RxYu
Y6wOAX0TcdEZWVLnIsKsc6XmY6QO7i2HXR+6pX+1XzeL81bFxfkDv/GPJln3ovk+
v2h1YOUBf1veFyoEN5DwHhuV0SPsSko5MohJMli5a6ELxt6ZV8vByzzNW2EHA13K
pXAvbbrWLw==
=6D/r
-----END PGP SIGNATURE-----
Merge tag 'xfs-merge-7.0' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs updates from Carlos Maiolino:
"This contains several improvements to zoned device support,
performance improvements for the parent pointers, and a new health
monitoring feature. There are some improvements in the journaling code
too but no behavior change expected.
Last but not least, some code refactoring and bug fixes are also
included in this series"
* tag 'xfs-merge-7.0' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (67 commits)
xfs: add sysfs stats for zoned GC
xfs: give the defer_relog stat a xs_ prefix
xfs: add zone reset error injection
xfs: refactor zone reset handling
xfs: don't mark all discard issued by zoned GC as sync
xfs: allow setting errortags at mount time
xfs: use WRITE_ONCE/READ_ONCE for m_errortag
xfs: move the guts of XFS_ERRORTAG_DELAY out of line
xfs: don't validate error tags in the I/O path
xfs: allocate m_errortag early
xfs: fix the errno sign for the xfs_errortag_{add,clearall} stubs
xfs: validate log record version against superblock log version
xfs: fix spacing style issues in xfs_alloc.c
xfs: remove xfs_zone_gc_space_available
xfs: use a seprate member to track space availabe in the GC scatch buffer
xfs: check for deleted cursors when revalidating two btrees
xfs: fix UAF in xchk_btree_check_block_owner
xfs: check return value of xchk_scrub_create_subord
xfs: only call xf{array,blob}_destroy if we have a valid pointer
xfs: get rid of the xchk_xfile_*_descr calls
...
This commit is contained in:
commit
56feb532bb
222 changed files with 4257 additions and 1344 deletions
|
|
@ -215,6 +215,14 @@ When mounting an XFS filesystem, the following options are accepted.
|
|||
inconsistent namespace presentation during or after a
|
||||
failover event.
|
||||
|
||||
errortag=tagname
|
||||
When specified, enables the error inject tag named "tagname" with the
|
||||
default frequency. Can be specified multiple times to enable multiple
|
||||
errortags. Specifying this option on remount will reset the error tag
|
||||
to the default value if it was set to any other value before.
|
||||
This option is only supported when CONFIG_XFS_DEBUG is enabled, and
|
||||
will not be reflected in /proc/self/mounts.
|
||||
|
||||
Deprecation of V4 Format
|
||||
========================
|
||||
|
||||
|
|
|
|||
34
block/bio.c
34
block/bio.c
|
|
@ -311,6 +311,40 @@ void bio_reset(struct bio *bio, struct block_device *bdev, blk_opf_t opf)
|
|||
}
|
||||
EXPORT_SYMBOL(bio_reset);
|
||||
|
||||
/**
|
||||
* bio_reuse - reuse a bio with the payload left intact
|
||||
* @bio: bio to reuse
|
||||
* @opf: operation and flags for the next I/O
|
||||
*
|
||||
* Allow reusing an existing bio for another operation with all set up
|
||||
* fields including the payload, device and end_io handler left intact.
|
||||
*
|
||||
* Typically used when @bio is first used to read data which is then written
|
||||
* to another location without modification. @bio must not be in-flight and
|
||||
* owned by the caller. Can't be used for cloned bios.
|
||||
*
|
||||
* Note: Can't be used when @bio has integrity or blk-crypto contexts for now.
|
||||
* Feel free to add that support when you need it, though.
|
||||
*/
|
||||
void bio_reuse(struct bio *bio, blk_opf_t opf)
|
||||
{
|
||||
unsigned short vcnt = bio->bi_vcnt, i;
|
||||
bio_end_io_t *end_io = bio->bi_end_io;
|
||||
void *private = bio->bi_private;
|
||||
|
||||
WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED));
|
||||
WARN_ON_ONCE(bio_integrity(bio));
|
||||
WARN_ON_ONCE(bio_has_crypt_ctx(bio));
|
||||
|
||||
bio_reset(bio, bio->bi_bdev, opf);
|
||||
for (i = 0; i < vcnt; i++)
|
||||
bio->bi_iter.bi_size += bio->bi_io_vec[i].bv_len;
|
||||
bio->bi_vcnt = vcnt;
|
||||
bio->bi_private = private;
|
||||
bio->bi_end_io = end_io;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bio_reuse);
|
||||
|
||||
static struct bio *__bio_chain_endio(struct bio *bio)
|
||||
{
|
||||
struct bio *parent = bio->bi_private;
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ xfs-y += xfs_aops.o \
|
|||
xfs_globals.o \
|
||||
xfs_handle.o \
|
||||
xfs_health.o \
|
||||
xfs_healthmon.o \
|
||||
xfs_icache.o \
|
||||
xfs_ioctl.o \
|
||||
xfs_iomap.o \
|
||||
|
|
@ -105,6 +106,7 @@ xfs-y += xfs_aops.o \
|
|||
xfs_symlink.o \
|
||||
xfs_sysfs.o \
|
||||
xfs_trans.o \
|
||||
xfs_verify_media.o \
|
||||
xfs_xattr.o
|
||||
|
||||
# low-level transaction/log code
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2016 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_format.h"
|
||||
#include "xfs_log_format.h"
|
||||
|
|
@ -376,8 +376,8 @@ xfs_alloc_compute_diff(
|
|||
xfs_agblock_t freeend; /* end of freespace extent */
|
||||
xfs_agblock_t newbno1; /* return block number */
|
||||
xfs_agblock_t newbno2; /* other new block number */
|
||||
xfs_extlen_t newlen1=0; /* length with newbno1 */
|
||||
xfs_extlen_t newlen2=0; /* length with newbno2 */
|
||||
xfs_extlen_t newlen1 = 0; /* length with newbno1 */
|
||||
xfs_extlen_t newlen2 = 0; /* length with newbno2 */
|
||||
xfs_agblock_t wantend; /* end of target extent */
|
||||
bool userdata = datatype & XFS_ALLOC_USERDATA;
|
||||
|
||||
|
|
@ -577,8 +577,8 @@ xfs_alloc_fixup_trees(
|
|||
int i; /* operation results */
|
||||
xfs_agblock_t nfbno1; /* first new free startblock */
|
||||
xfs_agblock_t nfbno2; /* second new free startblock */
|
||||
xfs_extlen_t nflen1=0; /* first new free length */
|
||||
xfs_extlen_t nflen2=0; /* second new free length */
|
||||
xfs_extlen_t nflen1 = 0; /* first new free length */
|
||||
xfs_extlen_t nflen2 = 0; /* second new free length */
|
||||
struct xfs_mount *mp;
|
||||
bool fixup_longest = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -50,7 +50,6 @@ STATIC int xfs_attr_shortform_addname(xfs_da_args_t *args);
|
|||
*/
|
||||
STATIC int xfs_attr_leaf_get(xfs_da_args_t *args);
|
||||
STATIC int xfs_attr_leaf_removename(xfs_da_args_t *args);
|
||||
STATIC int xfs_attr_leaf_hasname(struct xfs_da_args *args, struct xfs_buf **bp);
|
||||
|
||||
/*
|
||||
* Internal routines when attribute list is more than one block.
|
||||
|
|
@ -351,16 +350,14 @@ xfs_attr_set_resv(
|
|||
*/
|
||||
STATIC int
|
||||
xfs_attr_try_sf_addname(
|
||||
struct xfs_inode *dp,
|
||||
struct xfs_da_args *args)
|
||||
{
|
||||
|
||||
int error;
|
||||
|
||||
/*
|
||||
* Build initial attribute list (if required).
|
||||
*/
|
||||
if (dp->i_af.if_format == XFS_DINODE_FMT_EXTENTS)
|
||||
if (args->dp->i_af.if_format == XFS_DINODE_FMT_EXTENTS)
|
||||
xfs_attr_shortform_create(args);
|
||||
|
||||
error = xfs_attr_shortform_addname(args);
|
||||
|
|
@ -372,9 +369,9 @@ xfs_attr_try_sf_addname(
|
|||
* NOTE: this is also the error path (EEXIST, etc).
|
||||
*/
|
||||
if (!error)
|
||||
xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
|
||||
xfs_trans_ichgtime(args->trans, args->dp, XFS_ICHGTIME_CHG);
|
||||
|
||||
if (xfs_has_wsync(dp->i_mount))
|
||||
if (xfs_has_wsync(args->dp->i_mount))
|
||||
xfs_trans_set_sync(args->trans);
|
||||
|
||||
return error;
|
||||
|
|
@ -385,10 +382,9 @@ xfs_attr_sf_addname(
|
|||
struct xfs_attr_intent *attr)
|
||||
{
|
||||
struct xfs_da_args *args = attr->xattri_da_args;
|
||||
struct xfs_inode *dp = args->dp;
|
||||
int error = 0;
|
||||
|
||||
error = xfs_attr_try_sf_addname(dp, args);
|
||||
error = xfs_attr_try_sf_addname(args);
|
||||
if (error != -ENOSPC) {
|
||||
ASSERT(!error || error == -EEXIST);
|
||||
attr->xattri_dela_state = XFS_DAS_DONE;
|
||||
|
|
@ -979,11 +975,12 @@ xfs_attr_lookup(
|
|||
return error;
|
||||
|
||||
if (xfs_attr_is_leaf(dp)) {
|
||||
error = xfs_attr_leaf_hasname(args, &bp);
|
||||
|
||||
if (bp)
|
||||
xfs_trans_brelse(args->trans, bp);
|
||||
|
||||
error = xfs_attr3_leaf_read(args->trans, args->dp, args->owner,
|
||||
0, &bp);
|
||||
if (error)
|
||||
return error;
|
||||
error = xfs_attr3_leaf_lookup_int(bp, args);
|
||||
xfs_trans_brelse(args->trans, bp);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
@ -1031,6 +1028,95 @@ trans_cancel:
|
|||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Decide if it is theoretically possible to try to bypass the attr intent
|
||||
* mechanism for better performance. Other constraints (e.g. available space
|
||||
* in the existing structure) are not considered here.
|
||||
*/
|
||||
static inline bool
|
||||
xfs_attr_can_shortcut(
|
||||
const struct xfs_inode *ip)
|
||||
{
|
||||
return xfs_inode_has_attr_fork(ip) && xfs_attr_is_shortform(ip);
|
||||
}
|
||||
|
||||
/* Try to set an attr in one transaction or fall back to attr intents. */
|
||||
int
|
||||
xfs_attr_setname(
|
||||
struct xfs_da_args *args,
|
||||
int rmt_blks)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (!rmt_blks && xfs_attr_can_shortcut(args->dp)) {
|
||||
args->op_flags |= XFS_DA_OP_ADDNAME;
|
||||
|
||||
error = xfs_attr_try_sf_addname(args);
|
||||
if (error != -ENOSPC)
|
||||
return error;
|
||||
}
|
||||
|
||||
xfs_attr_defer_add(args, XFS_ATTR_DEFER_SET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Try to remove an attr in one transaction or fall back to attr intents. */
|
||||
int
|
||||
xfs_attr_removename(
|
||||
struct xfs_da_args *args)
|
||||
{
|
||||
if (xfs_attr_can_shortcut(args->dp))
|
||||
return xfs_attr_sf_removename(args);
|
||||
|
||||
xfs_attr_defer_add(args, XFS_ATTR_DEFER_REMOVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Try to replace an attr in one transaction or fall back to attr intents. */
|
||||
int
|
||||
xfs_attr_replacename(
|
||||
struct xfs_da_args *args,
|
||||
int rmt_blks)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (rmt_blks || !xfs_attr_can_shortcut(args->dp)) {
|
||||
xfs_attr_defer_add(args, XFS_ATTR_DEFER_REPLACE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
error = xfs_attr_shortform_replace(args);
|
||||
if (error != -ENOSPC)
|
||||
return error;
|
||||
|
||||
args->op_flags |= XFS_DA_OP_ADDNAME | XFS_DA_OP_REPLACE;
|
||||
|
||||
error = xfs_attr_sf_removename(args);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (args->attr_filter & XFS_ATTR_PARENT) {
|
||||
/*
|
||||
* Move the new name/value to the regular name/value slots and
|
||||
* zero out the new name/value slots because we don't need to
|
||||
* log them for a PPTR_SET operation.
|
||||
*/
|
||||
xfs_attr_update_pptr_replace_args(args);
|
||||
args->new_name = NULL;
|
||||
args->new_namelen = 0;
|
||||
args->new_value = NULL;
|
||||
args->new_valuelen = 0;
|
||||
}
|
||||
args->op_flags &= ~XFS_DA_OP_REPLACE;
|
||||
|
||||
error = xfs_attr_try_sf_addname(args);
|
||||
if (error != -ENOSPC)
|
||||
return error;
|
||||
|
||||
xfs_attr_defer_add(args, XFS_ATTR_DEFER_SET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a change to the xattr structure.
|
||||
*
|
||||
|
|
@ -1111,14 +1197,19 @@ xfs_attr_set(
|
|||
case -EEXIST:
|
||||
if (op == XFS_ATTRUPDATE_REMOVE) {
|
||||
/* if no value, we are performing a remove operation */
|
||||
xfs_attr_defer_add(args, XFS_ATTR_DEFER_REMOVE);
|
||||
error = xfs_attr_removename(args);
|
||||
if (error)
|
||||
goto out_trans_cancel;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Pure create fails if the attr already exists */
|
||||
if (op == XFS_ATTRUPDATE_CREATE)
|
||||
goto out_trans_cancel;
|
||||
xfs_attr_defer_add(args, XFS_ATTR_DEFER_REPLACE);
|
||||
|
||||
error = xfs_attr_replacename(args, rmt_blks);
|
||||
if (error)
|
||||
goto out_trans_cancel;
|
||||
break;
|
||||
case -ENOATTR:
|
||||
/* Can't remove what isn't there. */
|
||||
|
|
@ -1128,7 +1219,10 @@ xfs_attr_set(
|
|||
/* Pure replace fails if no existing attr to replace. */
|
||||
if (op == XFS_ATTRUPDATE_REPLACE)
|
||||
goto out_trans_cancel;
|
||||
xfs_attr_defer_add(args, XFS_ATTR_DEFER_SET);
|
||||
|
||||
error = xfs_attr_setname(args, rmt_blks);
|
||||
if (error)
|
||||
goto out_trans_cancel;
|
||||
break;
|
||||
default:
|
||||
goto out_trans_cancel;
|
||||
|
|
@ -1222,27 +1316,6 @@ xfs_attr_shortform_addname(
|
|||
* External routines when attribute list is one block
|
||||
*========================================================================*/
|
||||
|
||||
/*
|
||||
* Return EEXIST if attr is found, or ENOATTR if not
|
||||
*/
|
||||
STATIC int
|
||||
xfs_attr_leaf_hasname(
|
||||
struct xfs_da_args *args,
|
||||
struct xfs_buf **bp)
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
error = xfs_attr3_leaf_read(args->trans, args->dp, args->owner, 0, bp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
error = xfs_attr3_leaf_lookup_int(*bp, args);
|
||||
if (error != -ENOATTR && error != -EEXIST)
|
||||
xfs_trans_brelse(args->trans, *bp);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove a name from the leaf attribute list structure
|
||||
*
|
||||
|
|
@ -1253,25 +1326,22 @@ STATIC int
|
|||
xfs_attr_leaf_removename(
|
||||
struct xfs_da_args *args)
|
||||
{
|
||||
struct xfs_inode *dp;
|
||||
struct xfs_buf *bp;
|
||||
struct xfs_inode *dp = args->dp;
|
||||
int error, forkoff;
|
||||
struct xfs_buf *bp;
|
||||
|
||||
trace_xfs_attr_leaf_removename(args);
|
||||
|
||||
/*
|
||||
* Remove the attribute.
|
||||
*/
|
||||
dp = args->dp;
|
||||
|
||||
error = xfs_attr_leaf_hasname(args, &bp);
|
||||
if (error == -ENOATTR) {
|
||||
error = xfs_attr3_leaf_read(args->trans, args->dp, args->owner, 0, &bp);
|
||||
if (error)
|
||||
return error;
|
||||
error = xfs_attr3_leaf_lookup_int(bp, args);
|
||||
if (error != -EEXIST) {
|
||||
xfs_trans_brelse(args->trans, bp);
|
||||
if (args->op_flags & XFS_DA_OP_RECOVERY)
|
||||
if (error == -ENOATTR && (args->op_flags & XFS_DA_OP_RECOVERY))
|
||||
return 0;
|
||||
return error;
|
||||
} else if (error != -EEXIST)
|
||||
return error;
|
||||
}
|
||||
|
||||
xfs_attr3_leaf_remove(bp, args);
|
||||
|
||||
|
|
@ -1295,23 +1365,20 @@ xfs_attr_leaf_removename(
|
|||
* Returns 0 on successful retrieval, otherwise an error.
|
||||
*/
|
||||
STATIC int
|
||||
xfs_attr_leaf_get(xfs_da_args_t *args)
|
||||
xfs_attr_leaf_get(
|
||||
struct xfs_da_args *args)
|
||||
{
|
||||
struct xfs_buf *bp;
|
||||
int error;
|
||||
struct xfs_buf *bp;
|
||||
int error;
|
||||
|
||||
trace_xfs_attr_leaf_get(args);
|
||||
|
||||
error = xfs_attr_leaf_hasname(args, &bp);
|
||||
|
||||
if (error == -ENOATTR) {
|
||||
xfs_trans_brelse(args->trans, bp);
|
||||
error = xfs_attr3_leaf_read(args->trans, args->dp, args->owner, 0, &bp);
|
||||
if (error)
|
||||
return error;
|
||||
} else if (error != -EEXIST)
|
||||
return error;
|
||||
|
||||
|
||||
error = xfs_attr3_leaf_getvalue(bp, args);
|
||||
error = xfs_attr3_leaf_lookup_int(bp, args);
|
||||
if (error == -EEXIST)
|
||||
error = xfs_attr3_leaf_getvalue(bp, args);
|
||||
xfs_trans_brelse(args->trans, bp);
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ struct xfs_trans_res xfs_attr_set_resv(const struct xfs_da_args *args);
|
|||
*/
|
||||
static inline bool
|
||||
xfs_attr_is_shortform(
|
||||
struct xfs_inode *ip)
|
||||
const struct xfs_inode *ip)
|
||||
{
|
||||
return ip->i_af.if_format == XFS_DINODE_FMT_LOCAL ||
|
||||
(ip->i_af.if_format == XFS_DINODE_FMT_EXTENTS &&
|
||||
|
|
@ -649,4 +649,8 @@ void xfs_attr_intent_destroy_cache(void);
|
|||
int xfs_attr_sf_totsize(struct xfs_inode *dp);
|
||||
int xfs_attr_add_fork(struct xfs_inode *ip, int size, int rsvd);
|
||||
|
||||
int xfs_attr_setname(struct xfs_da_args *args, int rmt_blks);
|
||||
int xfs_attr_removename(struct xfs_da_args *args);
|
||||
int xfs_attr_replacename(struct xfs_da_args *args, int rmt_blks);
|
||||
|
||||
#endif /* __XFS_ATTR_H__ */
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2013 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -75,6 +75,59 @@ STATIC void xfs_attr3_leaf_moveents(struct xfs_da_args *args,
|
|||
int move_count);
|
||||
STATIC int xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index);
|
||||
|
||||
/* Compute the byte offset of the end of the leaf entry array. */
|
||||
static inline int
|
||||
xfs_attr_leaf_entries_end(
|
||||
unsigned int hdrcount,
|
||||
const struct xfs_attr_leafblock *leaf)
|
||||
{
|
||||
return hdrcount * sizeof(struct xfs_attr_leaf_entry) +
|
||||
xfs_attr3_leaf_hdr_size(leaf);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ichdr_freemaps_overlap(
|
||||
const struct xfs_attr3_icleaf_hdr *ichdr,
|
||||
unsigned int x,
|
||||
unsigned int y)
|
||||
{
|
||||
const unsigned int xend =
|
||||
ichdr->freemap[x].base + ichdr->freemap[x].size;
|
||||
const unsigned int yend =
|
||||
ichdr->freemap[y].base + ichdr->freemap[y].size;
|
||||
|
||||
/* empty slots do not overlap */
|
||||
if (!ichdr->freemap[x].size || !ichdr->freemap[y].size)
|
||||
return false;
|
||||
|
||||
return ichdr->freemap[x].base < yend && xend > ichdr->freemap[y].base;
|
||||
}
|
||||
|
||||
static inline xfs_failaddr_t
|
||||
xfs_attr_leaf_ichdr_freemaps_verify(
|
||||
const struct xfs_attr3_icleaf_hdr *ichdr,
|
||||
const struct xfs_attr_leafblock *leaf)
|
||||
{
|
||||
unsigned int entries_end =
|
||||
xfs_attr_leaf_entries_end(ichdr->count, leaf);
|
||||
int i;
|
||||
|
||||
if (ichdr_freemaps_overlap(ichdr, 0, 1))
|
||||
return __this_address;
|
||||
if (ichdr_freemaps_overlap(ichdr, 0, 2))
|
||||
return __this_address;
|
||||
if (ichdr_freemaps_overlap(ichdr, 1, 2))
|
||||
return __this_address;
|
||||
|
||||
for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; i++) {
|
||||
if (ichdr->freemap[i].size > 0 &&
|
||||
ichdr->freemap[i].base < entries_end)
|
||||
return __this_address;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* attr3 block 'firstused' conversion helpers.
|
||||
*
|
||||
|
|
@ -218,6 +271,8 @@ xfs_attr3_leaf_hdr_to_disk(
|
|||
hdr3->freemap[i].base = cpu_to_be16(from->freemap[i].base);
|
||||
hdr3->freemap[i].size = cpu_to_be16(from->freemap[i].size);
|
||||
}
|
||||
|
||||
ASSERT(xfs_attr_leaf_ichdr_freemaps_verify(from, to) == NULL);
|
||||
return;
|
||||
}
|
||||
to->hdr.info.forw = cpu_to_be32(from->forw);
|
||||
|
|
@ -233,6 +288,8 @@ xfs_attr3_leaf_hdr_to_disk(
|
|||
to->hdr.freemap[i].base = cpu_to_be16(from->freemap[i].base);
|
||||
to->hdr.freemap[i].size = cpu_to_be16(from->freemap[i].size);
|
||||
}
|
||||
|
||||
ASSERT(xfs_attr_leaf_ichdr_freemaps_verify(from, to) == NULL);
|
||||
}
|
||||
|
||||
static xfs_failaddr_t
|
||||
|
|
@ -385,6 +442,10 @@ xfs_attr3_leaf_verify(
|
|||
return __this_address;
|
||||
}
|
||||
|
||||
fa = xfs_attr_leaf_ichdr_freemaps_verify(&ichdr, leaf);
|
||||
if (fa)
|
||||
return fa;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -781,6 +842,44 @@ xfs_attr_sf_findname(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Replace a shortform xattr if it's the right length. Returns 0 on success,
|
||||
* -ENOSPC if the length is wrong, or -ENOATTR if the attr was not found.
|
||||
*/
|
||||
int
|
||||
xfs_attr_shortform_replace(
|
||||
struct xfs_da_args *args)
|
||||
{
|
||||
struct xfs_attr_sf_entry *sfe;
|
||||
|
||||
ASSERT(args->dp->i_af.if_format == XFS_DINODE_FMT_LOCAL);
|
||||
|
||||
trace_xfs_attr_sf_replace(args);
|
||||
|
||||
sfe = xfs_attr_sf_findname(args);
|
||||
if (!sfe)
|
||||
return -ENOATTR;
|
||||
|
||||
if (args->attr_filter & XFS_ATTR_PARENT) {
|
||||
if (sfe->namelen != args->new_namelen ||
|
||||
sfe->valuelen != args->new_valuelen)
|
||||
return -ENOSPC;
|
||||
|
||||
memcpy(sfe->nameval, args->new_name, sfe->namelen);
|
||||
memcpy(&sfe->nameval[sfe->namelen], args->new_value,
|
||||
sfe->valuelen);
|
||||
} else {
|
||||
if (sfe->valuelen != args->valuelen)
|
||||
return -ENOSPC;
|
||||
memcpy(&sfe->nameval[sfe->namelen], args->value,
|
||||
sfe->valuelen);
|
||||
}
|
||||
|
||||
xfs_trans_log_inode(args->trans, args->dp,
|
||||
XFS_ILOG_CORE | XFS_ILOG_ADATA);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a name/value pair to the shortform attribute list.
|
||||
* Overflow from the inode has already been checked for.
|
||||
|
|
@ -1409,8 +1508,7 @@ xfs_attr3_leaf_add(
|
|||
* Search through freemap for first-fit on new name length.
|
||||
* (may need to figure in size of entry struct too)
|
||||
*/
|
||||
tablesize = (ichdr.count + 1) * sizeof(xfs_attr_leaf_entry_t)
|
||||
+ xfs_attr3_leaf_hdr_size(leaf);
|
||||
tablesize = xfs_attr_leaf_entries_end(ichdr.count + 1, leaf);
|
||||
for (sum = 0, i = XFS_ATTR_LEAF_MAPSIZE - 1; i >= 0; i--) {
|
||||
if (tablesize > ichdr.firstused) {
|
||||
sum += ichdr.freemap[i].size;
|
||||
|
|
@ -1476,6 +1574,7 @@ xfs_attr3_leaf_add_work(
|
|||
struct xfs_attr_leaf_name_local *name_loc;
|
||||
struct xfs_attr_leaf_name_remote *name_rmt;
|
||||
struct xfs_mount *mp;
|
||||
int old_end, new_end;
|
||||
int tmp;
|
||||
int i;
|
||||
|
||||
|
|
@ -1568,17 +1667,48 @@ xfs_attr3_leaf_add_work(
|
|||
if (be16_to_cpu(entry->nameidx) < ichdr->firstused)
|
||||
ichdr->firstused = be16_to_cpu(entry->nameidx);
|
||||
|
||||
ASSERT(ichdr->firstused >= ichdr->count * sizeof(xfs_attr_leaf_entry_t)
|
||||
+ xfs_attr3_leaf_hdr_size(leaf));
|
||||
tmp = (ichdr->count - 1) * sizeof(xfs_attr_leaf_entry_t)
|
||||
+ xfs_attr3_leaf_hdr_size(leaf);
|
||||
new_end = xfs_attr_leaf_entries_end(ichdr->count, leaf);
|
||||
old_end = new_end - sizeof(struct xfs_attr_leaf_entry);
|
||||
|
||||
ASSERT(ichdr->firstused >= new_end);
|
||||
|
||||
for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; i++) {
|
||||
if (ichdr->freemap[i].base == tmp) {
|
||||
ichdr->freemap[i].base += sizeof(xfs_attr_leaf_entry_t);
|
||||
int diff = 0;
|
||||
|
||||
if (ichdr->freemap[i].base == old_end) {
|
||||
/*
|
||||
* This freemap entry starts at the old end of the
|
||||
* leaf entry array, so we need to adjust its base
|
||||
* upward to accomodate the larger array.
|
||||
*/
|
||||
diff = sizeof(struct xfs_attr_leaf_entry);
|
||||
} else if (ichdr->freemap[i].size > 0 &&
|
||||
ichdr->freemap[i].base < new_end) {
|
||||
/*
|
||||
* This freemap entry starts in the space claimed by
|
||||
* the new leaf entry. Adjust its base upward to
|
||||
* reflect that.
|
||||
*/
|
||||
diff = new_end - ichdr->freemap[i].base;
|
||||
}
|
||||
|
||||
if (diff) {
|
||||
ichdr->freemap[i].base += diff;
|
||||
ichdr->freemap[i].size -=
|
||||
min_t(uint16_t, ichdr->freemap[i].size,
|
||||
sizeof(xfs_attr_leaf_entry_t));
|
||||
min_t(uint16_t, ichdr->freemap[i].size, diff);
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't leave zero-length freemaps with nonzero base lying
|
||||
* around, because we don't want the code in _remove that
|
||||
* matches on base address to get confused and create
|
||||
* overlapping freemaps. If we end up with no freemap entries
|
||||
* then the next _add will compact the leaf block and
|
||||
* regenerate the freemaps.
|
||||
*/
|
||||
if (ichdr->freemap[i].size == 0 && ichdr->freemap[i].base > 0) {
|
||||
ichdr->freemap[i].base = 0;
|
||||
ichdr->holes = 1;
|
||||
}
|
||||
}
|
||||
ichdr->usedbytes += xfs_attr_leaf_entsize(leaf, args->index);
|
||||
|
|
@ -1623,6 +1753,10 @@ xfs_attr3_leaf_compact(
|
|||
ichdr_dst->freemap[0].base = xfs_attr3_leaf_hdr_size(leaf_src);
|
||||
ichdr_dst->freemap[0].size = ichdr_dst->firstused -
|
||||
ichdr_dst->freemap[0].base;
|
||||
ichdr_dst->freemap[1].base = 0;
|
||||
ichdr_dst->freemap[2].base = 0;
|
||||
ichdr_dst->freemap[1].size = 0;
|
||||
ichdr_dst->freemap[2].size = 0;
|
||||
|
||||
/* write the header back to initialise the underlying buffer */
|
||||
xfs_attr3_leaf_hdr_to_disk(args->geo, leaf_dst, ichdr_dst);
|
||||
|
|
@ -1774,8 +1908,8 @@ xfs_attr3_leaf_rebalance(
|
|||
/*
|
||||
* leaf2 is the destination, compact it if it looks tight.
|
||||
*/
|
||||
max = ichdr2.firstused - xfs_attr3_leaf_hdr_size(leaf1);
|
||||
max -= ichdr2.count * sizeof(xfs_attr_leaf_entry_t);
|
||||
max = ichdr2.firstused -
|
||||
xfs_attr_leaf_entries_end(ichdr2.count, leaf1);
|
||||
if (space > max)
|
||||
xfs_attr3_leaf_compact(args, &ichdr2, blk2->bp);
|
||||
|
||||
|
|
@ -1803,8 +1937,8 @@ xfs_attr3_leaf_rebalance(
|
|||
/*
|
||||
* leaf1 is the destination, compact it if it looks tight.
|
||||
*/
|
||||
max = ichdr1.firstused - xfs_attr3_leaf_hdr_size(leaf1);
|
||||
max -= ichdr1.count * sizeof(xfs_attr_leaf_entry_t);
|
||||
max = ichdr1.firstused -
|
||||
xfs_attr_leaf_entries_end(ichdr1.count, leaf1);
|
||||
if (space > max)
|
||||
xfs_attr3_leaf_compact(args, &ichdr1, blk1->bp);
|
||||
|
||||
|
|
@ -2010,9 +2144,7 @@ xfs_attr3_leaf_toosmall(
|
|||
blk = &state->path.blk[ state->path.active-1 ];
|
||||
leaf = blk->bp->b_addr;
|
||||
xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr, leaf);
|
||||
bytes = xfs_attr3_leaf_hdr_size(leaf) +
|
||||
ichdr.count * sizeof(xfs_attr_leaf_entry_t) +
|
||||
ichdr.usedbytes;
|
||||
bytes = xfs_attr_leaf_entries_end(ichdr.count, leaf) + ichdr.usedbytes;
|
||||
if (bytes > (state->args->geo->blksize >> 1)) {
|
||||
*action = 0; /* blk over 50%, don't try to join */
|
||||
return 0;
|
||||
|
|
@ -2070,9 +2202,8 @@ xfs_attr3_leaf_toosmall(
|
|||
bytes = state->args->geo->blksize -
|
||||
(state->args->geo->blksize >> 2) -
|
||||
ichdr.usedbytes - ichdr2.usedbytes -
|
||||
((ichdr.count + ichdr2.count) *
|
||||
sizeof(xfs_attr_leaf_entry_t)) -
|
||||
xfs_attr3_leaf_hdr_size(leaf);
|
||||
xfs_attr_leaf_entries_end(ichdr.count + ichdr2.count,
|
||||
leaf);
|
||||
|
||||
xfs_trans_brelse(state->args->trans, bp);
|
||||
if (bytes >= 0)
|
||||
|
|
@ -2134,8 +2265,7 @@ xfs_attr3_leaf_remove(
|
|||
|
||||
ASSERT(ichdr.count > 0 && ichdr.count < args->geo->blksize / 8);
|
||||
ASSERT(args->index >= 0 && args->index < ichdr.count);
|
||||
ASSERT(ichdr.firstused >= ichdr.count * sizeof(*entry) +
|
||||
xfs_attr3_leaf_hdr_size(leaf));
|
||||
ASSERT(ichdr.firstused >= xfs_attr_leaf_entries_end(ichdr.count, leaf));
|
||||
|
||||
entry = &xfs_attr3_leaf_entryp(leaf)[args->index];
|
||||
|
||||
|
|
@ -2148,8 +2278,7 @@ xfs_attr3_leaf_remove(
|
|||
* find smallest free region in case we need to replace it,
|
||||
* adjust any map that borders the entry table,
|
||||
*/
|
||||
tablesize = ichdr.count * sizeof(xfs_attr_leaf_entry_t)
|
||||
+ xfs_attr3_leaf_hdr_size(leaf);
|
||||
tablesize = xfs_attr_leaf_entries_end(ichdr.count, leaf);
|
||||
tmp = ichdr.freemap[0].size;
|
||||
before = after = -1;
|
||||
smallest = XFS_ATTR_LEAF_MAPSIZE - 1;
|
||||
|
|
@ -2256,8 +2385,7 @@ xfs_attr3_leaf_remove(
|
|||
* Check if leaf is less than 50% full, caller may want to
|
||||
* "join" the leaf with a sibling if so.
|
||||
*/
|
||||
tmp = ichdr.usedbytes + xfs_attr3_leaf_hdr_size(leaf) +
|
||||
ichdr.count * sizeof(xfs_attr_leaf_entry_t);
|
||||
tmp = ichdr.usedbytes + xfs_attr_leaf_entries_end(ichdr.count, leaf);
|
||||
|
||||
return tmp < args->geo->magicpct; /* leaf is < 37% full */
|
||||
}
|
||||
|
|
@ -2580,11 +2708,11 @@ xfs_attr3_leaf_moveents(
|
|||
ichdr_s->magic == XFS_ATTR3_LEAF_MAGIC);
|
||||
ASSERT(ichdr_s->magic == ichdr_d->magic);
|
||||
ASSERT(ichdr_s->count > 0 && ichdr_s->count < args->geo->blksize / 8);
|
||||
ASSERT(ichdr_s->firstused >= (ichdr_s->count * sizeof(*entry_s))
|
||||
+ xfs_attr3_leaf_hdr_size(leaf_s));
|
||||
ASSERT(ichdr_s->firstused >=
|
||||
xfs_attr_leaf_entries_end(ichdr_s->count, leaf_s));
|
||||
ASSERT(ichdr_d->count < args->geo->blksize / 8);
|
||||
ASSERT(ichdr_d->firstused >= (ichdr_d->count * sizeof(*entry_d))
|
||||
+ xfs_attr3_leaf_hdr_size(leaf_d));
|
||||
ASSERT(ichdr_d->firstused >=
|
||||
xfs_attr_leaf_entries_end(ichdr_d->count, leaf_d));
|
||||
|
||||
ASSERT(start_s < ichdr_s->count);
|
||||
ASSERT(start_d <= ichdr_d->count);
|
||||
|
|
@ -2644,8 +2772,7 @@ xfs_attr3_leaf_moveents(
|
|||
ichdr_d->usedbytes += tmp;
|
||||
ichdr_s->count -= 1;
|
||||
ichdr_d->count += 1;
|
||||
tmp = ichdr_d->count * sizeof(xfs_attr_leaf_entry_t)
|
||||
+ xfs_attr3_leaf_hdr_size(leaf_d);
|
||||
tmp = xfs_attr_leaf_entries_end(ichdr_d->count, leaf_d);
|
||||
ASSERT(ichdr_d->firstused >= tmp);
|
||||
#ifdef GROT
|
||||
}
|
||||
|
|
@ -2681,8 +2808,8 @@ xfs_attr3_leaf_moveents(
|
|||
/*
|
||||
* Fill in the freemap information
|
||||
*/
|
||||
ichdr_d->freemap[0].base = xfs_attr3_leaf_hdr_size(leaf_d);
|
||||
ichdr_d->freemap[0].base += ichdr_d->count * sizeof(xfs_attr_leaf_entry_t);
|
||||
ichdr_d->freemap[0].base =
|
||||
xfs_attr_leaf_entries_end(ichdr_d->count, leaf_d);
|
||||
ichdr_d->freemap[0].size = ichdr_d->firstused - ichdr_d->freemap[0].base;
|
||||
ichdr_d->freemap[1].base = 0;
|
||||
ichdr_d->freemap[2].base = 0;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ struct xfs_attr3_icleaf_hdr {
|
|||
* Internal routines when attribute fork size < XFS_LITINO(mp).
|
||||
*/
|
||||
void xfs_attr_shortform_create(struct xfs_da_args *args);
|
||||
int xfs_attr_shortform_replace(struct xfs_da_args *args);
|
||||
void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
|
||||
int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
|
||||
int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2013 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_log_format.h"
|
||||
#include "xfs_bit.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2006 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2021-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2020 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2013 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -746,7 +746,7 @@ struct xfs_attr3_leafblock {
|
|||
#define XFS_ATTR_LEAF_NAME_ALIGN ((uint)sizeof(xfs_dablk_t))
|
||||
|
||||
static inline int
|
||||
xfs_attr3_leaf_hdr_size(struct xfs_attr_leafblock *leafp)
|
||||
xfs_attr3_leaf_hdr_size(const struct xfs_attr_leafblock *leafp)
|
||||
{
|
||||
if (leafp->hdr.info.magic == cpu_to_be16(XFS_ATTR3_LEAF_MAGIC))
|
||||
return sizeof(struct xfs_attr3_leaf_hdr);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2016 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -565,7 +565,7 @@ xfs_defer_relog(
|
|||
continue;
|
||||
|
||||
trace_xfs_defer_relog_intent((*tpp)->t_mountp, dfp);
|
||||
XFS_STATS_INC((*tpp)->t_mountp, defer_relog);
|
||||
XFS_STATS_INC((*tpp)->t_mountp, xs_defer_relog);
|
||||
|
||||
xfs_defer_relog_intent(*tpp, dfp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2013 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2013 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2013 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2013 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2013 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
* Drop-writes support removed because write error handling cannot trash
|
||||
* pre-existing delalloc extents in any useful way anymore. We retain the
|
||||
* definition so that we can reject it as an invalid value in
|
||||
* xfs_errortag_valid().
|
||||
* xfs_errortag_add().
|
||||
*/
|
||||
#define XFS_ERRTAG_DROP_WRITES 28
|
||||
#define XFS_ERRTAG_LOG_BAD_CRC 29
|
||||
|
|
@ -74,7 +74,8 @@
|
|||
#define XFS_ERRTAG_EXCHMAPS_FINISH_ONE 44
|
||||
#define XFS_ERRTAG_METAFILE_RESV_CRITICAL 45
|
||||
#define XFS_ERRTAG_FORCE_ZERO_RANGE 46
|
||||
#define XFS_ERRTAG_MAX 47
|
||||
#define XFS_ERRTAG_ZONE_RESET 47
|
||||
#define XFS_ERRTAG_MAX 48
|
||||
|
||||
/*
|
||||
* Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
|
||||
|
|
@ -135,7 +136,8 @@ XFS_ERRTAG(WB_DELAY_MS, wb_delay_ms, 3000) \
|
|||
XFS_ERRTAG(WRITE_DELAY_MS, write_delay_ms, 3000) \
|
||||
XFS_ERRTAG(EXCHMAPS_FINISH_ONE, exchmaps_finish_one, 1) \
|
||||
XFS_ERRTAG(METAFILE_RESV_CRITICAL, metafile_resv_crit, 4) \
|
||||
XFS_ERRTAG(FORCE_ZERO_RANGE, force_zero_range, 4)
|
||||
XFS_ERRTAG(FORCE_ZERO_RANGE, force_zero_range, 4) \
|
||||
XFS_ERRTAG(ZONE_RESET, zone_reset, 1)
|
||||
#endif /* XFS_ERRTAG */
|
||||
|
||||
#endif /* __XFS_ERRORTAG_H_ */
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2020-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -1003,6 +1003,191 @@ struct xfs_rtgroup_geometry {
|
|||
#define XFS_RTGROUP_GEOM_SICK_RMAPBT (1U << 3) /* reverse mappings */
|
||||
#define XFS_RTGROUP_GEOM_SICK_REFCNTBT (1U << 4) /* reference counts */
|
||||
|
||||
/* Health monitor event domains */
|
||||
|
||||
/* affects the whole fs */
|
||||
#define XFS_HEALTH_MONITOR_DOMAIN_MOUNT (0)
|
||||
|
||||
/* metadata health events */
|
||||
#define XFS_HEALTH_MONITOR_DOMAIN_FS (1)
|
||||
#define XFS_HEALTH_MONITOR_DOMAIN_AG (2)
|
||||
#define XFS_HEALTH_MONITOR_DOMAIN_INODE (3)
|
||||
#define XFS_HEALTH_MONITOR_DOMAIN_RTGROUP (4)
|
||||
|
||||
/* disk events */
|
||||
#define XFS_HEALTH_MONITOR_DOMAIN_DATADEV (5)
|
||||
#define XFS_HEALTH_MONITOR_DOMAIN_RTDEV (6)
|
||||
#define XFS_HEALTH_MONITOR_DOMAIN_LOGDEV (7)
|
||||
|
||||
/* file range events */
|
||||
#define XFS_HEALTH_MONITOR_DOMAIN_FILERANGE (8)
|
||||
|
||||
/* Health monitor event types */
|
||||
|
||||
/* status of the monitor itself */
|
||||
#define XFS_HEALTH_MONITOR_TYPE_RUNNING (0)
|
||||
#define XFS_HEALTH_MONITOR_TYPE_LOST (1)
|
||||
|
||||
/* filesystem was unmounted */
|
||||
#define XFS_HEALTH_MONITOR_TYPE_UNMOUNT (2)
|
||||
|
||||
/* metadata health events */
|
||||
#define XFS_HEALTH_MONITOR_TYPE_SICK (3)
|
||||
#define XFS_HEALTH_MONITOR_TYPE_CORRUPT (4)
|
||||
#define XFS_HEALTH_MONITOR_TYPE_HEALTHY (5)
|
||||
|
||||
/* filesystem shutdown */
|
||||
#define XFS_HEALTH_MONITOR_TYPE_SHUTDOWN (6)
|
||||
|
||||
/* media errors */
|
||||
#define XFS_HEALTH_MONITOR_TYPE_MEDIA_ERROR (7)
|
||||
|
||||
/* pagecache I/O to a file range failed */
|
||||
#define XFS_HEALTH_MONITOR_TYPE_BUFREAD (8)
|
||||
#define XFS_HEALTH_MONITOR_TYPE_BUFWRITE (9)
|
||||
|
||||
/* direct I/O to a file range failed */
|
||||
#define XFS_HEALTH_MONITOR_TYPE_DIOREAD (10)
|
||||
#define XFS_HEALTH_MONITOR_TYPE_DIOWRITE (11)
|
||||
|
||||
/* out of band media error reported for a file range */
|
||||
#define XFS_HEALTH_MONITOR_TYPE_DATALOST (12)
|
||||
|
||||
/* lost events */
|
||||
struct xfs_health_monitor_lost {
|
||||
__u64 count;
|
||||
};
|
||||
|
||||
/* fs/rt metadata */
|
||||
struct xfs_health_monitor_fs {
|
||||
/* XFS_FSOP_GEOM_SICK_* flags */
|
||||
__u32 mask;
|
||||
};
|
||||
|
||||
/* ag/rtgroup metadata */
|
||||
struct xfs_health_monitor_group {
|
||||
/* XFS_{AG,RTGROUP}_SICK_* flags */
|
||||
__u32 mask;
|
||||
__u32 gno;
|
||||
};
|
||||
|
||||
/* inode metadata */
|
||||
struct xfs_health_monitor_inode {
|
||||
/* XFS_BS_SICK_* flags */
|
||||
__u32 mask;
|
||||
__u32 gen;
|
||||
__u64 ino;
|
||||
};
|
||||
|
||||
/* shutdown reasons */
|
||||
#define XFS_HEALTH_SHUTDOWN_META_IO_ERROR (1u << 0)
|
||||
#define XFS_HEALTH_SHUTDOWN_LOG_IO_ERROR (1u << 1)
|
||||
#define XFS_HEALTH_SHUTDOWN_FORCE_UMOUNT (1u << 2)
|
||||
#define XFS_HEALTH_SHUTDOWN_CORRUPT_INCORE (1u << 3)
|
||||
#define XFS_HEALTH_SHUTDOWN_CORRUPT_ONDISK (1u << 4)
|
||||
#define XFS_HEALTH_SHUTDOWN_DEVICE_REMOVED (1u << 5)
|
||||
|
||||
/* shutdown */
|
||||
struct xfs_health_monitor_shutdown {
|
||||
/* XFS_HEALTH_SHUTDOWN_* flags */
|
||||
__u32 reasons;
|
||||
};
|
||||
|
||||
/* file range events */
|
||||
struct xfs_health_monitor_filerange {
|
||||
__u64 pos;
|
||||
__u64 len;
|
||||
__u64 ino;
|
||||
__u32 gen;
|
||||
__u32 error;
|
||||
};
|
||||
|
||||
/* disk media errors */
|
||||
struct xfs_health_monitor_media {
|
||||
__u64 daddr;
|
||||
__u64 bbcount;
|
||||
};
|
||||
|
||||
struct xfs_health_monitor_event {
|
||||
/* XFS_HEALTH_MONITOR_DOMAIN_* */
|
||||
__u32 domain;
|
||||
|
||||
/* XFS_HEALTH_MONITOR_TYPE_* */
|
||||
__u32 type;
|
||||
|
||||
/* Timestamp of the event, in nanoseconds since the Unix epoch */
|
||||
__u64 time_ns;
|
||||
|
||||
/*
|
||||
* Details of the event. The primary clients are written in python
|
||||
* and rust, so break this up because bindgen hates anonymous structs
|
||||
* and unions.
|
||||
*/
|
||||
union {
|
||||
struct xfs_health_monitor_lost lost;
|
||||
struct xfs_health_monitor_fs fs;
|
||||
struct xfs_health_monitor_group group;
|
||||
struct xfs_health_monitor_inode inode;
|
||||
struct xfs_health_monitor_shutdown shutdown;
|
||||
struct xfs_health_monitor_media media;
|
||||
struct xfs_health_monitor_filerange filerange;
|
||||
} e;
|
||||
|
||||
/* zeroes */
|
||||
__u64 pad[2];
|
||||
};
|
||||
|
||||
struct xfs_health_monitor {
|
||||
__u64 flags; /* flags */
|
||||
__u8 format; /* output format */
|
||||
__u8 pad[23]; /* zeroes */
|
||||
};
|
||||
|
||||
/* Return all health status events, not just deltas */
|
||||
#define XFS_HEALTH_MONITOR_VERBOSE (1ULL << 0)
|
||||
|
||||
#define XFS_HEALTH_MONITOR_ALL (XFS_HEALTH_MONITOR_VERBOSE)
|
||||
|
||||
/* Initial return format version */
|
||||
#define XFS_HEALTH_MONITOR_FMT_V0 (0)
|
||||
|
||||
/*
|
||||
* Check that a given fd points to the same filesystem that the health monitor
|
||||
* is monitoring.
|
||||
*/
|
||||
struct xfs_health_file_on_monitored_fs {
|
||||
__s32 fd;
|
||||
__u32 flags; /* zero for now */
|
||||
};
|
||||
|
||||
/* Verify the media of the underlying devices */
|
||||
struct xfs_verify_media {
|
||||
__u32 me_dev; /* I: XFS_DEV_{DATA,LOG,RT} */
|
||||
__u32 me_flags; /* I: XFS_VERIFY_MEDIA_* */
|
||||
|
||||
/*
|
||||
* IO: inclusive start of disk range to verify, in 512b blocks.
|
||||
* Will be adjusted upwards as media verification succeeds.
|
||||
*/
|
||||
__u64 me_start_daddr;
|
||||
|
||||
/*
|
||||
* IO: exclusive end of the disk range to verify, in 512b blocks.
|
||||
* Can be adjusted downwards to match device size.
|
||||
*/
|
||||
__u64 me_end_daddr;
|
||||
|
||||
__u32 me_ioerror; /* O: I/O error (positive) */
|
||||
__u32 me_max_io_size; /* I: maximum IO size in bytes */
|
||||
|
||||
__u32 me_rest_us; /* I: rest time between IOs, usecs */
|
||||
__u32 me_pad; /* zero */
|
||||
};
|
||||
|
||||
#define XFS_VERIFY_MEDIA_REPORT (1 << 0) /* report to fsnotify */
|
||||
|
||||
#define XFS_VERIFY_MEDIA_FLAGS (XFS_VERIFY_MEDIA_REPORT)
|
||||
|
||||
/*
|
||||
* ioctl commands that are used by Linux filesystems
|
||||
*/
|
||||
|
|
@ -1042,6 +1227,10 @@ struct xfs_rtgroup_geometry {
|
|||
#define XFS_IOC_GETPARENTS_BY_HANDLE _IOWR('X', 63, struct xfs_getparents_by_handle)
|
||||
#define XFS_IOC_SCRUBV_METADATA _IOWR('X', 64, struct xfs_scrub_vec_head)
|
||||
#define XFS_IOC_RTGROUP_GEOMETRY _IOWR('X', 65, struct xfs_rtgroup_geometry)
|
||||
#define XFS_IOC_HEALTH_MONITOR _IOW ('X', 68, struct xfs_health_monitor)
|
||||
#define XFS_IOC_HEALTH_FD_ON_MONITORED_FS \
|
||||
_IOW ('X', 69, struct xfs_health_file_on_monitored_fs)
|
||||
#define XFS_IOC_VERIFY_MEDIA _IOWR('X', 70, struct xfs_verify_media)
|
||||
|
||||
/*
|
||||
* ioctl commands that replace IRIX syssgi()'s
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
#include "xfs_trans_resv.h"
|
||||
|
|
|
|||
|
|
@ -289,4 +289,9 @@ void xfs_bulkstat_health(struct xfs_inode *ip, struct xfs_bulkstat *bs);
|
|||
#define xfs_metadata_is_sick(error) \
|
||||
(unlikely((error) == -EFSCORRUPTED || (error) == -EFSBADCRC))
|
||||
|
||||
unsigned int xfs_healthmon_inode_mask(unsigned int sick_mask);
|
||||
unsigned int xfs_healthmon_rtgroup_mask(unsigned int sick_mask);
|
||||
unsigned int xfs_healthmon_perag_mask(unsigned int sick_mask);
|
||||
unsigned int xfs_healthmon_fs_mask(unsigned int sick_mask);
|
||||
|
||||
#endif /* __XFS_HEALTH_H__ */
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2017 Christoph Hellwig.
|
||||
*/
|
||||
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
#include "xfs_bit.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2006 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
#include <linux/iversion.h>
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -184,13 +184,6 @@ struct xlog_rec_header {
|
|||
#define XLOG_REC_SIZE_OTHER offsetofend(struct xlog_rec_header, h_size)
|
||||
#endif /* __i386__ */
|
||||
|
||||
/* not an on-disk structure, but needed by log recovery in userspace */
|
||||
struct xfs_log_iovec {
|
||||
void *i_addr; /* beginning address of region */
|
||||
int i_len; /* length in bytes of region */
|
||||
uint i_type; /* type of region */
|
||||
};
|
||||
|
||||
/*
|
||||
* Transaction Header definitions.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2013 Jie Liu.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2018-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2018-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2022-2024 Oracle.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_format.h"
|
||||
#include "xfs_da_format.h"
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
#include "xfs_trans_space.h"
|
||||
#include "xfs_attr_item.h"
|
||||
#include "xfs_health.h"
|
||||
#include "xfs_attr_leaf.h"
|
||||
|
||||
struct kmem_cache *xfs_parent_args_cache;
|
||||
|
||||
|
|
@ -202,8 +203,8 @@ xfs_parent_addname(
|
|||
xfs_inode_to_parent_rec(&ppargs->rec, dp);
|
||||
xfs_parent_da_args_init(&ppargs->args, tp, &ppargs->rec, child,
|
||||
child->i_ino, parent_name);
|
||||
xfs_attr_defer_add(&ppargs->args, XFS_ATTR_DEFER_SET);
|
||||
return 0;
|
||||
|
||||
return xfs_attr_setname(&ppargs->args, 0);
|
||||
}
|
||||
|
||||
/* Remove a parent pointer to reflect a dirent removal. */
|
||||
|
|
@ -224,8 +225,8 @@ xfs_parent_removename(
|
|||
xfs_inode_to_parent_rec(&ppargs->rec, dp);
|
||||
xfs_parent_da_args_init(&ppargs->args, tp, &ppargs->rec, child,
|
||||
child->i_ino, parent_name);
|
||||
xfs_attr_defer_add(&ppargs->args, XFS_ATTR_DEFER_REMOVE);
|
||||
return 0;
|
||||
|
||||
return xfs_attr_removename(&ppargs->args);
|
||||
}
|
||||
|
||||
/* Replace one parent pointer with another to reflect a rename. */
|
||||
|
|
@ -250,12 +251,13 @@ xfs_parent_replacename(
|
|||
child->i_ino, old_name);
|
||||
|
||||
xfs_inode_to_parent_rec(&ppargs->new_rec, new_dp);
|
||||
|
||||
ppargs->args.new_name = new_name->name;
|
||||
ppargs->args.new_namelen = new_name->len;
|
||||
ppargs->args.new_value = &ppargs->new_rec;
|
||||
ppargs->args.new_valuelen = sizeof(struct xfs_parent_rec);
|
||||
xfs_attr_defer_add(&ppargs->args, XFS_ATTR_DEFER_REPLACE);
|
||||
return 0;
|
||||
|
||||
return xfs_attr_replacename(&ppargs->args, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2016 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2016 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2014 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2014 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2022-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -371,4 +371,19 @@ xfs_rtgs_to_rfsbs(
|
|||
return xfs_groups_to_rfsbs(mp, nr_groups, XG_TYPE_RTG);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the "raw" size of a group on the hardware device. This includes the
|
||||
* daddr gaps present for XFS_SB_FEAT_INCOMPAT_ZONE_GAPS file systems.
|
||||
*/
|
||||
static inline xfs_rgblock_t
|
||||
xfs_rtgroup_raw_size(
|
||||
struct xfs_mount *mp)
|
||||
{
|
||||
struct xfs_groups *g = &mp->m_groups[XG_TYPE_RTG];
|
||||
|
||||
if (g->has_daddr_gaps)
|
||||
return 1U << g->blklog;
|
||||
return g->blocks;
|
||||
}
|
||||
|
||||
#endif /* __LIBXFS_RTGROUP_H */
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2021-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2018-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2012-2013 Red Hat, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_format.h"
|
||||
#include "xfs_log_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000,2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2000,2005 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2017 Oracle.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_format.h"
|
||||
#include "xfs_shared.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2023-2025 Christoph Hellwig.
|
||||
* Copyright (c) 2024-2025, Western Digital Corporation or its affiliates.
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -15,173 +15,102 @@
|
|||
#include "xfs_zones.h"
|
||||
|
||||
static bool
|
||||
xfs_zone_validate_empty(
|
||||
xfs_validate_blk_zone_seq(
|
||||
struct xfs_mount *mp,
|
||||
struct blk_zone *zone,
|
||||
struct xfs_rtgroup *rtg,
|
||||
unsigned int zone_no,
|
||||
xfs_rgblock_t *write_pointer)
|
||||
{
|
||||
struct xfs_mount *mp = rtg_mount(rtg);
|
||||
|
||||
if (rtg_rmap(rtg)->i_used_blocks > 0) {
|
||||
xfs_warn(mp, "empty zone %u has non-zero used counter (0x%x).",
|
||||
rtg_rgno(rtg), rtg_rmap(rtg)->i_used_blocks);
|
||||
return false;
|
||||
}
|
||||
|
||||
*write_pointer = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
xfs_zone_validate_wp(
|
||||
struct blk_zone *zone,
|
||||
struct xfs_rtgroup *rtg,
|
||||
xfs_rgblock_t *write_pointer)
|
||||
{
|
||||
struct xfs_mount *mp = rtg_mount(rtg);
|
||||
xfs_rtblock_t wp_fsb = xfs_daddr_to_rtb(mp, zone->wp);
|
||||
|
||||
if (rtg_rmap(rtg)->i_used_blocks > rtg->rtg_extents) {
|
||||
xfs_warn(mp, "zone %u has too large used counter (0x%x).",
|
||||
rtg_rgno(rtg), rtg_rmap(rtg)->i_used_blocks);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (xfs_rtb_to_rgno(mp, wp_fsb) != rtg_rgno(rtg)) {
|
||||
xfs_warn(mp, "zone %u write pointer (0x%llx) outside of zone.",
|
||||
rtg_rgno(rtg), wp_fsb);
|
||||
return false;
|
||||
}
|
||||
|
||||
*write_pointer = xfs_rtb_to_rgbno(mp, wp_fsb);
|
||||
if (*write_pointer >= rtg->rtg_extents) {
|
||||
xfs_warn(mp, "zone %u has invalid write pointer (0x%x).",
|
||||
rtg_rgno(rtg), *write_pointer);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
xfs_zone_validate_full(
|
||||
struct blk_zone *zone,
|
||||
struct xfs_rtgroup *rtg,
|
||||
xfs_rgblock_t *write_pointer)
|
||||
{
|
||||
struct xfs_mount *mp = rtg_mount(rtg);
|
||||
|
||||
if (rtg_rmap(rtg)->i_used_blocks > rtg->rtg_extents) {
|
||||
xfs_warn(mp, "zone %u has too large used counter (0x%x).",
|
||||
rtg_rgno(rtg), rtg_rmap(rtg)->i_used_blocks);
|
||||
return false;
|
||||
}
|
||||
|
||||
*write_pointer = rtg->rtg_extents;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
xfs_zone_validate_seq(
|
||||
struct blk_zone *zone,
|
||||
struct xfs_rtgroup *rtg,
|
||||
xfs_rgblock_t *write_pointer)
|
||||
{
|
||||
struct xfs_mount *mp = rtg_mount(rtg);
|
||||
|
||||
switch (zone->cond) {
|
||||
case BLK_ZONE_COND_EMPTY:
|
||||
return xfs_zone_validate_empty(zone, rtg, write_pointer);
|
||||
*write_pointer = 0;
|
||||
return true;
|
||||
case BLK_ZONE_COND_IMP_OPEN:
|
||||
case BLK_ZONE_COND_EXP_OPEN:
|
||||
case BLK_ZONE_COND_CLOSED:
|
||||
case BLK_ZONE_COND_ACTIVE:
|
||||
return xfs_zone_validate_wp(zone, rtg, write_pointer);
|
||||
if (zone->wp < zone->start ||
|
||||
zone->wp >= zone->start + zone->capacity) {
|
||||
xfs_warn(mp,
|
||||
"zone %u write pointer (%llu) outside of zone.",
|
||||
zone_no, zone->wp);
|
||||
return false;
|
||||
}
|
||||
|
||||
*write_pointer = XFS_BB_TO_FSB(mp, zone->wp - zone->start);
|
||||
return true;
|
||||
case BLK_ZONE_COND_FULL:
|
||||
return xfs_zone_validate_full(zone, rtg, write_pointer);
|
||||
*write_pointer = XFS_BB_TO_FSB(mp, zone->capacity);
|
||||
return true;
|
||||
case BLK_ZONE_COND_NOT_WP:
|
||||
case BLK_ZONE_COND_OFFLINE:
|
||||
case BLK_ZONE_COND_READONLY:
|
||||
xfs_warn(mp, "zone %u has unsupported zone condition 0x%x.",
|
||||
rtg_rgno(rtg), zone->cond);
|
||||
zone_no, zone->cond);
|
||||
return false;
|
||||
default:
|
||||
xfs_warn(mp, "zone %u has unknown zone condition 0x%x.",
|
||||
rtg_rgno(rtg), zone->cond);
|
||||
zone_no, zone->cond);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
xfs_zone_validate_conv(
|
||||
xfs_validate_blk_zone_conv(
|
||||
struct xfs_mount *mp,
|
||||
struct blk_zone *zone,
|
||||
struct xfs_rtgroup *rtg)
|
||||
unsigned int zone_no)
|
||||
{
|
||||
struct xfs_mount *mp = rtg_mount(rtg);
|
||||
|
||||
switch (zone->cond) {
|
||||
case BLK_ZONE_COND_NOT_WP:
|
||||
return true;
|
||||
default:
|
||||
xfs_warn(mp,
|
||||
"conventional zone %u has unsupported zone condition 0x%x.",
|
||||
rtg_rgno(rtg), zone->cond);
|
||||
zone_no, zone->cond);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
xfs_zone_validate(
|
||||
xfs_validate_blk_zone(
|
||||
struct xfs_mount *mp,
|
||||
struct blk_zone *zone,
|
||||
struct xfs_rtgroup *rtg,
|
||||
unsigned int zone_no,
|
||||
uint32_t expected_size,
|
||||
uint32_t expected_capacity,
|
||||
xfs_rgblock_t *write_pointer)
|
||||
{
|
||||
struct xfs_mount *mp = rtg_mount(rtg);
|
||||
struct xfs_groups *g = &mp->m_groups[XG_TYPE_RTG];
|
||||
uint32_t expected_size;
|
||||
|
||||
/*
|
||||
* Check that the zone capacity matches the rtgroup size stored in the
|
||||
* superblock. Note that all zones including the last one must have a
|
||||
* uniform capacity.
|
||||
*/
|
||||
if (XFS_BB_TO_FSB(mp, zone->capacity) != g->blocks) {
|
||||
if (XFS_BB_TO_FSB(mp, zone->capacity) != expected_capacity) {
|
||||
xfs_warn(mp,
|
||||
"zone %u capacity (0x%llx) does not match RT group size (0x%x).",
|
||||
rtg_rgno(rtg), XFS_BB_TO_FSB(mp, zone->capacity),
|
||||
g->blocks);
|
||||
"zone %u capacity (%llu) does not match RT group size (%u).",
|
||||
zone_no, XFS_BB_TO_FSB(mp, zone->capacity),
|
||||
expected_capacity);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (g->has_daddr_gaps) {
|
||||
expected_size = 1 << g->blklog;
|
||||
} else {
|
||||
if (zone->len != zone->capacity) {
|
||||
xfs_warn(mp,
|
||||
"zone %u has capacity != size ((0x%llx vs 0x%llx)",
|
||||
rtg_rgno(rtg),
|
||||
XFS_BB_TO_FSB(mp, zone->len),
|
||||
XFS_BB_TO_FSB(mp, zone->capacity));
|
||||
return false;
|
||||
}
|
||||
expected_size = g->blocks;
|
||||
}
|
||||
|
||||
if (XFS_BB_TO_FSB(mp, zone->len) != expected_size) {
|
||||
xfs_warn(mp,
|
||||
"zone %u length (0x%llx) does match geometry (0x%x).",
|
||||
rtg_rgno(rtg), XFS_BB_TO_FSB(mp, zone->len),
|
||||
"zone %u length (%llu) does not match geometry (%u).",
|
||||
zone_no, XFS_BB_TO_FSB(mp, zone->len),
|
||||
expected_size);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (zone->type) {
|
||||
case BLK_ZONE_TYPE_CONVENTIONAL:
|
||||
return xfs_zone_validate_conv(zone, rtg);
|
||||
return xfs_validate_blk_zone_conv(mp, zone, zone_no);
|
||||
case BLK_ZONE_TYPE_SEQWRITE_REQ:
|
||||
return xfs_zone_validate_seq(zone, rtg, write_pointer);
|
||||
return xfs_validate_blk_zone_seq(mp, zone, zone_no,
|
||||
write_pointer);
|
||||
default:
|
||||
xfs_warn(mp, "zoned %u has unsupported type 0x%x.",
|
||||
rtg_rgno(rtg), zone->type);
|
||||
zone_no, zone->type);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#define _LIBXFS_ZONES_H
|
||||
|
||||
struct xfs_rtgroup;
|
||||
struct blk_zone;
|
||||
|
||||
/*
|
||||
* In order to guarantee forward progress for GC we need to reserve at least
|
||||
|
|
@ -36,7 +37,8 @@ struct xfs_rtgroup;
|
|||
*/
|
||||
#define XFS_DEFAULT_MAX_OPEN_ZONES 128
|
||||
|
||||
bool xfs_zone_validate(struct blk_zone *zone, struct xfs_rtgroup *rtg,
|
||||
xfs_rgblock_t *write_pointer);
|
||||
bool xfs_validate_blk_zone(struct xfs_mount *mp, struct blk_zone *zone,
|
||||
unsigned int zone_no, uint32_t expected_size,
|
||||
uint32_t expected_capacity, xfs_rgblock_t *write_pointer);
|
||||
|
||||
#endif /* _LIBXFS_ZONES_H */
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2018-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_bit.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2018-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -837,8 +837,12 @@ xrep_agi_buf_cleanup(
|
|||
{
|
||||
struct xrep_agi *ragi = buf;
|
||||
|
||||
xfarray_destroy(ragi->iunlink_prev);
|
||||
xfarray_destroy(ragi->iunlink_next);
|
||||
if (ragi->iunlink_prev)
|
||||
xfarray_destroy(ragi->iunlink_prev);
|
||||
ragi->iunlink_prev = NULL;
|
||||
if (ragi->iunlink_next)
|
||||
xfarray_destroy(ragi->iunlink_next);
|
||||
ragi->iunlink_next = NULL;
|
||||
xagino_bitmap_destroy(&ragi->iunlink_bmp);
|
||||
}
|
||||
|
||||
|
|
@ -1708,7 +1712,6 @@ xrep_agi(
|
|||
{
|
||||
struct xrep_agi *ragi;
|
||||
struct xfs_mount *mp = sc->mp;
|
||||
char *descr;
|
||||
unsigned int i;
|
||||
int error;
|
||||
|
||||
|
|
@ -1742,17 +1745,13 @@ xrep_agi(
|
|||
xagino_bitmap_init(&ragi->iunlink_bmp);
|
||||
sc->buf_cleanup = xrep_agi_buf_cleanup;
|
||||
|
||||
descr = xchk_xfile_ag_descr(sc, "iunlinked next pointers");
|
||||
error = xfarray_create(descr, 0, sizeof(xfs_agino_t),
|
||||
&ragi->iunlink_next);
|
||||
kfree(descr);
|
||||
error = xfarray_create("iunlinked next pointers", 0,
|
||||
sizeof(xfs_agino_t), &ragi->iunlink_next);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
descr = xchk_xfile_ag_descr(sc, "iunlinked prev pointers");
|
||||
error = xfarray_create(descr, 0, sizeof(xfs_agino_t),
|
||||
&ragi->iunlink_prev);
|
||||
kfree(descr);
|
||||
error = xfarray_create("iunlinked prev pointers", 0,
|
||||
sizeof(xfs_agino_t), &ragi->iunlink_prev);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2018-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -850,7 +850,6 @@ xrep_allocbt(
|
|||
struct xrep_abt *ra;
|
||||
struct xfs_mount *mp = sc->mp;
|
||||
unsigned int busy_gen;
|
||||
char *descr;
|
||||
int error;
|
||||
|
||||
/* We require the rmapbt to rebuild anything. */
|
||||
|
|
@ -876,11 +875,9 @@ xrep_allocbt(
|
|||
}
|
||||
|
||||
/* Set up enough storage to handle maximally fragmented free space. */
|
||||
descr = xchk_xfile_ag_descr(sc, "free space records");
|
||||
error = xfarray_create(descr, mp->m_sb.sb_agblocks / 2,
|
||||
error = xfarray_create("free space records", mp->m_sb.sb_agblocks / 2,
|
||||
sizeof(struct xfs_alloc_rec_incore),
|
||||
&ra->free_records);
|
||||
kfree(descr);
|
||||
if (error)
|
||||
goto out_ra;
|
||||
|
||||
|
|
@ -926,7 +923,22 @@ xrep_revalidate_allocbt(
|
|||
if (error)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* If the bnobt is still corrupt, we've failed to repair the filesystem
|
||||
* and should just bail out.
|
||||
*
|
||||
* If the bnobt fails cross-examination with the cntbt, the scan will
|
||||
* free the cntbt cursor, so we need to mark the repair incomplete
|
||||
* and avoid walking off the end of the NULL cntbt cursor.
|
||||
*/
|
||||
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
|
||||
goto out;
|
||||
|
||||
sc->sm->sm_type = XFS_SCRUB_TYPE_CNTBT;
|
||||
if (!sc->sa.cnt_cur) {
|
||||
xchk_set_incomplete(sc);
|
||||
goto out;
|
||||
}
|
||||
error = xchk_allocbt(sc);
|
||||
out:
|
||||
sc->sm->sm_type = old_type;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -287,32 +287,6 @@ xchk_xattr_set_map(
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the leaf freemap from the usage bitmap. Returns false if the
|
||||
* attr freemap has problems or points to used space.
|
||||
*/
|
||||
STATIC bool
|
||||
xchk_xattr_check_freemap(
|
||||
struct xfs_scrub *sc,
|
||||
struct xfs_attr3_icleaf_hdr *leafhdr)
|
||||
{
|
||||
struct xchk_xattr_buf *ab = sc->buf;
|
||||
unsigned int mapsize = sc->mp->m_attr_geo->blksize;
|
||||
int i;
|
||||
|
||||
/* Construct bitmap of freemap contents. */
|
||||
bitmap_zero(ab->freemap, mapsize);
|
||||
for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; i++) {
|
||||
if (!xchk_xattr_set_map(sc, ab->freemap,
|
||||
leafhdr->freemap[i].base,
|
||||
leafhdr->freemap[i].size))
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Look for bits that are set in freemap and are marked in use. */
|
||||
return !bitmap_intersects(ab->freemap, ab->usedmap, mapsize);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check this leaf entry's relations to everything else.
|
||||
* Returns the number of bytes used for the name/value data.
|
||||
|
|
@ -364,7 +338,10 @@ xchk_xattr_entry(
|
|||
rentry = xfs_attr3_leaf_name_remote(leaf, idx);
|
||||
namesize = xfs_attr_leaf_entsize_remote(rentry->namelen);
|
||||
name_end = (char *)rentry + namesize;
|
||||
if (rentry->namelen == 0 || rentry->valueblk == 0)
|
||||
if (rentry->namelen == 0)
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
if (rentry->valueblk == 0 &&
|
||||
!(ent->flags & XFS_ATTR_INCOMPLETE))
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
}
|
||||
if (name_end > buf_end)
|
||||
|
|
@ -403,6 +380,7 @@ xchk_xattr_block(
|
|||
|
||||
*last_checked = blk->blkno;
|
||||
bitmap_zero(ab->usedmap, mp->m_attr_geo->blksize);
|
||||
bitmap_zero(ab->freemap, mp->m_attr_geo->blksize);
|
||||
|
||||
/* Check all the padding. */
|
||||
if (xfs_has_crc(ds->sc->mp)) {
|
||||
|
|
@ -449,6 +427,9 @@ xchk_xattr_block(
|
|||
if ((char *)&entries[leafhdr.count] > (char *)leaf + leafhdr.firstused)
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
|
||||
if (ds->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
|
||||
goto out;
|
||||
|
||||
buf_end = (char *)bp->b_addr + mp->m_attr_geo->blksize;
|
||||
for (i = 0, ent = entries; i < leafhdr.count; ent++, i++) {
|
||||
/* Mark the leaf entry itself. */
|
||||
|
|
@ -467,7 +448,29 @@ xchk_xattr_block(
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (!xchk_xattr_check_freemap(ds->sc, &leafhdr))
|
||||
/* Construct bitmap of freemap contents. */
|
||||
for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; i++) {
|
||||
if (!xchk_xattr_set_map(ds->sc, ab->freemap,
|
||||
leafhdr.freemap[i].base,
|
||||
leafhdr.freemap[i].size))
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
|
||||
/*
|
||||
* freemap entries with zero length and nonzero base can cause
|
||||
* problems with older kernels, so we mark these for preening
|
||||
* even though there's no inconsistency.
|
||||
*/
|
||||
if (leafhdr.freemap[i].size == 0 &&
|
||||
leafhdr.freemap[i].base > 0)
|
||||
xchk_da_set_preen(ds, level);
|
||||
|
||||
if (ds->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Look for bits that are set in freemap and are marked in use. */
|
||||
if (bitmap_intersects(ab->freemap, ab->usedmap,
|
||||
mp->m_attr_geo->blksize))
|
||||
xchk_da_set_corrupt(ds, level);
|
||||
|
||||
if (leafhdr.usedbytes != usedbytes)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2018-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -1516,8 +1516,10 @@ xrep_xattr_teardown(
|
|||
xfblob_destroy(rx->pptr_names);
|
||||
if (rx->pptr_recs)
|
||||
xfarray_destroy(rx->pptr_recs);
|
||||
xfblob_destroy(rx->xattr_blobs);
|
||||
xfarray_destroy(rx->xattr_records);
|
||||
if (rx->xattr_blobs)
|
||||
xfblob_destroy(rx->xattr_blobs);
|
||||
if (rx->xattr_records)
|
||||
xfarray_destroy(rx->xattr_records);
|
||||
mutex_destroy(&rx->lock);
|
||||
kfree(rx);
|
||||
}
|
||||
|
|
@ -1529,7 +1531,6 @@ xrep_xattr_setup_scan(
|
|||
struct xrep_xattr **rxp)
|
||||
{
|
||||
struct xrep_xattr *rx;
|
||||
char *descr;
|
||||
int max_len;
|
||||
int error;
|
||||
|
||||
|
|
@ -1555,35 +1556,26 @@ xrep_xattr_setup_scan(
|
|||
goto out_rx;
|
||||
|
||||
/* Set up some staging for salvaged attribute keys and values */
|
||||
descr = xchk_xfile_ino_descr(sc, "xattr keys");
|
||||
error = xfarray_create(descr, 0, sizeof(struct xrep_xattr_key),
|
||||
error = xfarray_create("xattr keys", 0, sizeof(struct xrep_xattr_key),
|
||||
&rx->xattr_records);
|
||||
kfree(descr);
|
||||
if (error)
|
||||
goto out_rx;
|
||||
|
||||
descr = xchk_xfile_ino_descr(sc, "xattr names");
|
||||
error = xfblob_create(descr, &rx->xattr_blobs);
|
||||
kfree(descr);
|
||||
error = xfblob_create("xattr names", &rx->xattr_blobs);
|
||||
if (error)
|
||||
goto out_keys;
|
||||
|
||||
if (xfs_has_parent(sc->mp)) {
|
||||
ASSERT(sc->flags & XCHK_FSGATES_DIRENTS);
|
||||
|
||||
descr = xchk_xfile_ino_descr(sc,
|
||||
"xattr retained parent pointer entries");
|
||||
error = xfarray_create(descr, 0,
|
||||
error = xfarray_create("xattr parent pointer entries", 0,
|
||||
sizeof(struct xrep_xattr_pptr),
|
||||
&rx->pptr_recs);
|
||||
kfree(descr);
|
||||
if (error)
|
||||
goto out_values;
|
||||
|
||||
descr = xchk_xfile_ino_descr(sc,
|
||||
"xattr retained parent pointer names");
|
||||
error = xfblob_create(descr, &rx->pptr_names);
|
||||
kfree(descr);
|
||||
error = xfblob_create("xattr parent pointer names",
|
||||
&rx->pptr_names);
|
||||
if (error)
|
||||
goto out_pprecs;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2018-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_bit.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2018-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -923,7 +923,6 @@ xrep_bmap(
|
|||
bool allow_unwritten)
|
||||
{
|
||||
struct xrep_bmap *rb;
|
||||
char *descr;
|
||||
xfs_extnum_t max_bmbt_recs;
|
||||
bool large_extcount;
|
||||
int error = 0;
|
||||
|
|
@ -945,11 +944,8 @@ xrep_bmap(
|
|||
/* Set up enough storage to handle the max records for this fork. */
|
||||
large_extcount = xfs_has_large_extent_counts(sc->mp);
|
||||
max_bmbt_recs = xfs_iext_max_nextents(large_extcount, whichfork);
|
||||
descr = xchk_xfile_ino_descr(sc, "%s fork mapping records",
|
||||
whichfork == XFS_DATA_FORK ? "data" : "attr");
|
||||
error = xfarray_create(descr, max_bmbt_recs,
|
||||
error = xfarray_create("fork mapping records", max_bmbt_recs,
|
||||
sizeof(struct xfs_bmbt_rec), &rb->bmap_records);
|
||||
kfree(descr);
|
||||
if (error)
|
||||
goto out_rb;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -42,6 +42,8 @@ __xchk_btree_process_error(
|
|||
break;
|
||||
case -EFSBADCRC:
|
||||
case -EFSCORRUPTED:
|
||||
case -EIO:
|
||||
case -ENODATA:
|
||||
/* Note the badness but don't abort. */
|
||||
sc->sm->sm_flags |= errflag;
|
||||
*error = 0;
|
||||
|
|
@ -370,12 +372,15 @@ xchk_btree_check_block_owner(
|
|||
{
|
||||
xfs_agnumber_t agno;
|
||||
xfs_agblock_t agbno;
|
||||
bool is_bnobt, is_rmapbt;
|
||||
bool init_sa;
|
||||
int error = 0;
|
||||
|
||||
if (!bs->cur)
|
||||
return 0;
|
||||
|
||||
is_bnobt = xfs_btree_is_bno(bs->cur->bc_ops);
|
||||
is_rmapbt = xfs_btree_is_rmap(bs->cur->bc_ops);
|
||||
agno = xfs_daddr_to_agno(bs->cur->bc_mp, daddr);
|
||||
agbno = xfs_daddr_to_agbno(bs->cur->bc_mp, daddr);
|
||||
|
||||
|
|
@ -398,11 +403,11 @@ xchk_btree_check_block_owner(
|
|||
* have to nullify it (to shut down further block owner checks) if
|
||||
* self-xref encounters problems.
|
||||
*/
|
||||
if (!bs->sc->sa.bno_cur && xfs_btree_is_bno(bs->cur->bc_ops))
|
||||
if (!bs->sc->sa.bno_cur && is_bnobt)
|
||||
bs->cur = NULL;
|
||||
|
||||
xchk_xref_is_only_owned_by(bs->sc, agbno, 1, bs->oinfo);
|
||||
if (!bs->sc->sa.rmap_cur && xfs_btree_is_rmap(bs->cur->bc_ops))
|
||||
if (!bs->sc->sa.rmap_cur && is_rmapbt)
|
||||
bs->cur = NULL;
|
||||
|
||||
out_free:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -103,6 +103,8 @@ __xchk_process_error(
|
|||
break;
|
||||
case -EFSBADCRC:
|
||||
case -EFSCORRUPTED:
|
||||
case -EIO:
|
||||
case -ENODATA:
|
||||
/* Note the badness but don't abort. */
|
||||
sc->sm->sm_flags |= errflag;
|
||||
*error = 0;
|
||||
|
|
@ -177,6 +179,8 @@ __xchk_fblock_process_error(
|
|||
break;
|
||||
case -EFSBADCRC:
|
||||
case -EFSCORRUPTED:
|
||||
case -EIO:
|
||||
case -ENODATA:
|
||||
/* Note the badness but don't abort. */
|
||||
sc->sm->sm_flags |= errflag;
|
||||
*error = 0;
|
||||
|
|
@ -1395,6 +1399,9 @@ xchk_metadata_inode_subtype(
|
|||
int error;
|
||||
|
||||
sub = xchk_scrub_create_subord(sc, scrub_type);
|
||||
if (!sub)
|
||||
return -ENOMEM;
|
||||
|
||||
error = sub->sc.ops->scrub(&sub->sc);
|
||||
xchk_scrub_free_subord(sub);
|
||||
return error;
|
||||
|
|
|
|||
|
|
@ -246,31 +246,6 @@ static inline bool xchk_could_repair(const struct xfs_scrub *sc)
|
|||
|
||||
int xchk_metadata_inode_forks(struct xfs_scrub *sc);
|
||||
|
||||
/*
|
||||
* Helper macros to allocate and format xfile description strings.
|
||||
* Callers must kfree the pointer returned.
|
||||
*/
|
||||
#define xchk_xfile_descr(sc, fmt, ...) \
|
||||
kasprintf(XCHK_GFP_FLAGS, "XFS (%s): " fmt, \
|
||||
(sc)->mp->m_super->s_id, ##__VA_ARGS__)
|
||||
#define xchk_xfile_ag_descr(sc, fmt, ...) \
|
||||
kasprintf(XCHK_GFP_FLAGS, "XFS (%s): AG 0x%x " fmt, \
|
||||
(sc)->mp->m_super->s_id, \
|
||||
(sc)->sa.pag ? \
|
||||
pag_agno((sc)->sa.pag) : (sc)->sm->sm_agno, \
|
||||
##__VA_ARGS__)
|
||||
#define xchk_xfile_ino_descr(sc, fmt, ...) \
|
||||
kasprintf(XCHK_GFP_FLAGS, "XFS (%s): inode 0x%llx " fmt, \
|
||||
(sc)->mp->m_super->s_id, \
|
||||
(sc)->ip ? (sc)->ip->i_ino : (sc)->sm->sm_ino, \
|
||||
##__VA_ARGS__)
|
||||
#define xchk_xfile_rtgroup_descr(sc, fmt, ...) \
|
||||
kasprintf(XCHK_GFP_FLAGS, "XFS (%s): rtgroup 0x%x " fmt, \
|
||||
(sc)->mp->m_super->s_id, \
|
||||
(sc)->sa.pag ? \
|
||||
rtg_rgno((sc)->sr.rtg) : (sc)->sm->sm_agno, \
|
||||
##__VA_ARGS__)
|
||||
|
||||
/*
|
||||
* Setting up a hook to wait for intents to drain is costly -- we have to take
|
||||
* the CPU hotplug lock and force an i-cache flush on all CPUs once to set it
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2022-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -45,6 +45,8 @@ xchk_da_process_error(
|
|||
break;
|
||||
case -EFSBADCRC:
|
||||
case -EFSCORRUPTED:
|
||||
case -EIO:
|
||||
case -ENODATA:
|
||||
/* Note the badness but don't abort. */
|
||||
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
|
||||
*error = 0;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -1102,22 +1102,17 @@ xchk_directory(
|
|||
sd->xname.name = sd->namebuf;
|
||||
|
||||
if (xfs_has_parent(sc->mp)) {
|
||||
char *descr;
|
||||
|
||||
/*
|
||||
* Set up some staging memory for dirents that we can't check
|
||||
* due to locking contention.
|
||||
*/
|
||||
descr = xchk_xfile_ino_descr(sc, "slow directory entries");
|
||||
error = xfarray_create(descr, 0, sizeof(struct xchk_dirent),
|
||||
&sd->dir_entries);
|
||||
kfree(descr);
|
||||
error = xfarray_create("slow directory entries", 0,
|
||||
sizeof(struct xchk_dirent), &sd->dir_entries);
|
||||
if (error)
|
||||
goto out_sd;
|
||||
|
||||
descr = xchk_xfile_ino_descr(sc, "slow directory entry names");
|
||||
error = xfblob_create(descr, &sd->dir_names);
|
||||
kfree(descr);
|
||||
error = xfblob_create("slow directory entry names",
|
||||
&sd->dir_names);
|
||||
if (error)
|
||||
goto out_entries;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2020-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -172,8 +172,12 @@ xrep_dir_teardown(
|
|||
struct xrep_dir *rd = sc->buf;
|
||||
|
||||
xrep_findparent_scan_teardown(&rd->pscan);
|
||||
xfblob_destroy(rd->dir_names);
|
||||
xfarray_destroy(rd->dir_entries);
|
||||
if (rd->dir_names)
|
||||
xfblob_destroy(rd->dir_names);
|
||||
rd->dir_names = NULL;
|
||||
if (rd->dir_entries)
|
||||
xfarray_destroy(rd->dir_entries);
|
||||
rd->dir_names = NULL;
|
||||
}
|
||||
|
||||
/* Set up for a directory repair. */
|
||||
|
|
@ -1784,20 +1788,15 @@ xrep_dir_setup_scan(
|
|||
struct xrep_dir *rd)
|
||||
{
|
||||
struct xfs_scrub *sc = rd->sc;
|
||||
char *descr;
|
||||
int error;
|
||||
|
||||
/* Set up some staging memory for salvaging dirents. */
|
||||
descr = xchk_xfile_ino_descr(sc, "directory entries");
|
||||
error = xfarray_create(descr, 0, sizeof(struct xrep_dirent),
|
||||
&rd->dir_entries);
|
||||
kfree(descr);
|
||||
error = xfarray_create("directory entries", 0,
|
||||
sizeof(struct xrep_dirent), &rd->dir_entries);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
descr = xchk_xfile_ino_descr(sc, "directory entry names");
|
||||
error = xfblob_create(descr, &rd->dir_names);
|
||||
kfree(descr);
|
||||
error = xfblob_create("directory entry names", &rd->dir_names);
|
||||
if (error)
|
||||
goto out_xfarray;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2023-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -81,8 +81,12 @@ xchk_dirtree_buf_cleanup(
|
|||
kfree(path);
|
||||
}
|
||||
|
||||
xfblob_destroy(dl->path_names);
|
||||
xfarray_destroy(dl->path_steps);
|
||||
if (dl->path_names)
|
||||
xfblob_destroy(dl->path_names);
|
||||
dl->path_names = NULL;
|
||||
if (dl->path_steps)
|
||||
xfarray_destroy(dl->path_steps);
|
||||
dl->path_steps = NULL;
|
||||
mutex_destroy(&dl->lock);
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +96,6 @@ xchk_setup_dirtree(
|
|||
struct xfs_scrub *sc)
|
||||
{
|
||||
struct xchk_dirtree *dl;
|
||||
char *descr;
|
||||
int error;
|
||||
|
||||
xchk_fsgates_enable(sc, XCHK_FSGATES_DIRENTS);
|
||||
|
|
@ -116,16 +119,12 @@ xchk_setup_dirtree(
|
|||
|
||||
mutex_init(&dl->lock);
|
||||
|
||||
descr = xchk_xfile_ino_descr(sc, "dirtree path steps");
|
||||
error = xfarray_create(descr, 0, sizeof(struct xchk_dirpath_step),
|
||||
&dl->path_steps);
|
||||
kfree(descr);
|
||||
error = xfarray_create("dirtree path steps", 0,
|
||||
sizeof(struct xchk_dirpath_step), &dl->path_steps);
|
||||
if (error)
|
||||
goto out_dl;
|
||||
|
||||
descr = xchk_xfile_ino_descr(sc, "dirtree path names");
|
||||
error = xfblob_create(descr, &dl->path_names);
|
||||
kfree(descr);
|
||||
error = xfblob_create("dirtree path names", &dl->path_names);
|
||||
if (error)
|
||||
goto out_steps;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2023-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_bit.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2020-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2019-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2018-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2019-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2018-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -797,7 +797,6 @@ xrep_iallocbt(
|
|||
{
|
||||
struct xrep_ibt *ri;
|
||||
struct xfs_mount *mp = sc->mp;
|
||||
char *descr;
|
||||
xfs_agino_t first_agino, last_agino;
|
||||
int error = 0;
|
||||
|
||||
|
|
@ -816,11 +815,9 @@ xrep_iallocbt(
|
|||
/* Set up enough storage to handle an AG with nothing but inodes. */
|
||||
xfs_agino_range(mp, pag_agno(sc->sa.pag), &first_agino, &last_agino);
|
||||
last_agino /= XFS_INODES_PER_CHUNK;
|
||||
descr = xchk_xfile_ag_descr(sc, "inode index records");
|
||||
error = xfarray_create(descr, last_agino,
|
||||
error = xfarray_create("inode index records", last_agino,
|
||||
sizeof(struct xfs_inobt_rec_incore),
|
||||
&ri->inode_records);
|
||||
kfree(descr);
|
||||
if (error)
|
||||
goto out_ri;
|
||||
|
||||
|
|
@ -866,10 +863,24 @@ xrep_revalidate_iallocbt(
|
|||
if (error)
|
||||
goto out;
|
||||
|
||||
if (xfs_has_finobt(sc->mp)) {
|
||||
sc->sm->sm_type = XFS_SCRUB_TYPE_FINOBT;
|
||||
error = xchk_iallocbt(sc);
|
||||
/*
|
||||
* If the inobt is still corrupt, we've failed to repair the filesystem
|
||||
* and should just bail out.
|
||||
*
|
||||
* If the inobt fails cross-examination with the finobt, the scan will
|
||||
* free the finobt cursor, so we need to mark the repair incomplete
|
||||
* and avoid walking off the end of the NULL finobt cursor.
|
||||
*/
|
||||
if (!xfs_has_finobt(sc->mp) ||
|
||||
(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
|
||||
goto out;
|
||||
|
||||
sc->sm->sm_type = XFS_SCRUB_TYPE_FINOBT;
|
||||
if (!sc->sa.fino_cur) {
|
||||
xchk_set_incomplete(sc);
|
||||
goto out;
|
||||
}
|
||||
error = xchk_iallocbt(sc);
|
||||
|
||||
out:
|
||||
sc->sm->sm_type = old_type;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2018-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2021-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2022-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2023-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2022-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2021-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -971,7 +971,8 @@ xchk_nlinks_teardown_scan(
|
|||
|
||||
xfs_dir_hook_del(xnc->sc->mp, &xnc->dhook);
|
||||
|
||||
xfarray_destroy(xnc->nlinks);
|
||||
if (xnc->nlinks)
|
||||
xfarray_destroy(xnc->nlinks);
|
||||
xnc->nlinks = NULL;
|
||||
|
||||
xchk_iscan_teardown(&xnc->collect_iscan);
|
||||
|
|
@ -990,7 +991,6 @@ xchk_nlinks_setup_scan(
|
|||
struct xchk_nlink_ctrs *xnc)
|
||||
{
|
||||
struct xfs_mount *mp = sc->mp;
|
||||
char *descr;
|
||||
unsigned long long max_inos;
|
||||
xfs_agnumber_t last_agno = mp->m_sb.sb_agcount - 1;
|
||||
xfs_agino_t first_agino, last_agino;
|
||||
|
|
@ -1007,10 +1007,9 @@ xchk_nlinks_setup_scan(
|
|||
*/
|
||||
xfs_agino_range(mp, last_agno, &first_agino, &last_agino);
|
||||
max_inos = XFS_AGINO_TO_INO(mp, last_agno, last_agino) + 1;
|
||||
descr = xchk_xfile_descr(sc, "file link counts");
|
||||
error = xfarray_create(descr, min(XFS_MAXINUMBER + 1, max_inos),
|
||||
error = xfarray_create("file link counts",
|
||||
min(XFS_MAXINUMBER + 1, max_inos),
|
||||
sizeof(struct xchk_nlink), &xnc->nlinks);
|
||||
kfree(descr);
|
||||
if (error)
|
||||
goto out_teardown;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2021-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2021-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -755,7 +755,6 @@ xchk_parent_pptr(
|
|||
struct xfs_scrub *sc)
|
||||
{
|
||||
struct xchk_pptrs *pp;
|
||||
char *descr;
|
||||
int error;
|
||||
|
||||
pp = kvzalloc(sizeof(struct xchk_pptrs), XCHK_GFP_FLAGS);
|
||||
|
|
@ -768,16 +767,12 @@ xchk_parent_pptr(
|
|||
* Set up some staging memory for parent pointers that we can't check
|
||||
* due to locking contention.
|
||||
*/
|
||||
descr = xchk_xfile_ino_descr(sc, "slow parent pointer entries");
|
||||
error = xfarray_create(descr, 0, sizeof(struct xchk_pptr),
|
||||
&pp->pptr_entries);
|
||||
kfree(descr);
|
||||
error = xfarray_create("slow parent pointer entries", 0,
|
||||
sizeof(struct xchk_pptr), &pp->pptr_entries);
|
||||
if (error)
|
||||
goto out_pp;
|
||||
|
||||
descr = xchk_xfile_ino_descr(sc, "slow parent pointer names");
|
||||
error = xfblob_create(descr, &pp->pptr_names);
|
||||
kfree(descr);
|
||||
error = xfblob_create("slow parent pointer names", &pp->pptr_names);
|
||||
if (error)
|
||||
goto out_entries;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2020-2024 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
@ -1497,7 +1497,6 @@ xrep_parent_setup_scan(
|
|||
struct xrep_parent *rp)
|
||||
{
|
||||
struct xfs_scrub *sc = rp->sc;
|
||||
char *descr;
|
||||
struct xfs_da_geometry *geo = sc->mp->m_attr_geo;
|
||||
int max_len;
|
||||
int error;
|
||||
|
|
@ -1525,32 +1524,22 @@ xrep_parent_setup_scan(
|
|||
goto out_xattr_name;
|
||||
|
||||
/* Set up some staging memory for logging parent pointer updates. */
|
||||
descr = xchk_xfile_ino_descr(sc, "parent pointer entries");
|
||||
error = xfarray_create(descr, 0, sizeof(struct xrep_pptr),
|
||||
&rp->pptr_recs);
|
||||
kfree(descr);
|
||||
error = xfarray_create("parent pointer entries", 0,
|
||||
sizeof(struct xrep_pptr), &rp->pptr_recs);
|
||||
if (error)
|
||||
goto out_xattr_value;
|
||||
|
||||
descr = xchk_xfile_ino_descr(sc, "parent pointer names");
|
||||
error = xfblob_create(descr, &rp->pptr_names);
|
||||
kfree(descr);
|
||||
error = xfblob_create("parent pointer names", &rp->pptr_names);
|
||||
if (error)
|
||||
goto out_recs;
|
||||
|
||||
/* Set up some storage for copying attrs before the mapping exchange */
|
||||
descr = xchk_xfile_ino_descr(sc,
|
||||
"parent pointer retained xattr entries");
|
||||
error = xfarray_create(descr, 0, sizeof(struct xrep_parent_xattr),
|
||||
&rp->xattr_records);
|
||||
kfree(descr);
|
||||
error = xfarray_create("parent pointer xattr entries", 0,
|
||||
sizeof(struct xrep_parent_xattr), &rp->xattr_records);
|
||||
if (error)
|
||||
goto out_names;
|
||||
|
||||
descr = xchk_xfile_ino_descr(sc,
|
||||
"parent pointer retained xattr values");
|
||||
error = xfblob_create(descr, &rp->xattr_blobs);
|
||||
kfree(descr);
|
||||
error = xfblob_create("parent pointer xattr values", &rp->xattr_blobs);
|
||||
if (error)
|
||||
goto out_attr_keys;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_bit.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2018-2023 Oracle. All Rights Reserved.
|
||||
* Author: Darrick J. Wong <djwong@kernel.org>
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_platform.h"
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue