mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 12:11:59 +02:00
xfs: New code for 6.17
Signed-off-by: Carlos Maiolino <cem@kernel.org>
-----BEGIN PGP SIGNATURE-----
iJUEABMJAB0WIQSmtYVZ/MfVMGUq1GNcsMJ8RxYuYwUCaIcswwAKCRBcsMJ8RxYu
Y5UqAYCWhEmZNTd0aN4kR3xqGMV+/3bubml4TXB8HvIv35gaOrFCgQkytVJLD74e
A0WtR+4BgJOIKmYfz4AAx6vbsoMWevya1f879i7NI7SYuI0/oB1klRtApZF0Slwv
OKJsN/s6Sg==
=/Q43
-----END PGP SIGNATURE-----
Merge tag 'xfs-merge-6.17' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs updates from Carlos Maiolino:
"This doesn't contain any new features. It mostly is a collection of
clean ups and code refactoring that I preferred to postpone to the
merge window.
It includes removal of several unused tracepoints, refactoring key
comparing routines under the B-Trees management and cleanup of xfs
journaling code"
* tag 'xfs-merge-6.17' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (44 commits)
xfs: don't use a xfs_log_iovec for ri_buf in log recovery
xfs: don't use a xfs_log_iovec for attr_item names and values
xfs: use better names for size members in xfs_log_vec
xfs: cleanup the ordered item logic in xlog_cil_insert_format_items
xfs: don't pass the old lv to xfs_cil_prepare_item
xfs: remove unused trace event xfs_reflink_cow_enospc
xfs: remove unused trace event xfs_discard_rtrelax
xfs: remove unused trace event xfs_log_cil_return
xfs: remove unused trace event xfs_dqreclaim_dirty
fs/xfs: replace strncpy with memtostr_pad()
xfs: Remove unused label in xfs_dax_notify_dev_failure
xfs: improve the comments in xfs_select_zone_nowait
xfs: improve the comments in xfs_max_open_zones
xfs: stop passing an inode to the zone space reservation helpers
xfs: rename oz_write_pointer to oz_allocated
xfs: use a uint32_t to cache i_used_blocks in xfs_init_zone
xfs: improve the xg_active_ref check in xfs_group_free
xfs: remove the xlog_ticket_t typedef
xfs: remove xrep_trans_{alloc,cancel}_hook_dummy
xfs: return the allocated transaction from xchk_trans_alloc_empty
...
This commit is contained in:
commit
f3f5edc5e4
|
|
@ -186,35 +186,32 @@ xfs_allocbt_init_ptr_from_cur(
|
|||
ptr->s = agf->agf_cnt_root;
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_bnobt_key_diff(
|
||||
STATIC int
|
||||
xfs_bnobt_cmp_key_with_cur(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key)
|
||||
{
|
||||
struct xfs_alloc_rec_incore *rec = &cur->bc_rec.a;
|
||||
const struct xfs_alloc_rec *kp = &key->alloc;
|
||||
|
||||
return (int64_t)be32_to_cpu(kp->ar_startblock) - rec->ar_startblock;
|
||||
return cmp_int(be32_to_cpu(kp->ar_startblock),
|
||||
rec->ar_startblock);
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_cntbt_key_diff(
|
||||
STATIC int
|
||||
xfs_cntbt_cmp_key_with_cur(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key)
|
||||
{
|
||||
struct xfs_alloc_rec_incore *rec = &cur->bc_rec.a;
|
||||
const struct xfs_alloc_rec *kp = &key->alloc;
|
||||
int64_t diff;
|
||||
|
||||
diff = (int64_t)be32_to_cpu(kp->ar_blockcount) - rec->ar_blockcount;
|
||||
if (diff)
|
||||
return diff;
|
||||
|
||||
return (int64_t)be32_to_cpu(kp->ar_startblock) - rec->ar_startblock;
|
||||
return cmp_int(be32_to_cpu(kp->ar_blockcount), rec->ar_blockcount) ?:
|
||||
cmp_int(be32_to_cpu(kp->ar_startblock), rec->ar_startblock);
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_bnobt_diff_two_keys(
|
||||
STATIC int
|
||||
xfs_bnobt_cmp_two_keys(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *k1,
|
||||
const union xfs_btree_key *k2,
|
||||
|
|
@ -222,29 +219,24 @@ xfs_bnobt_diff_two_keys(
|
|||
{
|
||||
ASSERT(!mask || mask->alloc.ar_startblock);
|
||||
|
||||
return (int64_t)be32_to_cpu(k1->alloc.ar_startblock) -
|
||||
be32_to_cpu(k2->alloc.ar_startblock);
|
||||
return cmp_int(be32_to_cpu(k1->alloc.ar_startblock),
|
||||
be32_to_cpu(k2->alloc.ar_startblock));
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_cntbt_diff_two_keys(
|
||||
STATIC int
|
||||
xfs_cntbt_cmp_two_keys(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *k1,
|
||||
const union xfs_btree_key *k2,
|
||||
const union xfs_btree_key *mask)
|
||||
{
|
||||
int64_t diff;
|
||||
|
||||
ASSERT(!mask || (mask->alloc.ar_blockcount &&
|
||||
mask->alloc.ar_startblock));
|
||||
|
||||
diff = be32_to_cpu(k1->alloc.ar_blockcount) -
|
||||
be32_to_cpu(k2->alloc.ar_blockcount);
|
||||
if (diff)
|
||||
return diff;
|
||||
|
||||
return be32_to_cpu(k1->alloc.ar_startblock) -
|
||||
be32_to_cpu(k2->alloc.ar_startblock);
|
||||
return cmp_int(be32_to_cpu(k1->alloc.ar_blockcount),
|
||||
be32_to_cpu(k2->alloc.ar_blockcount)) ?:
|
||||
cmp_int(be32_to_cpu(k1->alloc.ar_startblock),
|
||||
be32_to_cpu(k2->alloc.ar_startblock));
|
||||
}
|
||||
|
||||
static xfs_failaddr_t
|
||||
|
|
@ -438,9 +430,9 @@ const struct xfs_btree_ops xfs_bnobt_ops = {
|
|||
.init_high_key_from_rec = xfs_bnobt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_allocbt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfs_allocbt_init_ptr_from_cur,
|
||||
.key_diff = xfs_bnobt_key_diff,
|
||||
.cmp_key_with_cur = xfs_bnobt_cmp_key_with_cur,
|
||||
.buf_ops = &xfs_bnobt_buf_ops,
|
||||
.diff_two_keys = xfs_bnobt_diff_two_keys,
|
||||
.cmp_two_keys = xfs_bnobt_cmp_two_keys,
|
||||
.keys_inorder = xfs_bnobt_keys_inorder,
|
||||
.recs_inorder = xfs_bnobt_recs_inorder,
|
||||
.keys_contiguous = xfs_allocbt_keys_contiguous,
|
||||
|
|
@ -468,9 +460,9 @@ const struct xfs_btree_ops xfs_cntbt_ops = {
|
|||
.init_high_key_from_rec = xfs_cntbt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_allocbt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfs_allocbt_init_ptr_from_cur,
|
||||
.key_diff = xfs_cntbt_key_diff,
|
||||
.cmp_key_with_cur = xfs_cntbt_cmp_key_with_cur,
|
||||
.buf_ops = &xfs_cntbt_buf_ops,
|
||||
.diff_two_keys = xfs_cntbt_diff_two_keys,
|
||||
.cmp_two_keys = xfs_cntbt_cmp_two_keys,
|
||||
.keys_inorder = xfs_cntbt_keys_inorder,
|
||||
.recs_inorder = xfs_cntbt_recs_inorder,
|
||||
.keys_contiguous = NULL, /* not needed right now */
|
||||
|
|
|
|||
|
|
@ -369,38 +369,26 @@ xfs_bmbt_init_rec_from_cur(
|
|||
xfs_bmbt_disk_set_all(&rec->bmbt, &cur->bc_rec.b);
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_bmbt_key_diff(
|
||||
STATIC int
|
||||
xfs_bmbt_cmp_key_with_cur(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key)
|
||||
{
|
||||
return (int64_t)be64_to_cpu(key->bmbt.br_startoff) -
|
||||
cur->bc_rec.b.br_startoff;
|
||||
return cmp_int(be64_to_cpu(key->bmbt.br_startoff),
|
||||
cur->bc_rec.b.br_startoff);
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_bmbt_diff_two_keys(
|
||||
STATIC int
|
||||
xfs_bmbt_cmp_two_keys(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *k1,
|
||||
const union xfs_btree_key *k2,
|
||||
const union xfs_btree_key *mask)
|
||||
{
|
||||
uint64_t a = be64_to_cpu(k1->bmbt.br_startoff);
|
||||
uint64_t b = be64_to_cpu(k2->bmbt.br_startoff);
|
||||
|
||||
ASSERT(!mask || mask->bmbt.br_startoff);
|
||||
|
||||
/*
|
||||
* Note: This routine previously casted a and b to int64 and subtracted
|
||||
* them to generate a result. This lead to problems if b was the
|
||||
* "maximum" key value (all ones) being signed incorrectly, hence this
|
||||
* somewhat less efficient version.
|
||||
*/
|
||||
if (a > b)
|
||||
return 1;
|
||||
if (b > a)
|
||||
return -1;
|
||||
return 0;
|
||||
return cmp_int(be64_to_cpu(k1->bmbt.br_startoff),
|
||||
be64_to_cpu(k2->bmbt.br_startoff));
|
||||
}
|
||||
|
||||
static xfs_failaddr_t
|
||||
|
|
@ -647,8 +635,8 @@ const struct xfs_btree_ops xfs_bmbt_ops = {
|
|||
.init_key_from_rec = xfs_bmbt_init_key_from_rec,
|
||||
.init_high_key_from_rec = xfs_bmbt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_bmbt_init_rec_from_cur,
|
||||
.key_diff = xfs_bmbt_key_diff,
|
||||
.diff_two_keys = xfs_bmbt_diff_two_keys,
|
||||
.cmp_key_with_cur = xfs_bmbt_cmp_key_with_cur,
|
||||
.cmp_two_keys = xfs_bmbt_cmp_two_keys,
|
||||
.buf_ops = &xfs_bmbt_buf_ops,
|
||||
.keys_inorder = xfs_bmbt_keys_inorder,
|
||||
.recs_inorder = xfs_bmbt_recs_inorder,
|
||||
|
|
|
|||
|
|
@ -1985,7 +1985,7 @@ xfs_btree_lookup(
|
|||
int *stat) /* success/failure */
|
||||
{
|
||||
struct xfs_btree_block *block; /* current btree block */
|
||||
int64_t diff; /* difference for the current key */
|
||||
int cmp_r; /* current key comparison result */
|
||||
int error; /* error return value */
|
||||
int keyno; /* current key number */
|
||||
int level; /* level in the btree */
|
||||
|
|
@ -2013,13 +2013,13 @@ xfs_btree_lookup(
|
|||
* on the lookup record, then follow the corresponding block
|
||||
* pointer down to the next level.
|
||||
*/
|
||||
for (level = cur->bc_nlevels - 1, diff = 1; level >= 0; level--) {
|
||||
for (level = cur->bc_nlevels - 1, cmp_r = 1; level >= 0; level--) {
|
||||
/* Get the block we need to do the lookup on. */
|
||||
error = xfs_btree_lookup_get_block(cur, level, pp, &block);
|
||||
if (error)
|
||||
goto error0;
|
||||
|
||||
if (diff == 0) {
|
||||
if (cmp_r == 0) {
|
||||
/*
|
||||
* If we already had a key match at a higher level, we
|
||||
* know we need to use the first entry in this block.
|
||||
|
|
@ -2065,15 +2065,16 @@ xfs_btree_lookup(
|
|||
keyno, block, &key);
|
||||
|
||||
/*
|
||||
* Compute difference to get next direction:
|
||||
* Compute comparison result to get next
|
||||
* direction:
|
||||
* - less than, move right
|
||||
* - greater than, move left
|
||||
* - equal, we're done
|
||||
*/
|
||||
diff = cur->bc_ops->key_diff(cur, kp);
|
||||
if (diff < 0)
|
||||
cmp_r = cur->bc_ops->cmp_key_with_cur(cur, kp);
|
||||
if (cmp_r < 0)
|
||||
low = keyno + 1;
|
||||
else if (diff > 0)
|
||||
else if (cmp_r > 0)
|
||||
high = keyno - 1;
|
||||
else
|
||||
break;
|
||||
|
|
@ -2089,7 +2090,7 @@ xfs_btree_lookup(
|
|||
* If we moved left, need the previous key number,
|
||||
* unless there isn't one.
|
||||
*/
|
||||
if (diff > 0 && --keyno < 1)
|
||||
if (cmp_r > 0 && --keyno < 1)
|
||||
keyno = 1;
|
||||
pp = xfs_btree_ptr_addr(cur, keyno, block);
|
||||
|
||||
|
|
@ -2102,7 +2103,7 @@ xfs_btree_lookup(
|
|||
}
|
||||
|
||||
/* Done with the search. See if we need to adjust the results. */
|
||||
if (dir != XFS_LOOKUP_LE && diff < 0) {
|
||||
if (dir != XFS_LOOKUP_LE && cmp_r < 0) {
|
||||
keyno++;
|
||||
/*
|
||||
* If ge search and we went off the end of the block, but it's
|
||||
|
|
@ -2125,14 +2126,14 @@ xfs_btree_lookup(
|
|||
*stat = 1;
|
||||
return 0;
|
||||
}
|
||||
} else if (dir == XFS_LOOKUP_LE && diff > 0)
|
||||
} else if (dir == XFS_LOOKUP_LE && cmp_r > 0)
|
||||
keyno--;
|
||||
cur->bc_levels[0].ptr = keyno;
|
||||
|
||||
/* Return if we succeeded or not. */
|
||||
if (keyno == 0 || keyno > xfs_btree_get_numrecs(block))
|
||||
*stat = 0;
|
||||
else if (dir != XFS_LOOKUP_EQ || diff == 0)
|
||||
else if (dir != XFS_LOOKUP_EQ || cmp_r == 0)
|
||||
*stat = 1;
|
||||
else
|
||||
*stat = 0;
|
||||
|
|
@ -5058,7 +5059,7 @@ xfs_btree_simple_query_range(
|
|||
int error;
|
||||
|
||||
ASSERT(cur->bc_ops->init_high_key_from_rec);
|
||||
ASSERT(cur->bc_ops->diff_two_keys);
|
||||
ASSERT(cur->bc_ops->cmp_two_keys);
|
||||
|
||||
/*
|
||||
* Find the leftmost record. The btree cursor must be set
|
||||
|
|
@ -5352,15 +5353,15 @@ xfs_btree_count_blocks(
|
|||
}
|
||||
|
||||
/* Compare two btree pointers. */
|
||||
int64_t
|
||||
xfs_btree_diff_two_ptrs(
|
||||
int
|
||||
xfs_btree_cmp_two_ptrs(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_ptr *a,
|
||||
const union xfs_btree_ptr *b)
|
||||
{
|
||||
if (cur->bc_ops->ptr_len == XFS_BTREE_LONG_PTR_LEN)
|
||||
return (int64_t)be64_to_cpu(a->l) - be64_to_cpu(b->l);
|
||||
return (int64_t)be32_to_cpu(a->s) - be32_to_cpu(b->s);
|
||||
return cmp_int(be64_to_cpu(a->l), be64_to_cpu(b->l));
|
||||
return cmp_int(be32_to_cpu(a->s), be32_to_cpu(b->s));
|
||||
}
|
||||
|
||||
struct xfs_btree_has_records {
|
||||
|
|
|
|||
|
|
@ -171,20 +171,23 @@ struct xfs_btree_ops {
|
|||
void (*init_high_key_from_rec)(union xfs_btree_key *key,
|
||||
const union xfs_btree_rec *rec);
|
||||
|
||||
/* difference between key value and cursor value */
|
||||
int64_t (*key_diff)(struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key);
|
||||
/*
|
||||
* Compare key value and cursor value -- positive if key > cur,
|
||||
* negative if key < cur, and zero if equal.
|
||||
*/
|
||||
int (*cmp_key_with_cur)(struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key);
|
||||
|
||||
/*
|
||||
* Difference between key2 and key1 -- positive if key1 > key2,
|
||||
* negative if key1 < key2, and zero if equal. If the @mask parameter
|
||||
* is non NULL, each key field to be used in the comparison must
|
||||
* contain a nonzero value.
|
||||
* Compare key1 and key2 -- positive if key1 > key2, negative if
|
||||
* key1 < key2, and zero if equal. If the @mask parameter is non NULL,
|
||||
* each key field to be used in the comparison must contain a nonzero
|
||||
* value.
|
||||
*/
|
||||
int64_t (*diff_two_keys)(struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key1,
|
||||
const union xfs_btree_key *key2,
|
||||
const union xfs_btree_key *mask);
|
||||
int (*cmp_two_keys)(struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key1,
|
||||
const union xfs_btree_key *key2,
|
||||
const union xfs_btree_key *mask);
|
||||
|
||||
const struct xfs_buf_ops *buf_ops;
|
||||
|
||||
|
|
@ -516,9 +519,9 @@ struct xfs_btree_block *xfs_btree_get_block(struct xfs_btree_cur *cur,
|
|||
int level, struct xfs_buf **bpp);
|
||||
bool xfs_btree_ptr_is_null(struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_ptr *ptr);
|
||||
int64_t xfs_btree_diff_two_ptrs(struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_ptr *a,
|
||||
const union xfs_btree_ptr *b);
|
||||
int xfs_btree_cmp_two_ptrs(struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_ptr *a,
|
||||
const union xfs_btree_ptr *b);
|
||||
void xfs_btree_get_sibling(struct xfs_btree_cur *cur,
|
||||
struct xfs_btree_block *block,
|
||||
union xfs_btree_ptr *ptr, int lr);
|
||||
|
|
@ -546,7 +549,7 @@ xfs_btree_keycmp_lt(
|
|||
const union xfs_btree_key *key1,
|
||||
const union xfs_btree_key *key2)
|
||||
{
|
||||
return cur->bc_ops->diff_two_keys(cur, key1, key2, NULL) < 0;
|
||||
return cur->bc_ops->cmp_two_keys(cur, key1, key2, NULL) < 0;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
@ -555,7 +558,7 @@ xfs_btree_keycmp_gt(
|
|||
const union xfs_btree_key *key1,
|
||||
const union xfs_btree_key *key2)
|
||||
{
|
||||
return cur->bc_ops->diff_two_keys(cur, key1, key2, NULL) > 0;
|
||||
return cur->bc_ops->cmp_two_keys(cur, key1, key2, NULL) > 0;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
@ -564,7 +567,7 @@ xfs_btree_keycmp_eq(
|
|||
const union xfs_btree_key *key1,
|
||||
const union xfs_btree_key *key2)
|
||||
{
|
||||
return cur->bc_ops->diff_two_keys(cur, key1, key2, NULL) == 0;
|
||||
return cur->bc_ops->cmp_two_keys(cur, key1, key2, NULL) == 0;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
@ -602,7 +605,7 @@ xfs_btree_masked_keycmp_lt(
|
|||
const union xfs_btree_key *key2,
|
||||
const union xfs_btree_key *mask)
|
||||
{
|
||||
return cur->bc_ops->diff_two_keys(cur, key1, key2, mask) < 0;
|
||||
return cur->bc_ops->cmp_two_keys(cur, key1, key2, mask) < 0;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
@ -612,7 +615,7 @@ xfs_btree_masked_keycmp_gt(
|
|||
const union xfs_btree_key *key2,
|
||||
const union xfs_btree_key *mask)
|
||||
{
|
||||
return cur->bc_ops->diff_two_keys(cur, key1, key2, mask) > 0;
|
||||
return cur->bc_ops->cmp_two_keys(cur, key1, key2, mask) > 0;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ typedef struct xfs_sb {
|
|||
uint16_t sb_sectsize; /* volume sector size, bytes */
|
||||
uint16_t sb_inodesize; /* inode size, bytes */
|
||||
uint16_t sb_inopblock; /* inodes per block */
|
||||
char sb_fname[XFSLABEL_MAX]; /* file system name */
|
||||
char sb_fname[XFSLABEL_MAX] __nonstring; /* file system name */
|
||||
uint8_t sb_blocklog; /* log2 of sb_blocksize */
|
||||
uint8_t sb_sectlog; /* log2 of sb_sectsize */
|
||||
uint8_t sb_inodelog; /* log2 of sb_inodesize */
|
||||
|
|
|
|||
|
|
@ -172,7 +172,8 @@ xfs_group_free(
|
|||
|
||||
/* drop the mount's active reference */
|
||||
xfs_group_rele(xg);
|
||||
XFS_IS_CORRUPT(mp, atomic_read(&xg->xg_active_ref) != 0);
|
||||
XFS_IS_CORRUPT(mp, atomic_read(&xg->xg_active_ref) > 0);
|
||||
XFS_IS_CORRUPT(mp, atomic_read(&xg->xg_active_ref) < 0);
|
||||
kfree_rcu_mightsleep(xg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -265,17 +265,17 @@ xfs_finobt_init_ptr_from_cur(
|
|||
ptr->s = agi->agi_free_root;
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_inobt_key_diff(
|
||||
STATIC int
|
||||
xfs_inobt_cmp_key_with_cur(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key)
|
||||
{
|
||||
return (int64_t)be32_to_cpu(key->inobt.ir_startino) -
|
||||
cur->bc_rec.i.ir_startino;
|
||||
return cmp_int(be32_to_cpu(key->inobt.ir_startino),
|
||||
cur->bc_rec.i.ir_startino);
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_inobt_diff_two_keys(
|
||||
STATIC int
|
||||
xfs_inobt_cmp_two_keys(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *k1,
|
||||
const union xfs_btree_key *k2,
|
||||
|
|
@ -283,8 +283,8 @@ xfs_inobt_diff_two_keys(
|
|||
{
|
||||
ASSERT(!mask || mask->inobt.ir_startino);
|
||||
|
||||
return (int64_t)be32_to_cpu(k1->inobt.ir_startino) -
|
||||
be32_to_cpu(k2->inobt.ir_startino);
|
||||
return cmp_int(be32_to_cpu(k1->inobt.ir_startino),
|
||||
be32_to_cpu(k2->inobt.ir_startino));
|
||||
}
|
||||
|
||||
static xfs_failaddr_t
|
||||
|
|
@ -430,9 +430,9 @@ const struct xfs_btree_ops xfs_inobt_ops = {
|
|||
.init_high_key_from_rec = xfs_inobt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_inobt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfs_inobt_init_ptr_from_cur,
|
||||
.key_diff = xfs_inobt_key_diff,
|
||||
.cmp_key_with_cur = xfs_inobt_cmp_key_with_cur,
|
||||
.buf_ops = &xfs_inobt_buf_ops,
|
||||
.diff_two_keys = xfs_inobt_diff_two_keys,
|
||||
.cmp_two_keys = xfs_inobt_cmp_two_keys,
|
||||
.keys_inorder = xfs_inobt_keys_inorder,
|
||||
.recs_inorder = xfs_inobt_recs_inorder,
|
||||
.keys_contiguous = xfs_inobt_keys_contiguous,
|
||||
|
|
@ -460,9 +460,9 @@ const struct xfs_btree_ops xfs_finobt_ops = {
|
|||
.init_high_key_from_rec = xfs_inobt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_inobt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfs_finobt_init_ptr_from_cur,
|
||||
.key_diff = xfs_inobt_key_diff,
|
||||
.cmp_key_with_cur = xfs_inobt_cmp_key_with_cur,
|
||||
.buf_ops = &xfs_finobt_buf_ops,
|
||||
.diff_two_keys = xfs_inobt_diff_two_keys,
|
||||
.cmp_two_keys = xfs_inobt_cmp_two_keys,
|
||||
.keys_inorder = xfs_inobt_keys_inorder,
|
||||
.recs_inorder = xfs_inobt_recs_inorder,
|
||||
.keys_contiguous = xfs_inobt_keys_contiguous,
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ struct xlog_recover_item {
|
|||
struct list_head ri_list;
|
||||
int ri_cnt; /* count of regions found */
|
||||
int ri_total; /* total regions */
|
||||
struct xfs_log_iovec *ri_buf; /* ptr to regions buffer */
|
||||
struct kvec *ri_buf; /* ptr to regions buffer */
|
||||
const struct xlog_recover_item_ops *ri_ops;
|
||||
};
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ struct xlog_recover {
|
|||
struct list_head r_itemq; /* q for items */
|
||||
};
|
||||
|
||||
#define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].i_addr)
|
||||
#define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].iov_base)
|
||||
|
||||
#define XLOG_RECOVER_CRCPASS 0
|
||||
#define XLOG_RECOVER_PASS1 1
|
||||
|
|
|
|||
|
|
@ -2099,9 +2099,7 @@ xfs_refcount_recover_cow_leftovers(
|
|||
* recording the CoW debris we cancel the (empty) transaction
|
||||
* and everything goes away cleanly.
|
||||
*/
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
|
||||
if (isrt) {
|
||||
xfs_rtgroup_lock(to_rtg(xg), XFS_RTGLOCK_REFCOUNT);
|
||||
|
|
|
|||
|
|
@ -174,8 +174,8 @@ xfs_refcountbt_init_ptr_from_cur(
|
|||
ptr->s = agf->agf_refcount_root;
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_refcountbt_key_diff(
|
||||
STATIC int
|
||||
xfs_refcountbt_cmp_key_with_cur(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key)
|
||||
{
|
||||
|
|
@ -185,11 +185,11 @@ xfs_refcountbt_key_diff(
|
|||
|
||||
start = xfs_refcount_encode_startblock(irec->rc_startblock,
|
||||
irec->rc_domain);
|
||||
return (int64_t)be32_to_cpu(kp->rc_startblock) - start;
|
||||
return cmp_int(be32_to_cpu(kp->rc_startblock), start);
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_refcountbt_diff_two_keys(
|
||||
STATIC int
|
||||
xfs_refcountbt_cmp_two_keys(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *k1,
|
||||
const union xfs_btree_key *k2,
|
||||
|
|
@ -197,8 +197,8 @@ xfs_refcountbt_diff_two_keys(
|
|||
{
|
||||
ASSERT(!mask || mask->refc.rc_startblock);
|
||||
|
||||
return (int64_t)be32_to_cpu(k1->refc.rc_startblock) -
|
||||
be32_to_cpu(k2->refc.rc_startblock);
|
||||
return cmp_int(be32_to_cpu(k1->refc.rc_startblock),
|
||||
be32_to_cpu(k2->refc.rc_startblock));
|
||||
}
|
||||
|
||||
STATIC xfs_failaddr_t
|
||||
|
|
@ -339,9 +339,9 @@ const struct xfs_btree_ops xfs_refcountbt_ops = {
|
|||
.init_high_key_from_rec = xfs_refcountbt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_refcountbt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfs_refcountbt_init_ptr_from_cur,
|
||||
.key_diff = xfs_refcountbt_key_diff,
|
||||
.cmp_key_with_cur = xfs_refcountbt_cmp_key_with_cur,
|
||||
.buf_ops = &xfs_refcountbt_buf_ops,
|
||||
.diff_two_keys = xfs_refcountbt_diff_two_keys,
|
||||
.cmp_two_keys = xfs_refcountbt_cmp_two_keys,
|
||||
.keys_inorder = xfs_refcountbt_keys_inorder,
|
||||
.recs_inorder = xfs_refcountbt_recs_inorder,
|
||||
.keys_contiguous = xfs_refcountbt_keys_contiguous,
|
||||
|
|
|
|||
|
|
@ -243,38 +243,22 @@ static inline uint64_t offset_keymask(uint64_t offset)
|
|||
return offset & ~XFS_RMAP_OFF_UNWRITTEN;
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_rmapbt_key_diff(
|
||||
STATIC int
|
||||
xfs_rmapbt_cmp_key_with_cur(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key)
|
||||
{
|
||||
struct xfs_rmap_irec *rec = &cur->bc_rec.r;
|
||||
const struct xfs_rmap_key *kp = &key->rmap;
|
||||
__u64 x, y;
|
||||
int64_t d;
|
||||
|
||||
d = (int64_t)be32_to_cpu(kp->rm_startblock) - rec->rm_startblock;
|
||||
if (d)
|
||||
return d;
|
||||
|
||||
x = be64_to_cpu(kp->rm_owner);
|
||||
y = rec->rm_owner;
|
||||
if (x > y)
|
||||
return 1;
|
||||
else if (y > x)
|
||||
return -1;
|
||||
|
||||
x = offset_keymask(be64_to_cpu(kp->rm_offset));
|
||||
y = offset_keymask(xfs_rmap_irec_offset_pack(rec));
|
||||
if (x > y)
|
||||
return 1;
|
||||
else if (y > x)
|
||||
return -1;
|
||||
return 0;
|
||||
return cmp_int(be32_to_cpu(kp->rm_startblock), rec->rm_startblock) ?:
|
||||
cmp_int(be64_to_cpu(kp->rm_owner), rec->rm_owner) ?:
|
||||
cmp_int(offset_keymask(be64_to_cpu(kp->rm_offset)),
|
||||
offset_keymask(xfs_rmap_irec_offset_pack(rec)));
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_rmapbt_diff_two_keys(
|
||||
STATIC int
|
||||
xfs_rmapbt_cmp_two_keys(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *k1,
|
||||
const union xfs_btree_key *k2,
|
||||
|
|
@ -282,36 +266,31 @@ xfs_rmapbt_diff_two_keys(
|
|||
{
|
||||
const struct xfs_rmap_key *kp1 = &k1->rmap;
|
||||
const struct xfs_rmap_key *kp2 = &k2->rmap;
|
||||
int64_t d;
|
||||
__u64 x, y;
|
||||
int d;
|
||||
|
||||
/* Doesn't make sense to mask off the physical space part */
|
||||
ASSERT(!mask || mask->rmap.rm_startblock);
|
||||
|
||||
d = (int64_t)be32_to_cpu(kp1->rm_startblock) -
|
||||
be32_to_cpu(kp2->rm_startblock);
|
||||
d = cmp_int(be32_to_cpu(kp1->rm_startblock),
|
||||
be32_to_cpu(kp2->rm_startblock));
|
||||
if (d)
|
||||
return d;
|
||||
|
||||
if (!mask || mask->rmap.rm_owner) {
|
||||
x = be64_to_cpu(kp1->rm_owner);
|
||||
y = be64_to_cpu(kp2->rm_owner);
|
||||
if (x > y)
|
||||
return 1;
|
||||
else if (y > x)
|
||||
return -1;
|
||||
d = cmp_int(be64_to_cpu(kp1->rm_owner),
|
||||
be64_to_cpu(kp2->rm_owner));
|
||||
if (d)
|
||||
return d;
|
||||
}
|
||||
|
||||
if (!mask || mask->rmap.rm_offset) {
|
||||
/* Doesn't make sense to allow offset but not owner */
|
||||
ASSERT(!mask || mask->rmap.rm_owner);
|
||||
|
||||
x = offset_keymask(be64_to_cpu(kp1->rm_offset));
|
||||
y = offset_keymask(be64_to_cpu(kp2->rm_offset));
|
||||
if (x > y)
|
||||
return 1;
|
||||
else if (y > x)
|
||||
return -1;
|
||||
d = cmp_int(offset_keymask(be64_to_cpu(kp1->rm_offset)),
|
||||
offset_keymask(be64_to_cpu(kp2->rm_offset)));
|
||||
if (d)
|
||||
return d;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -515,9 +494,9 @@ const struct xfs_btree_ops xfs_rmapbt_ops = {
|
|||
.init_high_key_from_rec = xfs_rmapbt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_rmapbt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfs_rmapbt_init_ptr_from_cur,
|
||||
.key_diff = xfs_rmapbt_key_diff,
|
||||
.cmp_key_with_cur = xfs_rmapbt_cmp_key_with_cur,
|
||||
.buf_ops = &xfs_rmapbt_buf_ops,
|
||||
.diff_two_keys = xfs_rmapbt_diff_two_keys,
|
||||
.cmp_two_keys = xfs_rmapbt_cmp_two_keys,
|
||||
.keys_inorder = xfs_rmapbt_keys_inorder,
|
||||
.recs_inorder = xfs_rmapbt_recs_inorder,
|
||||
.keys_contiguous = xfs_rmapbt_keys_contiguous,
|
||||
|
|
@ -632,9 +611,9 @@ const struct xfs_btree_ops xfs_rmapbt_mem_ops = {
|
|||
.init_high_key_from_rec = xfs_rmapbt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_rmapbt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfbtree_init_ptr_from_cur,
|
||||
.key_diff = xfs_rmapbt_key_diff,
|
||||
.cmp_key_with_cur = xfs_rmapbt_cmp_key_with_cur,
|
||||
.buf_ops = &xfs_rmapbt_mem_buf_ops,
|
||||
.diff_two_keys = xfs_rmapbt_diff_two_keys,
|
||||
.cmp_two_keys = xfs_rmapbt_cmp_two_keys,
|
||||
.keys_inorder = xfs_rmapbt_keys_inorder,
|
||||
.recs_inorder = xfs_rmapbt_recs_inorder,
|
||||
.keys_contiguous = xfs_rmapbt_keys_contiguous,
|
||||
|
|
|
|||
|
|
@ -156,8 +156,8 @@ xfs_rtrefcountbt_init_ptr_from_cur(
|
|||
ptr->l = 0;
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_rtrefcountbt_key_diff(
|
||||
STATIC int
|
||||
xfs_rtrefcountbt_cmp_key_with_cur(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key)
|
||||
{
|
||||
|
|
@ -167,11 +167,11 @@ xfs_rtrefcountbt_key_diff(
|
|||
|
||||
start = xfs_refcount_encode_startblock(irec->rc_startblock,
|
||||
irec->rc_domain);
|
||||
return (int64_t)be32_to_cpu(kp->rc_startblock) - start;
|
||||
return cmp_int(be32_to_cpu(kp->rc_startblock), start);
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_rtrefcountbt_diff_two_keys(
|
||||
STATIC int
|
||||
xfs_rtrefcountbt_cmp_two_keys(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *k1,
|
||||
const union xfs_btree_key *k2,
|
||||
|
|
@ -179,8 +179,8 @@ xfs_rtrefcountbt_diff_two_keys(
|
|||
{
|
||||
ASSERT(!mask || mask->refc.rc_startblock);
|
||||
|
||||
return (int64_t)be32_to_cpu(k1->refc.rc_startblock) -
|
||||
be32_to_cpu(k2->refc.rc_startblock);
|
||||
return cmp_int(be32_to_cpu(k1->refc.rc_startblock),
|
||||
be32_to_cpu(k2->refc.rc_startblock));
|
||||
}
|
||||
|
||||
static xfs_failaddr_t
|
||||
|
|
@ -387,9 +387,9 @@ const struct xfs_btree_ops xfs_rtrefcountbt_ops = {
|
|||
.init_high_key_from_rec = xfs_rtrefcountbt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_rtrefcountbt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfs_rtrefcountbt_init_ptr_from_cur,
|
||||
.key_diff = xfs_rtrefcountbt_key_diff,
|
||||
.cmp_key_with_cur = xfs_rtrefcountbt_cmp_key_with_cur,
|
||||
.buf_ops = &xfs_rtrefcountbt_buf_ops,
|
||||
.diff_two_keys = xfs_rtrefcountbt_diff_two_keys,
|
||||
.cmp_two_keys = xfs_rtrefcountbt_cmp_two_keys,
|
||||
.keys_inorder = xfs_rtrefcountbt_keys_inorder,
|
||||
.recs_inorder = xfs_rtrefcountbt_recs_inorder,
|
||||
.keys_contiguous = xfs_rtrefcountbt_keys_contiguous,
|
||||
|
|
|
|||
|
|
@ -185,38 +185,22 @@ static inline uint64_t offset_keymask(uint64_t offset)
|
|||
return offset & ~XFS_RMAP_OFF_UNWRITTEN;
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_rtrmapbt_key_diff(
|
||||
STATIC int
|
||||
xfs_rtrmapbt_cmp_key_with_cur(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key)
|
||||
{
|
||||
struct xfs_rmap_irec *rec = &cur->bc_rec.r;
|
||||
const struct xfs_rmap_key *kp = &key->rmap;
|
||||
__u64 x, y;
|
||||
int64_t d;
|
||||
|
||||
d = (int64_t)be32_to_cpu(kp->rm_startblock) - rec->rm_startblock;
|
||||
if (d)
|
||||
return d;
|
||||
|
||||
x = be64_to_cpu(kp->rm_owner);
|
||||
y = rec->rm_owner;
|
||||
if (x > y)
|
||||
return 1;
|
||||
else if (y > x)
|
||||
return -1;
|
||||
|
||||
x = offset_keymask(be64_to_cpu(kp->rm_offset));
|
||||
y = offset_keymask(xfs_rmap_irec_offset_pack(rec));
|
||||
if (x > y)
|
||||
return 1;
|
||||
else if (y > x)
|
||||
return -1;
|
||||
return 0;
|
||||
return cmp_int(be32_to_cpu(kp->rm_startblock), rec->rm_startblock) ?:
|
||||
cmp_int(be64_to_cpu(kp->rm_owner), rec->rm_owner) ?:
|
||||
cmp_int(offset_keymask(be64_to_cpu(kp->rm_offset)),
|
||||
offset_keymask(xfs_rmap_irec_offset_pack(rec)));
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
xfs_rtrmapbt_diff_two_keys(
|
||||
STATIC int
|
||||
xfs_rtrmapbt_cmp_two_keys(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *k1,
|
||||
const union xfs_btree_key *k2,
|
||||
|
|
@ -224,36 +208,31 @@ xfs_rtrmapbt_diff_two_keys(
|
|||
{
|
||||
const struct xfs_rmap_key *kp1 = &k1->rmap;
|
||||
const struct xfs_rmap_key *kp2 = &k2->rmap;
|
||||
int64_t d;
|
||||
__u64 x, y;
|
||||
int d;
|
||||
|
||||
/* Doesn't make sense to mask off the physical space part */
|
||||
ASSERT(!mask || mask->rmap.rm_startblock);
|
||||
|
||||
d = (int64_t)be32_to_cpu(kp1->rm_startblock) -
|
||||
be32_to_cpu(kp2->rm_startblock);
|
||||
d = cmp_int(be32_to_cpu(kp1->rm_startblock),
|
||||
be32_to_cpu(kp2->rm_startblock));
|
||||
if (d)
|
||||
return d;
|
||||
|
||||
if (!mask || mask->rmap.rm_owner) {
|
||||
x = be64_to_cpu(kp1->rm_owner);
|
||||
y = be64_to_cpu(kp2->rm_owner);
|
||||
if (x > y)
|
||||
return 1;
|
||||
else if (y > x)
|
||||
return -1;
|
||||
d = cmp_int(be64_to_cpu(kp1->rm_owner),
|
||||
be64_to_cpu(kp2->rm_owner));
|
||||
if (d)
|
||||
return d;
|
||||
}
|
||||
|
||||
if (!mask || mask->rmap.rm_offset) {
|
||||
/* Doesn't make sense to allow offset but not owner */
|
||||
ASSERT(!mask || mask->rmap.rm_owner);
|
||||
|
||||
x = offset_keymask(be64_to_cpu(kp1->rm_offset));
|
||||
y = offset_keymask(be64_to_cpu(kp2->rm_offset));
|
||||
if (x > y)
|
||||
return 1;
|
||||
else if (y > x)
|
||||
return -1;
|
||||
d = cmp_int(offset_keymask(be64_to_cpu(kp1->rm_offset)),
|
||||
offset_keymask(be64_to_cpu(kp2->rm_offset)));
|
||||
if (d)
|
||||
return d;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -511,9 +490,9 @@ const struct xfs_btree_ops xfs_rtrmapbt_ops = {
|
|||
.init_high_key_from_rec = xfs_rtrmapbt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_rtrmapbt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfs_rtrmapbt_init_ptr_from_cur,
|
||||
.key_diff = xfs_rtrmapbt_key_diff,
|
||||
.cmp_key_with_cur = xfs_rtrmapbt_cmp_key_with_cur,
|
||||
.buf_ops = &xfs_rtrmapbt_buf_ops,
|
||||
.diff_two_keys = xfs_rtrmapbt_diff_two_keys,
|
||||
.cmp_two_keys = xfs_rtrmapbt_cmp_two_keys,
|
||||
.keys_inorder = xfs_rtrmapbt_keys_inorder,
|
||||
.recs_inorder = xfs_rtrmapbt_recs_inorder,
|
||||
.keys_contiguous = xfs_rtrmapbt_keys_contiguous,
|
||||
|
|
@ -620,9 +599,9 @@ const struct xfs_btree_ops xfs_rtrmapbt_mem_ops = {
|
|||
.init_high_key_from_rec = xfs_rtrmapbt_init_high_key_from_rec,
|
||||
.init_rec_from_cur = xfs_rtrmapbt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfbtree_init_ptr_from_cur,
|
||||
.key_diff = xfs_rtrmapbt_key_diff,
|
||||
.cmp_key_with_cur = xfs_rtrmapbt_cmp_key_with_cur,
|
||||
.buf_ops = &xfs_rtrmapbt_mem_buf_ops,
|
||||
.diff_two_keys = xfs_rtrmapbt_diff_two_keys,
|
||||
.cmp_two_keys = xfs_rtrmapbt_cmp_two_keys,
|
||||
.keys_inorder = xfs_rtrmapbt_keys_inorder,
|
||||
.recs_inorder = xfs_rtrmapbt_recs_inorder,
|
||||
.keys_contiguous = xfs_rtrmapbt_keys_contiguous,
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ xchk_btree_block_check_sibling(
|
|||
if (pbp)
|
||||
xchk_buffer_recheck(bs->sc, pbp);
|
||||
|
||||
if (xfs_btree_diff_two_ptrs(cur, pp, sibling))
|
||||
if (xfs_btree_cmp_two_ptrs(cur, pp, sibling))
|
||||
xchk_btree_set_corrupt(bs->sc, cur, level);
|
||||
out:
|
||||
xfs_btree_del_cursor(ncur, XFS_BTREE_ERROR);
|
||||
|
|
|
|||
|
|
@ -866,11 +866,11 @@ xchk_trans_cancel(
|
|||
sc->tp = NULL;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
xchk_trans_alloc_empty(
|
||||
struct xfs_scrub *sc)
|
||||
{
|
||||
return xfs_trans_alloc_empty(sc->mp, &sc->tp);
|
||||
sc->tp = xfs_trans_alloc_empty(sc->mp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -892,7 +892,8 @@ xchk_trans_alloc(
|
|||
return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate,
|
||||
resblks, 0, 0, &sc->tp);
|
||||
|
||||
return xchk_trans_alloc_empty(sc);
|
||||
xchk_trans_alloc_empty(sc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set us up with a transaction and an empty context. */
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#define __XFS_SCRUB_COMMON_H__
|
||||
|
||||
int xchk_trans_alloc(struct xfs_scrub *sc, uint resblks);
|
||||
int xchk_trans_alloc_empty(struct xfs_scrub *sc);
|
||||
void xchk_trans_alloc_empty(struct xfs_scrub *sc);
|
||||
void xchk_trans_cancel(struct xfs_scrub *sc);
|
||||
|
||||
bool xchk_process_error(struct xfs_scrub *sc, xfs_agnumber_t agno,
|
||||
|
|
|
|||
|
|
@ -1289,9 +1289,7 @@ xrep_dir_scan_dirtree(
|
|||
if (sc->ilock_flags & (XFS_ILOCK_SHARED | XFS_ILOCK_EXCL))
|
||||
xchk_iunlock(sc, sc->ilock_flags & (XFS_ILOCK_SHARED |
|
||||
XFS_ILOCK_EXCL));
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
return error;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
|
||||
while ((error = xchk_iscan_iter(&rd->pscan.iscan, &ip)) == 1) {
|
||||
bool flush;
|
||||
|
|
@ -1317,9 +1315,7 @@ xrep_dir_scan_dirtree(
|
|||
if (error)
|
||||
break;
|
||||
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
break;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
}
|
||||
|
||||
if (xchk_should_terminate(sc, &error))
|
||||
|
|
|
|||
|
|
@ -237,7 +237,8 @@ xchk_setup_fscounters(
|
|||
return error;
|
||||
}
|
||||
|
||||
return xchk_trans_alloc_empty(sc);
|
||||
xchk_trans_alloc_empty(sc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -318,9 +318,7 @@ xchk_metapath(
|
|||
return 0;
|
||||
}
|
||||
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
return error;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
|
||||
error = xchk_metapath_ilock_both(mpath);
|
||||
if (error)
|
||||
|
|
|
|||
|
|
@ -555,9 +555,7 @@ xchk_nlinks_collect(
|
|||
* do not take sb_internal.
|
||||
*/
|
||||
xchk_trans_cancel(sc);
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
return error;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
|
||||
while ((error = xchk_iscan_iter(&xnc->collect_iscan, &ip)) == 1) {
|
||||
if (S_ISDIR(VFS_I(ip)->i_mode))
|
||||
|
|
@ -880,9 +878,7 @@ xchk_nlinks_compare(
|
|||
* inactivation workqueue.
|
||||
*/
|
||||
xchk_trans_cancel(sc);
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
return error;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
|
||||
/*
|
||||
* Use the inobt to walk all allocated inodes to compare the link
|
||||
|
|
|
|||
|
|
@ -340,9 +340,7 @@ xrep_nlinks(
|
|||
* We can only push the inactivation workqueues with an empty
|
||||
* transaction.
|
||||
*/
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
break;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
}
|
||||
xchk_iscan_iter_finish(&xnc->compare_iscan);
|
||||
xchk_iscan_teardown(&xnc->compare_iscan);
|
||||
|
|
|
|||
|
|
@ -569,9 +569,7 @@ xrep_parent_scan_dirtree(
|
|||
if (sc->ilock_flags & (XFS_ILOCK_SHARED | XFS_ILOCK_EXCL))
|
||||
xchk_iunlock(sc, sc->ilock_flags & (XFS_ILOCK_SHARED |
|
||||
XFS_ILOCK_EXCL));
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
return error;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
|
||||
while ((error = xchk_iscan_iter(&rp->pscan.iscan, &ip)) == 1) {
|
||||
bool flush;
|
||||
|
|
@ -597,9 +595,7 @@ xrep_parent_scan_dirtree(
|
|||
if (error)
|
||||
break;
|
||||
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
break;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
}
|
||||
|
||||
if (xchk_should_terminate(sc, &error))
|
||||
|
|
@ -1099,9 +1095,7 @@ xrep_parent_flush_xattrs(
|
|||
xrep_tempfile_iounlock(rp->sc);
|
||||
|
||||
/* Recreate the empty transaction and relock the inode. */
|
||||
error = xchk_trans_alloc_empty(rp->sc);
|
||||
if (error)
|
||||
return error;
|
||||
xchk_trans_alloc_empty(rp->sc);
|
||||
xchk_ilock(rp->sc, XFS_ILOCK_EXCL);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -505,9 +505,7 @@ xqcheck_collect_counts(
|
|||
* transactions do not take sb_internal.
|
||||
*/
|
||||
xchk_trans_cancel(sc);
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
return error;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
|
||||
while ((error = xchk_iscan_iter(&xqc->iscan, &ip)) == 1) {
|
||||
error = xqcheck_collect_inode(xqc, ip);
|
||||
|
|
|
|||
|
|
@ -47,29 +47,20 @@ rcbagbt_init_rec_from_cur(
|
|||
bag_rec->rbg_refcount = bag_irec->rbg_refcount;
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
rcbagbt_key_diff(
|
||||
STATIC int
|
||||
rcbagbt_cmp_key_with_cur(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *key)
|
||||
{
|
||||
struct rcbag_rec *rec = (struct rcbag_rec *)&cur->bc_rec;
|
||||
const struct rcbag_key *kp = (const struct rcbag_key *)key;
|
||||
|
||||
if (kp->rbg_startblock > rec->rbg_startblock)
|
||||
return 1;
|
||||
if (kp->rbg_startblock < rec->rbg_startblock)
|
||||
return -1;
|
||||
|
||||
if (kp->rbg_blockcount > rec->rbg_blockcount)
|
||||
return 1;
|
||||
if (kp->rbg_blockcount < rec->rbg_blockcount)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return cmp_int(kp->rbg_startblock, rec->rbg_startblock) ?:
|
||||
cmp_int(kp->rbg_blockcount, rec->rbg_blockcount);
|
||||
}
|
||||
|
||||
STATIC int64_t
|
||||
rcbagbt_diff_two_keys(
|
||||
STATIC int
|
||||
rcbagbt_cmp_two_keys(
|
||||
struct xfs_btree_cur *cur,
|
||||
const union xfs_btree_key *k1,
|
||||
const union xfs_btree_key *k2,
|
||||
|
|
@ -80,17 +71,8 @@ rcbagbt_diff_two_keys(
|
|||
|
||||
ASSERT(mask == NULL);
|
||||
|
||||
if (kp1->rbg_startblock > kp2->rbg_startblock)
|
||||
return 1;
|
||||
if (kp1->rbg_startblock < kp2->rbg_startblock)
|
||||
return -1;
|
||||
|
||||
if (kp1->rbg_blockcount > kp2->rbg_blockcount)
|
||||
return 1;
|
||||
if (kp1->rbg_blockcount < kp2->rbg_blockcount)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return cmp_int(kp1->rbg_startblock, kp2->rbg_startblock) ?:
|
||||
cmp_int(kp1->rbg_blockcount, kp2->rbg_blockcount);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
|
|
@ -201,9 +183,9 @@ static const struct xfs_btree_ops rcbagbt_mem_ops = {
|
|||
.init_key_from_rec = rcbagbt_init_key_from_rec,
|
||||
.init_rec_from_cur = rcbagbt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfbtree_init_ptr_from_cur,
|
||||
.key_diff = rcbagbt_key_diff,
|
||||
.cmp_key_with_cur = rcbagbt_cmp_key_with_cur,
|
||||
.buf_ops = &rcbagbt_mem_buf_ops,
|
||||
.diff_two_keys = rcbagbt_diff_two_keys,
|
||||
.cmp_two_keys = rcbagbt_cmp_two_keys,
|
||||
.keys_inorder = rcbagbt_keys_inorder,
|
||||
.recs_inorder = rcbagbt_recs_inorder,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1268,42 +1268,6 @@ xrep_setup_xfbtree(
|
|||
return xmbuf_alloc(sc->mp, descr, &sc->xmbtp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a dummy transaction for use in a live update hook function. This
|
||||
* function MUST NOT be called from regular repair code because the current
|
||||
* process' transaction is saved via the cookie.
|
||||
*/
|
||||
int
|
||||
xrep_trans_alloc_hook_dummy(
|
||||
struct xfs_mount *mp,
|
||||
void **cookiep,
|
||||
struct xfs_trans **tpp)
|
||||
{
|
||||
int error;
|
||||
|
||||
*cookiep = current->journal_info;
|
||||
current->journal_info = NULL;
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, tpp);
|
||||
if (!error)
|
||||
return 0;
|
||||
|
||||
current->journal_info = *cookiep;
|
||||
*cookiep = NULL;
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Cancel a dummy transaction used by a live update hook function. */
|
||||
void
|
||||
xrep_trans_cancel_hook_dummy(
|
||||
void **cookiep,
|
||||
struct xfs_trans *tp)
|
||||
{
|
||||
xfs_trans_cancel(tp);
|
||||
current->journal_info = *cookiep;
|
||||
*cookiep = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if this buffer can pass the given ->verify_struct() function.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -180,10 +180,6 @@ int xrep_quotacheck(struct xfs_scrub *sc);
|
|||
int xrep_reinit_pagf(struct xfs_scrub *sc);
|
||||
int xrep_reinit_pagi(struct xfs_scrub *sc);
|
||||
|
||||
int xrep_trans_alloc_hook_dummy(struct xfs_mount *mp, void **cookiep,
|
||||
struct xfs_trans **tpp);
|
||||
void xrep_trans_cancel_hook_dummy(void **cookiep, struct xfs_trans *tp);
|
||||
|
||||
bool xrep_buf_verify_struct(struct xfs_buf *bp, const struct xfs_buf_ops *ops);
|
||||
void xrep_inode_set_nblocks(struct xfs_scrub *sc, int64_t new_blocks);
|
||||
int xrep_reset_metafile_resv(struct xfs_scrub *sc);
|
||||
|
|
|
|||
|
|
@ -951,9 +951,7 @@ xrep_rmap_find_rmaps(
|
|||
sa->agf_bp = NULL;
|
||||
sa->agi_bp = NULL;
|
||||
xchk_trans_cancel(sc);
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
return error;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
|
||||
/* Iterate all AGs for inodes rmaps. */
|
||||
while ((error = xchk_iscan_iter(&rr->iscan, &ip)) == 1) {
|
||||
|
|
@ -1612,7 +1610,6 @@ xrep_rmapbt_live_update(
|
|||
struct xfs_mount *mp;
|
||||
struct xfs_btree_cur *mcur;
|
||||
struct xfs_trans *tp;
|
||||
void *txcookie;
|
||||
int error;
|
||||
|
||||
rr = container_of(nb, struct xrep_rmap, rhook.rmap_hook.nb);
|
||||
|
|
@ -1623,9 +1620,7 @@ xrep_rmapbt_live_update(
|
|||
|
||||
trace_xrep_rmap_live_update(pag_group(rr->sc->sa.pag), action, p);
|
||||
|
||||
error = xrep_trans_alloc_hook_dummy(mp, &txcookie, &tp);
|
||||
if (error)
|
||||
goto out_abort;
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
|
||||
mutex_lock(&rr->lock);
|
||||
mcur = xfs_rmapbt_mem_cursor(rr->sc->sa.pag, tp, &rr->rmap_btree);
|
||||
|
|
@ -1639,14 +1634,13 @@ xrep_rmapbt_live_update(
|
|||
if (error)
|
||||
goto out_cancel;
|
||||
|
||||
xrep_trans_cancel_hook_dummy(&txcookie, tp);
|
||||
xfs_trans_cancel(tp);
|
||||
mutex_unlock(&rr->lock);
|
||||
return NOTIFY_DONE;
|
||||
|
||||
out_cancel:
|
||||
xfbtree_trans_cancel(&rr->rmap_btree, tp);
|
||||
xrep_trans_cancel_hook_dummy(&txcookie, tp);
|
||||
out_abort:
|
||||
xfs_trans_cancel(tp);
|
||||
mutex_unlock(&rr->lock);
|
||||
xchk_iscan_abort(&rr->iscan);
|
||||
out_unlock:
|
||||
|
|
|
|||
|
|
@ -580,9 +580,7 @@ xrep_rtrmap_find_rmaps(
|
|||
*/
|
||||
xchk_trans_cancel(sc);
|
||||
xchk_rtgroup_unlock(&sc->sr);
|
||||
error = xchk_trans_alloc_empty(sc);
|
||||
if (error)
|
||||
return error;
|
||||
xchk_trans_alloc_empty(sc);
|
||||
|
||||
while ((error = xchk_iscan_iter(&rr->iscan, &ip)) == 1) {
|
||||
error = xrep_rtrmap_scan_inode(rr, ip);
|
||||
|
|
@ -846,7 +844,6 @@ xrep_rtrmapbt_live_update(
|
|||
struct xfs_mount *mp;
|
||||
struct xfs_btree_cur *mcur;
|
||||
struct xfs_trans *tp;
|
||||
void *txcookie;
|
||||
int error;
|
||||
|
||||
rr = container_of(nb, struct xrep_rtrmap, rhook.rmap_hook.nb);
|
||||
|
|
@ -857,9 +854,7 @@ xrep_rtrmapbt_live_update(
|
|||
|
||||
trace_xrep_rmap_live_update(rtg_group(rr->sc->sr.rtg), action, p);
|
||||
|
||||
error = xrep_trans_alloc_hook_dummy(mp, &txcookie, &tp);
|
||||
if (error)
|
||||
goto out_abort;
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
|
||||
mutex_lock(&rr->lock);
|
||||
mcur = xfs_rtrmapbt_mem_cursor(rr->sc->sr.rtg, tp, &rr->rtrmap_btree);
|
||||
|
|
@ -873,14 +868,13 @@ xrep_rtrmapbt_live_update(
|
|||
if (error)
|
||||
goto out_cancel;
|
||||
|
||||
xrep_trans_cancel_hook_dummy(&txcookie, tp);
|
||||
xfs_trans_cancel(tp);
|
||||
mutex_unlock(&rr->lock);
|
||||
return NOTIFY_DONE;
|
||||
|
||||
out_cancel:
|
||||
xfbtree_trans_cancel(&rr->rtrmap_btree, tp);
|
||||
xrep_trans_cancel_hook_dummy(&txcookie, tp);
|
||||
out_abort:
|
||||
xfs_trans_cancel(tp);
|
||||
xchk_iscan_abort(&rr->iscan);
|
||||
mutex_unlock(&rr->lock);
|
||||
out_unlock:
|
||||
|
|
|
|||
|
|
@ -876,10 +876,7 @@ xchk_scrubv_open_by_handle(
|
|||
struct xfs_inode *ip;
|
||||
int error;
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return NULL;
|
||||
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
error = xfs_iget(mp, tp, head->svh_ino, XCHK_IGET_FLAGS, 0, &ip);
|
||||
xfs_trans_cancel(tp);
|
||||
if (error)
|
||||
|
|
|
|||
|
|
@ -2996,7 +2996,7 @@ DEFINE_EVENT(xrep_pptr_salvage_class, name, \
|
|||
DEFINE_XREP_PPTR_SALVAGE_EVENT(xrep_xattr_salvage_pptr);
|
||||
DEFINE_XREP_PPTR_SALVAGE_EVENT(xrep_xattr_insert_pptr);
|
||||
|
||||
TRACE_EVENT(xrep_xattr_class,
|
||||
DECLARE_EVENT_CLASS(xrep_xattr_class,
|
||||
TP_PROTO(struct xfs_inode *ip, struct xfs_inode *arg_ip),
|
||||
TP_ARGS(ip, arg_ip),
|
||||
TP_STRUCT__entry(
|
||||
|
|
|
|||
|
|
@ -91,41 +91,37 @@ xfs_attri_log_nameval_alloc(
|
|||
name_len + new_name_len + value_len +
|
||||
new_value_len);
|
||||
|
||||
nv->name.i_addr = nv + 1;
|
||||
nv->name.i_len = name_len;
|
||||
nv->name.i_type = XLOG_REG_TYPE_ATTR_NAME;
|
||||
memcpy(nv->name.i_addr, name, name_len);
|
||||
nv->name.iov_base = nv + 1;
|
||||
nv->name.iov_len = name_len;
|
||||
memcpy(nv->name.iov_base, name, name_len);
|
||||
|
||||
if (new_name_len) {
|
||||
nv->new_name.i_addr = nv->name.i_addr + name_len;
|
||||
nv->new_name.i_len = new_name_len;
|
||||
memcpy(nv->new_name.i_addr, new_name, new_name_len);
|
||||
nv->new_name.iov_base = nv->name.iov_base + name_len;
|
||||
nv->new_name.iov_len = new_name_len;
|
||||
memcpy(nv->new_name.iov_base, new_name, new_name_len);
|
||||
} else {
|
||||
nv->new_name.i_addr = NULL;
|
||||
nv->new_name.i_len = 0;
|
||||
nv->new_name.iov_base = NULL;
|
||||
nv->new_name.iov_len = 0;
|
||||
}
|
||||
nv->new_name.i_type = XLOG_REG_TYPE_ATTR_NEWNAME;
|
||||
|
||||
if (value_len) {
|
||||
nv->value.i_addr = nv->name.i_addr + name_len + new_name_len;
|
||||
nv->value.i_len = value_len;
|
||||
memcpy(nv->value.i_addr, value, value_len);
|
||||
nv->value.iov_base = nv->name.iov_base + name_len + new_name_len;
|
||||
nv->value.iov_len = value_len;
|
||||
memcpy(nv->value.iov_base, value, value_len);
|
||||
} else {
|
||||
nv->value.i_addr = NULL;
|
||||
nv->value.i_len = 0;
|
||||
nv->value.iov_base = NULL;
|
||||
nv->value.iov_len = 0;
|
||||
}
|
||||
nv->value.i_type = XLOG_REG_TYPE_ATTR_VALUE;
|
||||
|
||||
if (new_value_len) {
|
||||
nv->new_value.i_addr = nv->name.i_addr + name_len +
|
||||
nv->new_value.iov_base = nv->name.iov_base + name_len +
|
||||
new_name_len + value_len;
|
||||
nv->new_value.i_len = new_value_len;
|
||||
memcpy(nv->new_value.i_addr, new_value, new_value_len);
|
||||
nv->new_value.iov_len = new_value_len;
|
||||
memcpy(nv->new_value.iov_base, new_value, new_value_len);
|
||||
} else {
|
||||
nv->new_value.i_addr = NULL;
|
||||
nv->new_value.i_len = 0;
|
||||
nv->new_value.iov_base = NULL;
|
||||
nv->new_value.iov_len = 0;
|
||||
}
|
||||
nv->new_value.i_type = XLOG_REG_TYPE_ATTR_NEWVALUE;
|
||||
|
||||
refcount_set(&nv->refcount, 1);
|
||||
return nv;
|
||||
|
|
@ -170,21 +166,21 @@ xfs_attri_item_size(
|
|||
|
||||
*nvecs += 2;
|
||||
*nbytes += sizeof(struct xfs_attri_log_format) +
|
||||
xlog_calc_iovec_len(nv->name.i_len);
|
||||
xlog_calc_iovec_len(nv->name.iov_len);
|
||||
|
||||
if (nv->new_name.i_len) {
|
||||
if (nv->new_name.iov_len) {
|
||||
*nvecs += 1;
|
||||
*nbytes += xlog_calc_iovec_len(nv->new_name.i_len);
|
||||
*nbytes += xlog_calc_iovec_len(nv->new_name.iov_len);
|
||||
}
|
||||
|
||||
if (nv->value.i_len) {
|
||||
if (nv->value.iov_len) {
|
||||
*nvecs += 1;
|
||||
*nbytes += xlog_calc_iovec_len(nv->value.i_len);
|
||||
*nbytes += xlog_calc_iovec_len(nv->value.iov_len);
|
||||
}
|
||||
|
||||
if (nv->new_value.i_len) {
|
||||
if (nv->new_value.iov_len) {
|
||||
*nvecs += 1;
|
||||
*nbytes += xlog_calc_iovec_len(nv->new_value.i_len);
|
||||
*nbytes += xlog_calc_iovec_len(nv->new_value.iov_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -212,31 +208,36 @@ xfs_attri_item_format(
|
|||
* the log recovery.
|
||||
*/
|
||||
|
||||
ASSERT(nv->name.i_len > 0);
|
||||
ASSERT(nv->name.iov_len > 0);
|
||||
attrip->attri_format.alfi_size++;
|
||||
|
||||
if (nv->new_name.i_len > 0)
|
||||
if (nv->new_name.iov_len > 0)
|
||||
attrip->attri_format.alfi_size++;
|
||||
|
||||
if (nv->value.i_len > 0)
|
||||
if (nv->value.iov_len > 0)
|
||||
attrip->attri_format.alfi_size++;
|
||||
|
||||
if (nv->new_value.i_len > 0)
|
||||
if (nv->new_value.iov_len > 0)
|
||||
attrip->attri_format.alfi_size++;
|
||||
|
||||
xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTRI_FORMAT,
|
||||
&attrip->attri_format,
|
||||
sizeof(struct xfs_attri_log_format));
|
||||
xlog_copy_from_iovec(lv, &vecp, &nv->name);
|
||||
|
||||
if (nv->new_name.i_len > 0)
|
||||
xlog_copy_from_iovec(lv, &vecp, &nv->new_name);
|
||||
xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NAME, nv->name.iov_base,
|
||||
nv->name.iov_len);
|
||||
|
||||
if (nv->value.i_len > 0)
|
||||
xlog_copy_from_iovec(lv, &vecp, &nv->value);
|
||||
if (nv->new_name.iov_len > 0)
|
||||
xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NEWNAME,
|
||||
nv->new_name.iov_base, nv->new_name.iov_len);
|
||||
|
||||
if (nv->new_value.i_len > 0)
|
||||
xlog_copy_from_iovec(lv, &vecp, &nv->new_value);
|
||||
if (nv->value.iov_len > 0)
|
||||
xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_VALUE,
|
||||
nv->value.iov_base, nv->value.iov_len);
|
||||
|
||||
if (nv->new_value.iov_len > 0)
|
||||
xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NEWVALUE,
|
||||
nv->new_value.iov_base, nv->new_value.iov_len);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -383,22 +384,22 @@ xfs_attr_log_item(
|
|||
attrp->alfi_ino = args->dp->i_ino;
|
||||
ASSERT(!(attr->xattri_op_flags & ~XFS_ATTRI_OP_FLAGS_TYPE_MASK));
|
||||
attrp->alfi_op_flags = attr->xattri_op_flags;
|
||||
attrp->alfi_value_len = nv->value.i_len;
|
||||
attrp->alfi_value_len = nv->value.iov_len;
|
||||
|
||||
switch (xfs_attr_log_item_op(attrp)) {
|
||||
case XFS_ATTRI_OP_FLAGS_PPTR_REPLACE:
|
||||
ASSERT(nv->value.i_len == nv->new_value.i_len);
|
||||
ASSERT(nv->value.iov_len == nv->new_value.iov_len);
|
||||
|
||||
attrp->alfi_igen = VFS_I(args->dp)->i_generation;
|
||||
attrp->alfi_old_name_len = nv->name.i_len;
|
||||
attrp->alfi_new_name_len = nv->new_name.i_len;
|
||||
attrp->alfi_old_name_len = nv->name.iov_len;
|
||||
attrp->alfi_new_name_len = nv->new_name.iov_len;
|
||||
break;
|
||||
case XFS_ATTRI_OP_FLAGS_PPTR_REMOVE:
|
||||
case XFS_ATTRI_OP_FLAGS_PPTR_SET:
|
||||
attrp->alfi_igen = VFS_I(args->dp)->i_generation;
|
||||
fallthrough;
|
||||
default:
|
||||
attrp->alfi_name_len = nv->name.i_len;
|
||||
attrp->alfi_name_len = nv->name.iov_len;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -616,10 +617,7 @@ xfs_attri_iread_extents(
|
|||
struct xfs_trans *tp;
|
||||
int error;
|
||||
|
||||
error = xfs_trans_alloc_empty(ip->i_mount, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
tp = xfs_trans_alloc_empty(ip->i_mount);
|
||||
xfs_ilock(ip, XFS_ILOCK_EXCL);
|
||||
error = xfs_iread_extents(tp, ip, XFS_ATTR_FORK);
|
||||
xfs_iunlock(ip, XFS_ILOCK_EXCL);
|
||||
|
|
@ -690,14 +688,14 @@ xfs_attri_recover_work(
|
|||
args->dp = ip;
|
||||
args->geo = mp->m_attr_geo;
|
||||
args->whichfork = XFS_ATTR_FORK;
|
||||
args->name = nv->name.i_addr;
|
||||
args->namelen = nv->name.i_len;
|
||||
args->new_name = nv->new_name.i_addr;
|
||||
args->new_namelen = nv->new_name.i_len;
|
||||
args->value = nv->value.i_addr;
|
||||
args->valuelen = nv->value.i_len;
|
||||
args->new_value = nv->new_value.i_addr;
|
||||
args->new_valuelen = nv->new_value.i_len;
|
||||
args->name = nv->name.iov_base;
|
||||
args->namelen = nv->name.iov_len;
|
||||
args->new_name = nv->new_name.iov_base;
|
||||
args->new_namelen = nv->new_name.iov_len;
|
||||
args->value = nv->value.iov_base;
|
||||
args->valuelen = nv->value.iov_len;
|
||||
args->new_value = nv->new_value.iov_base;
|
||||
args->new_valuelen = nv->new_value.iov_len;
|
||||
args->attr_filter = attrp->alfi_attr_filter & XFS_ATTRI_FILTER_MASK;
|
||||
args->op_flags = XFS_DA_OP_RECOVERY | XFS_DA_OP_OKNOENT |
|
||||
XFS_DA_OP_LOGGED;
|
||||
|
|
@ -754,8 +752,8 @@ xfs_attr_recover_work(
|
|||
*/
|
||||
attrp = &attrip->attri_format;
|
||||
if (!xfs_attri_validate(mp, attrp) ||
|
||||
!xfs_attr_namecheck(attrp->alfi_attr_filter, nv->name.i_addr,
|
||||
nv->name.i_len))
|
||||
!xfs_attr_namecheck(attrp->alfi_attr_filter, nv->name.iov_base,
|
||||
nv->name.iov_len))
|
||||
return -EFSCORRUPTED;
|
||||
|
||||
attr = xfs_attri_recover_work(mp, dfp, attrp, &ip, nv);
|
||||
|
|
@ -953,50 +951,50 @@ static inline void *
|
|||
xfs_attri_validate_name_iovec(
|
||||
struct xfs_mount *mp,
|
||||
struct xfs_attri_log_format *attri_formatp,
|
||||
const struct xfs_log_iovec *iovec,
|
||||
const struct kvec *iovec,
|
||||
unsigned int name_len)
|
||||
{
|
||||
if (iovec->i_len != xlog_calc_iovec_len(name_len)) {
|
||||
if (iovec->iov_len != xlog_calc_iovec_len(name_len)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
attri_formatp, sizeof(*attri_formatp));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!xfs_attr_namecheck(attri_formatp->alfi_attr_filter, iovec->i_addr,
|
||||
if (!xfs_attr_namecheck(attri_formatp->alfi_attr_filter, iovec->iov_base,
|
||||
name_len)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
attri_formatp, sizeof(*attri_formatp));
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
iovec->i_addr, iovec->i_len);
|
||||
iovec->iov_base, iovec->iov_len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return iovec->i_addr;
|
||||
return iovec->iov_base;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
xfs_attri_validate_value_iovec(
|
||||
struct xfs_mount *mp,
|
||||
struct xfs_attri_log_format *attri_formatp,
|
||||
const struct xfs_log_iovec *iovec,
|
||||
const struct kvec *iovec,
|
||||
unsigned int value_len)
|
||||
{
|
||||
if (iovec->i_len != xlog_calc_iovec_len(value_len)) {
|
||||
if (iovec->iov_len != xlog_calc_iovec_len(value_len)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
attri_formatp, sizeof(*attri_formatp));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((attri_formatp->alfi_attr_filter & XFS_ATTR_PARENT) &&
|
||||
!xfs_parent_valuecheck(mp, iovec->i_addr, value_len)) {
|
||||
!xfs_parent_valuecheck(mp, iovec->iov_base, value_len)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
attri_formatp, sizeof(*attri_formatp));
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
iovec->i_addr, iovec->i_len);
|
||||
iovec->iov_base, iovec->iov_len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return iovec->i_addr;
|
||||
return iovec->iov_base;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
|
|
@ -1023,13 +1021,13 @@ xlog_recover_attri_commit_pass2(
|
|||
|
||||
/* Validate xfs_attri_log_format before the large memory allocation */
|
||||
len = sizeof(struct xfs_attri_log_format);
|
||||
if (item->ri_buf[i].i_len != len) {
|
||||
if (item->ri_buf[i].iov_len != len) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
attri_formatp = item->ri_buf[i].i_addr;
|
||||
attri_formatp = item->ri_buf[i].iov_base;
|
||||
if (!xfs_attri_validate(mp, attri_formatp)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
attri_formatp, len);
|
||||
|
|
@ -1218,10 +1216,10 @@ xlog_recover_attrd_commit_pass2(
|
|||
{
|
||||
struct xfs_attrd_log_format *attrd_formatp;
|
||||
|
||||
attrd_formatp = item->ri_buf[0].i_addr;
|
||||
if (item->ri_buf[0].i_len != sizeof(struct xfs_attrd_log_format)) {
|
||||
attrd_formatp = item->ri_buf[0].iov_base;
|
||||
if (item->ri_buf[0].iov_len != sizeof(struct xfs_attrd_log_format)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ struct xfs_mount;
|
|||
struct kmem_zone;
|
||||
|
||||
struct xfs_attri_log_nameval {
|
||||
struct xfs_log_iovec name;
|
||||
struct xfs_log_iovec new_name; /* PPTR_REPLACE only */
|
||||
struct xfs_log_iovec value;
|
||||
struct xfs_log_iovec new_value; /* PPTR_REPLACE only */
|
||||
struct kvec name;
|
||||
struct kvec new_name; /* PPTR_REPLACE only */
|
||||
struct kvec value;
|
||||
struct kvec new_value; /* PPTR_REPLACE only */
|
||||
refcount_t refcount;
|
||||
|
||||
/* name and value follow the end of this struct */
|
||||
|
|
|
|||
|
|
@ -654,24 +654,24 @@ xlog_recover_bui_commit_pass2(
|
|||
struct xfs_bui_log_format *bui_formatp;
|
||||
size_t len;
|
||||
|
||||
bui_formatp = item->ri_buf[0].i_addr;
|
||||
bui_formatp = item->ri_buf[0].iov_base;
|
||||
|
||||
if (item->ri_buf[0].i_len < xfs_bui_log_format_sizeof(0)) {
|
||||
if (item->ri_buf[0].iov_len < xfs_bui_log_format_sizeof(0)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
if (bui_formatp->bui_nextents != XFS_BUI_MAX_FAST_EXTENTS) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
len = xfs_bui_log_format_sizeof(bui_formatp->bui_nextents);
|
||||
if (item->ri_buf[0].i_len != len) {
|
||||
if (item->ri_buf[0].iov_len != len) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -705,10 +705,10 @@ xlog_recover_bud_commit_pass2(
|
|||
{
|
||||
struct xfs_bud_log_format *bud_formatp;
|
||||
|
||||
bud_formatp = item->ri_buf[0].i_addr;
|
||||
if (item->ri_buf[0].i_len != sizeof(struct xfs_bud_log_format)) {
|
||||
bud_formatp = item->ri_buf[0].iov_base;
|
||||
if (item->ri_buf[0].iov_len != sizeof(struct xfs_bud_log_format)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,16 +90,16 @@ xfs_buf_item_relse(
|
|||
/* Is this log iovec plausibly large enough to contain the buffer log format? */
|
||||
bool
|
||||
xfs_buf_log_check_iovec(
|
||||
struct xfs_log_iovec *iovec)
|
||||
struct kvec *iovec)
|
||||
{
|
||||
struct xfs_buf_log_format *blfp = iovec->i_addr;
|
||||
struct xfs_buf_log_format *blfp = iovec->iov_base;
|
||||
char *bmp_end;
|
||||
char *item_end;
|
||||
|
||||
if (offsetof(struct xfs_buf_log_format, blf_data_map) > iovec->i_len)
|
||||
if (offsetof(struct xfs_buf_log_format, blf_data_map) > iovec->iov_len)
|
||||
return false;
|
||||
|
||||
item_end = (char *)iovec->i_addr + iovec->i_len;
|
||||
item_end = (char *)iovec->iov_base + iovec->iov_len;
|
||||
bmp_end = (char *)&blfp->blf_data_map[blfp->blf_map_size];
|
||||
return bmp_end <= item_end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ static inline void xfs_buf_dquot_iodone(struct xfs_buf *bp)
|
|||
}
|
||||
#endif /* CONFIG_XFS_QUOTA */
|
||||
void xfs_buf_iodone(struct xfs_buf *);
|
||||
bool xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);
|
||||
bool xfs_buf_log_check_iovec(struct kvec *iovec);
|
||||
|
||||
unsigned int xfs_buf_inval_log_space(unsigned int map_count,
|
||||
unsigned int blocksize);
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ STATIC enum xlog_recover_reorder
|
|||
xlog_recover_buf_reorder(
|
||||
struct xlog_recover_item *item)
|
||||
{
|
||||
struct xfs_buf_log_format *buf_f = item->ri_buf[0].i_addr;
|
||||
struct xfs_buf_log_format *buf_f = item->ri_buf[0].iov_base;
|
||||
|
||||
if (buf_f->blf_flags & XFS_BLF_CANCEL)
|
||||
return XLOG_REORDER_CANCEL_LIST;
|
||||
|
|
@ -173,7 +173,7 @@ xlog_recover_buf_ra_pass2(
|
|||
struct xlog *log,
|
||||
struct xlog_recover_item *item)
|
||||
{
|
||||
struct xfs_buf_log_format *buf_f = item->ri_buf[0].i_addr;
|
||||
struct xfs_buf_log_format *buf_f = item->ri_buf[0].iov_base;
|
||||
|
||||
xlog_buf_readahead(log, buf_f->blf_blkno, buf_f->blf_len, NULL);
|
||||
}
|
||||
|
|
@ -187,11 +187,11 @@ xlog_recover_buf_commit_pass1(
|
|||
struct xlog *log,
|
||||
struct xlog_recover_item *item)
|
||||
{
|
||||
struct xfs_buf_log_format *bf = item->ri_buf[0].i_addr;
|
||||
struct xfs_buf_log_format *bf = item->ri_buf[0].iov_base;
|
||||
|
||||
if (!xfs_buf_log_check_iovec(&item->ri_buf[0])) {
|
||||
xfs_err(log->l_mp, "bad buffer log item size (%d)",
|
||||
item->ri_buf[0].i_len);
|
||||
xfs_err(log->l_mp, "bad buffer log item size (%zd)",
|
||||
item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -487,8 +487,8 @@ xlog_recover_do_reg_buffer(
|
|||
nbits = xfs_contig_bits(buf_f->blf_data_map,
|
||||
buf_f->blf_map_size, bit);
|
||||
ASSERT(nbits > 0);
|
||||
ASSERT(item->ri_buf[i].i_addr != NULL);
|
||||
ASSERT(item->ri_buf[i].i_len % XFS_BLF_CHUNK == 0);
|
||||
ASSERT(item->ri_buf[i].iov_base != NULL);
|
||||
ASSERT(item->ri_buf[i].iov_len % XFS_BLF_CHUNK == 0);
|
||||
ASSERT(BBTOB(bp->b_length) >=
|
||||
((uint)bit << XFS_BLF_SHIFT) + (nbits << XFS_BLF_SHIFT));
|
||||
|
||||
|
|
@ -500,8 +500,8 @@ xlog_recover_do_reg_buffer(
|
|||
* the log. Hence we need to trim nbits back to the length of
|
||||
* the current region being copied out of the log.
|
||||
*/
|
||||
if (item->ri_buf[i].i_len < (nbits << XFS_BLF_SHIFT))
|
||||
nbits = item->ri_buf[i].i_len >> XFS_BLF_SHIFT;
|
||||
if (item->ri_buf[i].iov_len < (nbits << XFS_BLF_SHIFT))
|
||||
nbits = item->ri_buf[i].iov_len >> XFS_BLF_SHIFT;
|
||||
|
||||
/*
|
||||
* Do a sanity check if this is a dquot buffer. Just checking
|
||||
|
|
@ -511,18 +511,18 @@ xlog_recover_do_reg_buffer(
|
|||
fa = NULL;
|
||||
if (buf_f->blf_flags &
|
||||
(XFS_BLF_UDQUOT_BUF|XFS_BLF_PDQUOT_BUF|XFS_BLF_GDQUOT_BUF)) {
|
||||
if (item->ri_buf[i].i_addr == NULL) {
|
||||
if (item->ri_buf[i].iov_base == NULL) {
|
||||
xfs_alert(mp,
|
||||
"XFS: NULL dquot in %s.", __func__);
|
||||
goto next;
|
||||
}
|
||||
if (item->ri_buf[i].i_len < size_disk_dquot) {
|
||||
if (item->ri_buf[i].iov_len < size_disk_dquot) {
|
||||
xfs_alert(mp,
|
||||
"XFS: dquot too small (%d) in %s.",
|
||||
item->ri_buf[i].i_len, __func__);
|
||||
"XFS: dquot too small (%zd) in %s.",
|
||||
item->ri_buf[i].iov_len, __func__);
|
||||
goto next;
|
||||
}
|
||||
fa = xfs_dquot_verify(mp, item->ri_buf[i].i_addr, -1);
|
||||
fa = xfs_dquot_verify(mp, item->ri_buf[i].iov_base, -1);
|
||||
if (fa) {
|
||||
xfs_alert(mp,
|
||||
"dquot corrupt at %pS trying to replay into block 0x%llx",
|
||||
|
|
@ -533,7 +533,7 @@ xlog_recover_do_reg_buffer(
|
|||
|
||||
memcpy(xfs_buf_offset(bp,
|
||||
(uint)bit << XFS_BLF_SHIFT), /* dest */
|
||||
item->ri_buf[i].i_addr, /* source */
|
||||
item->ri_buf[i].iov_base, /* source */
|
||||
nbits<<XFS_BLF_SHIFT); /* length */
|
||||
next:
|
||||
i++;
|
||||
|
|
@ -669,8 +669,8 @@ xlog_recover_do_inode_buffer(
|
|||
if (next_unlinked_offset < reg_buf_offset)
|
||||
continue;
|
||||
|
||||
ASSERT(item->ri_buf[item_index].i_addr != NULL);
|
||||
ASSERT((item->ri_buf[item_index].i_len % XFS_BLF_CHUNK) == 0);
|
||||
ASSERT(item->ri_buf[item_index].iov_base != NULL);
|
||||
ASSERT((item->ri_buf[item_index].iov_len % XFS_BLF_CHUNK) == 0);
|
||||
ASSERT((reg_buf_offset + reg_buf_bytes) <= BBTOB(bp->b_length));
|
||||
|
||||
/*
|
||||
|
|
@ -678,7 +678,7 @@ xlog_recover_do_inode_buffer(
|
|||
* current di_next_unlinked field. Extract its value
|
||||
* and copy it to the buffer copy.
|
||||
*/
|
||||
logged_nextp = item->ri_buf[item_index].i_addr +
|
||||
logged_nextp = item->ri_buf[item_index].iov_base +
|
||||
next_unlinked_offset - reg_buf_offset;
|
||||
if (XFS_IS_CORRUPT(mp, *logged_nextp == 0)) {
|
||||
xfs_alert(mp,
|
||||
|
|
@ -1002,7 +1002,7 @@ xlog_recover_buf_commit_pass2(
|
|||
struct xlog_recover_item *item,
|
||||
xfs_lsn_t current_lsn)
|
||||
{
|
||||
struct xfs_buf_log_format *buf_f = item->ri_buf[0].i_addr;
|
||||
struct xfs_buf_log_format *buf_f = item->ri_buf[0].iov_base;
|
||||
struct xfs_mount *mp = log->l_mp;
|
||||
struct xfs_buf *bp;
|
||||
int error;
|
||||
|
|
|
|||
|
|
@ -189,9 +189,7 @@ xfs_trim_gather_extents(
|
|||
*/
|
||||
xfs_log_force(mp, XFS_LOG_SYNC);
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
|
||||
error = xfs_alloc_read_agf(pag, tp, 0, &agbp);
|
||||
if (error)
|
||||
|
|
@ -583,9 +581,7 @@ xfs_trim_rtextents(
|
|||
struct xfs_trans *tp;
|
||||
int error;
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
|
||||
/*
|
||||
* Walk the free ranges between low and high. The query_range function
|
||||
|
|
@ -701,9 +697,7 @@ xfs_trim_rtgroup_extents(
|
|||
struct xfs_trans *tp;
|
||||
int error;
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
|
||||
/*
|
||||
* Walk the free ranges between low and high. The query_range function
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ xlog_recover_dquot_ra_pass2(
|
|||
if (mp->m_qflags == 0)
|
||||
return;
|
||||
|
||||
recddq = item->ri_buf[1].i_addr;
|
||||
recddq = item->ri_buf[1].iov_base;
|
||||
if (recddq == NULL)
|
||||
return;
|
||||
if (item->ri_buf[1].i_len < sizeof(struct xfs_disk_dquot))
|
||||
if (item->ri_buf[1].iov_len < sizeof(struct xfs_disk_dquot))
|
||||
return;
|
||||
|
||||
type = recddq->d_type & XFS_DQTYPE_REC_MASK;
|
||||
|
|
@ -45,7 +45,7 @@ xlog_recover_dquot_ra_pass2(
|
|||
if (log->l_quotaoffs_flag & type)
|
||||
return;
|
||||
|
||||
dq_f = item->ri_buf[0].i_addr;
|
||||
dq_f = item->ri_buf[0].iov_base;
|
||||
ASSERT(dq_f);
|
||||
ASSERT(dq_f->qlf_len == 1);
|
||||
|
||||
|
|
@ -79,14 +79,14 @@ xlog_recover_dquot_commit_pass2(
|
|||
if (mp->m_qflags == 0)
|
||||
return 0;
|
||||
|
||||
recddq = item->ri_buf[1].i_addr;
|
||||
recddq = item->ri_buf[1].iov_base;
|
||||
if (recddq == NULL) {
|
||||
xfs_alert(log->l_mp, "NULL dquot in %s.", __func__);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
if (item->ri_buf[1].i_len < sizeof(struct xfs_disk_dquot)) {
|
||||
xfs_alert(log->l_mp, "dquot too small (%d) in %s.",
|
||||
item->ri_buf[1].i_len, __func__);
|
||||
if (item->ri_buf[1].iov_len < sizeof(struct xfs_disk_dquot)) {
|
||||
xfs_alert(log->l_mp, "dquot too small (%zd) in %s.",
|
||||
item->ri_buf[1].iov_len, __func__);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ xlog_recover_dquot_commit_pass2(
|
|||
* The other possibility, of course, is that the quota subsystem was
|
||||
* removed since the last mount - ENOSYS.
|
||||
*/
|
||||
dq_f = item->ri_buf[0].i_addr;
|
||||
dq_f = item->ri_buf[0].iov_base;
|
||||
ASSERT(dq_f);
|
||||
fa = xfs_dquot_verify(mp, recddq, dq_f->qlf_id);
|
||||
if (fa) {
|
||||
|
|
@ -147,7 +147,7 @@ xlog_recover_dquot_commit_pass2(
|
|||
}
|
||||
}
|
||||
|
||||
memcpy(ddq, recddq, item->ri_buf[1].i_len);
|
||||
memcpy(ddq, recddq, item->ri_buf[1].iov_len);
|
||||
if (xfs_has_crc(mp)) {
|
||||
xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk),
|
||||
XFS_DQUOT_CRC_OFF);
|
||||
|
|
@ -192,7 +192,7 @@ xlog_recover_quotaoff_commit_pass1(
|
|||
struct xlog *log,
|
||||
struct xlog_recover_item *item)
|
||||
{
|
||||
struct xfs_qoff_logformat *qoff_f = item->ri_buf[0].i_addr;
|
||||
struct xfs_qoff_logformat *qoff_f = item->ri_buf[0].iov_base;
|
||||
ASSERT(qoff_f);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -558,12 +558,12 @@ xlog_recover_xmi_commit_pass2(
|
|||
size_t len;
|
||||
|
||||
len = sizeof(struct xfs_xmi_log_format);
|
||||
if (item->ri_buf[0].i_len != len) {
|
||||
if (item->ri_buf[0].iov_len != len) {
|
||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
xmi_formatp = item->ri_buf[0].i_addr;
|
||||
xmi_formatp = item->ri_buf[0].iov_base;
|
||||
if (xmi_formatp->__pad != 0) {
|
||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp);
|
||||
return -EFSCORRUPTED;
|
||||
|
|
@ -598,8 +598,8 @@ xlog_recover_xmd_commit_pass2(
|
|||
{
|
||||
struct xfs_xmd_log_format *xmd_formatp;
|
||||
|
||||
xmd_formatp = item->ri_buf[0].i_addr;
|
||||
if (item->ri_buf[0].i_len != sizeof(struct xfs_xmd_log_format)) {
|
||||
xmd_formatp = item->ri_buf[0].iov_base;
|
||||
if (item->ri_buf[0].iov_len != sizeof(struct xfs_xmd_log_format)) {
|
||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,15 +182,18 @@ xfs_efi_init(
|
|||
* It will handle the conversion of formats if necessary.
|
||||
*/
|
||||
STATIC int
|
||||
xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
|
||||
xfs_efi_copy_format(
|
||||
struct kvec *buf,
|
||||
struct xfs_efi_log_format *dst_efi_fmt)
|
||||
{
|
||||
xfs_efi_log_format_t *src_efi_fmt = buf->i_addr;
|
||||
uint i;
|
||||
uint len = xfs_efi_log_format_sizeof(src_efi_fmt->efi_nextents);
|
||||
uint len32 = xfs_efi_log_format32_sizeof(src_efi_fmt->efi_nextents);
|
||||
uint len64 = xfs_efi_log_format64_sizeof(src_efi_fmt->efi_nextents);
|
||||
struct xfs_efi_log_format *src_efi_fmt = buf->iov_base;
|
||||
uint len, len32, len64, i;
|
||||
|
||||
if (buf->i_len == len) {
|
||||
len = xfs_efi_log_format_sizeof(src_efi_fmt->efi_nextents);
|
||||
len32 = xfs_efi_log_format32_sizeof(src_efi_fmt->efi_nextents);
|
||||
len64 = xfs_efi_log_format64_sizeof(src_efi_fmt->efi_nextents);
|
||||
|
||||
if (buf->iov_len == len) {
|
||||
memcpy(dst_efi_fmt, src_efi_fmt,
|
||||
offsetof(struct xfs_efi_log_format, efi_extents));
|
||||
for (i = 0; i < src_efi_fmt->efi_nextents; i++)
|
||||
|
|
@ -198,8 +201,8 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
|
|||
&src_efi_fmt->efi_extents[i],
|
||||
sizeof(struct xfs_extent));
|
||||
return 0;
|
||||
} else if (buf->i_len == len32) {
|
||||
xfs_efi_log_format_32_t *src_efi_fmt_32 = buf->i_addr;
|
||||
} else if (buf->iov_len == len32) {
|
||||
xfs_efi_log_format_32_t *src_efi_fmt_32 = buf->iov_base;
|
||||
|
||||
dst_efi_fmt->efi_type = src_efi_fmt_32->efi_type;
|
||||
dst_efi_fmt->efi_size = src_efi_fmt_32->efi_size;
|
||||
|
|
@ -212,8 +215,8 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
|
|||
src_efi_fmt_32->efi_extents[i].ext_len;
|
||||
}
|
||||
return 0;
|
||||
} else if (buf->i_len == len64) {
|
||||
xfs_efi_log_format_64_t *src_efi_fmt_64 = buf->i_addr;
|
||||
} else if (buf->iov_len == len64) {
|
||||
xfs_efi_log_format_64_t *src_efi_fmt_64 = buf->iov_base;
|
||||
|
||||
dst_efi_fmt->efi_type = src_efi_fmt_64->efi_type;
|
||||
dst_efi_fmt->efi_size = src_efi_fmt_64->efi_size;
|
||||
|
|
@ -227,8 +230,8 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, NULL, buf->i_addr,
|
||||
buf->i_len);
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, NULL, buf->iov_base,
|
||||
buf->iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -865,11 +868,11 @@ xlog_recover_efi_commit_pass2(
|
|||
struct xfs_efi_log_format *efi_formatp;
|
||||
int error;
|
||||
|
||||
efi_formatp = item->ri_buf[0].i_addr;
|
||||
efi_formatp = item->ri_buf[0].iov_base;
|
||||
|
||||
if (item->ri_buf[0].i_len < xfs_efi_log_format_sizeof(0)) {
|
||||
if (item->ri_buf[0].iov_len < xfs_efi_log_format_sizeof(0)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -904,11 +907,11 @@ xlog_recover_rtefi_commit_pass2(
|
|||
struct xfs_efi_log_format *efi_formatp;
|
||||
int error;
|
||||
|
||||
efi_formatp = item->ri_buf[0].i_addr;
|
||||
efi_formatp = item->ri_buf[0].iov_base;
|
||||
|
||||
if (item->ri_buf[0].i_len < xfs_efi_log_format_sizeof(0)) {
|
||||
if (item->ri_buf[0].iov_len < xfs_efi_log_format_sizeof(0)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -933,7 +936,7 @@ xlog_recover_rtefi_commit_pass2(
|
|||
xfs_lsn_t lsn)
|
||||
{
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -958,9 +961,9 @@ xlog_recover_efd_commit_pass2(
|
|||
xfs_lsn_t lsn)
|
||||
{
|
||||
struct xfs_efd_log_format *efd_formatp;
|
||||
int buflen = item->ri_buf[0].i_len;
|
||||
int buflen = item->ri_buf[0].iov_len;
|
||||
|
||||
efd_formatp = item->ri_buf[0].i_addr;
|
||||
efd_formatp = item->ri_buf[0].iov_base;
|
||||
|
||||
if (buflen < sizeof(struct xfs_efd_log_format)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
|
|
@ -968,9 +971,9 @@ xlog_recover_efd_commit_pass2(
|
|||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
if (item->ri_buf[0].i_len != xfs_efd_log_format32_sizeof(
|
||||
if (item->ri_buf[0].iov_len != xfs_efd_log_format32_sizeof(
|
||||
efd_formatp->efd_nextents) &&
|
||||
item->ri_buf[0].i_len != xfs_efd_log_format64_sizeof(
|
||||
item->ri_buf[0].iov_len != xfs_efd_log_format64_sizeof(
|
||||
efd_formatp->efd_nextents)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
efd_formatp, buflen);
|
||||
|
|
@ -995,9 +998,9 @@ xlog_recover_rtefd_commit_pass2(
|
|||
xfs_lsn_t lsn)
|
||||
{
|
||||
struct xfs_efd_log_format *efd_formatp;
|
||||
int buflen = item->ri_buf[0].i_len;
|
||||
int buflen = item->ri_buf[0].iov_len;
|
||||
|
||||
efd_formatp = item->ri_buf[0].i_addr;
|
||||
efd_formatp = item->ri_buf[0].iov_base;
|
||||
|
||||
if (buflen < sizeof(struct xfs_efd_log_format)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
|
|
@ -1005,9 +1008,9 @@ xlog_recover_rtefd_commit_pass2(
|
|||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
if (item->ri_buf[0].i_len != xfs_efd_log_format32_sizeof(
|
||||
if (item->ri_buf[0].iov_len != xfs_efd_log_format32_sizeof(
|
||||
efd_formatp->efd_nextents) &&
|
||||
item->ri_buf[0].i_len != xfs_efd_log_format64_sizeof(
|
||||
item->ri_buf[0].iov_len != xfs_efd_log_format64_sizeof(
|
||||
efd_formatp->efd_nextents)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
efd_formatp, buflen);
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ xfs_file_write_checks(
|
|||
|
||||
static ssize_t
|
||||
xfs_zoned_write_space_reserve(
|
||||
struct xfs_inode *ip,
|
||||
struct xfs_mount *mp,
|
||||
struct kiocb *iocb,
|
||||
struct iov_iter *from,
|
||||
unsigned int flags,
|
||||
|
|
@ -533,8 +533,8 @@ xfs_zoned_write_space_reserve(
|
|||
*
|
||||
* Any remaining block will be returned after the write.
|
||||
*/
|
||||
return xfs_zoned_space_reserve(ip,
|
||||
XFS_B_TO_FSB(ip->i_mount, count) + 1 + 2, flags, ac);
|
||||
return xfs_zoned_space_reserve(mp, XFS_B_TO_FSB(mp, count) + 1 + 2,
|
||||
flags, ac);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -718,13 +718,13 @@ xfs_file_dio_write_zoned(
|
|||
struct xfs_zone_alloc_ctx ac = { };
|
||||
ssize_t ret;
|
||||
|
||||
ret = xfs_zoned_write_space_reserve(ip, iocb, from, 0, &ac);
|
||||
ret = xfs_zoned_write_space_reserve(ip->i_mount, iocb, from, 0, &ac);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = xfs_file_dio_write_aligned(ip, iocb, from,
|
||||
&xfs_zoned_direct_write_iomap_ops,
|
||||
&xfs_dio_zoned_write_ops, &ac);
|
||||
xfs_zoned_space_unreserve(ip, &ac);
|
||||
xfs_zoned_space_unreserve(ip->i_mount, &ac);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1032,7 +1032,7 @@ xfs_file_buffered_write_zoned(
|
|||
struct xfs_zone_alloc_ctx ac = { };
|
||||
ssize_t ret;
|
||||
|
||||
ret = xfs_zoned_write_space_reserve(ip, iocb, from, XFS_ZR_GREEDY, &ac);
|
||||
ret = xfs_zoned_write_space_reserve(mp, iocb, from, XFS_ZR_GREEDY, &ac);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -1073,7 +1073,7 @@ xfs_file_buffered_write_zoned(
|
|||
out_unlock:
|
||||
xfs_iunlock(ip, iolock);
|
||||
out_unreserve:
|
||||
xfs_zoned_space_unreserve(ip, &ac);
|
||||
xfs_zoned_space_unreserve(ip->i_mount, &ac);
|
||||
if (ret > 0) {
|
||||
XFS_STATS_ADD(mp, xs_write_bytes, ret);
|
||||
ret = generic_write_sync(iocb, ret);
|
||||
|
|
@ -1414,11 +1414,11 @@ xfs_file_zoned_fallocate(
|
|||
struct xfs_inode *ip = XFS_I(file_inode(file));
|
||||
int error;
|
||||
|
||||
error = xfs_zoned_space_reserve(ip, 2, XFS_ZR_RESERVED, &ac);
|
||||
error = xfs_zoned_space_reserve(ip->i_mount, 2, XFS_ZR_RESERVED, &ac);
|
||||
if (error)
|
||||
return error;
|
||||
error = __xfs_file_fallocate(file, mode, offset, len, &ac);
|
||||
xfs_zoned_space_unreserve(ip, &ac);
|
||||
xfs_zoned_space_unreserve(ip->i_mount, &ac);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
@ -1828,12 +1828,12 @@ xfs_write_fault_zoned(
|
|||
* But as the overallocation is limited to less than a folio and will be
|
||||
* release instantly that's just fine.
|
||||
*/
|
||||
error = xfs_zoned_space_reserve(ip, XFS_B_TO_FSB(ip->i_mount, len), 0,
|
||||
&ac);
|
||||
error = xfs_zoned_space_reserve(ip->i_mount,
|
||||
XFS_B_TO_FSB(ip->i_mount, len), 0, &ac);
|
||||
if (error < 0)
|
||||
return vmf_fs_error(error);
|
||||
ret = __xfs_write_fault(vmf, order, &ac);
|
||||
xfs_zoned_space_unreserve(ip, &ac);
|
||||
xfs_zoned_space_unreserve(ip->i_mount, &ac);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1270,9 +1270,7 @@ xfs_getfsmap(
|
|||
* buffer locking abilities to detect cycles in the rmapbt
|
||||
* without deadlocking.
|
||||
*/
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
break;
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
|
||||
info.dev = handlers[i].dev;
|
||||
info.last = false;
|
||||
|
|
|
|||
|
|
@ -893,10 +893,7 @@ xfs_metafile_iget(
|
|||
struct xfs_trans *tp;
|
||||
int error;
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
error = xfs_trans_metafile_iget(tp, ino, metafile_type, ipp);
|
||||
xfs_trans_cancel(tp);
|
||||
return error;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ xlog_recover_icreate_commit_pass2(
|
|||
int nbufs;
|
||||
int i;
|
||||
|
||||
icl = (struct xfs_icreate_log *)item->ri_buf[0].i_addr;
|
||||
icl = (struct xfs_icreate_log *)item->ri_buf[0].iov_base;
|
||||
if (icl->icl_type != XFS_LI_ICREATE) {
|
||||
xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad type");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -2932,12 +2932,9 @@ xfs_inode_reload_unlinked(
|
|||
struct xfs_inode *ip)
|
||||
{
|
||||
struct xfs_trans *tp;
|
||||
int error;
|
||||
|
||||
error = xfs_trans_alloc_empty(ip->i_mount, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
int error = 0;
|
||||
|
||||
tp = xfs_trans_alloc_empty(ip->i_mount);
|
||||
xfs_ilock(ip, XFS_ILOCK_SHARED);
|
||||
if (xfs_inode_unlinked_incomplete(ip))
|
||||
error = xfs_inode_reload_unlinked_bucket(tp, ip);
|
||||
|
|
|
|||
|
|
@ -1182,12 +1182,12 @@ xfs_iflush_shutdown_abort(
|
|||
*/
|
||||
int
|
||||
xfs_inode_item_format_convert(
|
||||
struct xfs_log_iovec *buf,
|
||||
struct kvec *buf,
|
||||
struct xfs_inode_log_format *in_f)
|
||||
{
|
||||
struct xfs_inode_log_format_32 *in_f32 = buf->i_addr;
|
||||
struct xfs_inode_log_format_32 *in_f32 = buf->iov_base;
|
||||
|
||||
if (buf->i_len != sizeof(*in_f32)) {
|
||||
if (buf->iov_len != sizeof(*in_f32)) {
|
||||
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
|
|||
extern void xfs_inode_item_destroy(struct xfs_inode *);
|
||||
extern void xfs_iflush_abort(struct xfs_inode *);
|
||||
extern void xfs_iflush_shutdown_abort(struct xfs_inode *);
|
||||
extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
|
||||
struct xfs_inode_log_format *);
|
||||
int xfs_inode_item_format_convert(struct kvec *buf,
|
||||
struct xfs_inode_log_format *in_f);
|
||||
|
||||
extern struct kmem_cache *xfs_ili_cache;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ xlog_recover_inode_ra_pass2(
|
|||
struct xlog *log,
|
||||
struct xlog_recover_item *item)
|
||||
{
|
||||
if (item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format)) {
|
||||
struct xfs_inode_log_format *ilfp = item->ri_buf[0].i_addr;
|
||||
if (item->ri_buf[0].iov_len == sizeof(struct xfs_inode_log_format)) {
|
||||
struct xfs_inode_log_format *ilfp = item->ri_buf[0].iov_base;
|
||||
|
||||
xlog_buf_readahead(log, ilfp->ilf_blkno, ilfp->ilf_len,
|
||||
&xfs_inode_buf_ra_ops);
|
||||
} else {
|
||||
struct xfs_inode_log_format_32 *ilfp = item->ri_buf[0].i_addr;
|
||||
struct xfs_inode_log_format_32 *ilfp = item->ri_buf[0].iov_base;
|
||||
|
||||
xlog_buf_readahead(log, ilfp->ilf_blkno, ilfp->ilf_len,
|
||||
&xfs_inode_buf_ra_ops);
|
||||
|
|
@ -326,8 +326,8 @@ xlog_recover_inode_commit_pass2(
|
|||
int need_free = 0;
|
||||
xfs_failaddr_t fa;
|
||||
|
||||
if (item->ri_buf[0].i_len == sizeof(struct xfs_inode_log_format)) {
|
||||
in_f = item->ri_buf[0].i_addr;
|
||||
if (item->ri_buf[0].iov_len == sizeof(struct xfs_inode_log_format)) {
|
||||
in_f = item->ri_buf[0].iov_base;
|
||||
} else {
|
||||
in_f = kmalloc(sizeof(struct xfs_inode_log_format),
|
||||
GFP_KERNEL | __GFP_NOFAIL);
|
||||
|
|
@ -366,7 +366,7 @@ xlog_recover_inode_commit_pass2(
|
|||
error = -EFSCORRUPTED;
|
||||
goto out_release;
|
||||
}
|
||||
ldip = item->ri_buf[1].i_addr;
|
||||
ldip = item->ri_buf[1].iov_base;
|
||||
if (XFS_IS_CORRUPT(mp, ldip->di_magic != XFS_DINODE_MAGIC)) {
|
||||
xfs_alert(mp,
|
||||
"%s: Bad inode log record, rec ptr "PTR_FMT", ino %lld",
|
||||
|
|
@ -472,12 +472,12 @@ xlog_recover_inode_commit_pass2(
|
|||
goto out_release;
|
||||
}
|
||||
isize = xfs_log_dinode_size(mp);
|
||||
if (unlikely(item->ri_buf[1].i_len > isize)) {
|
||||
if (unlikely(item->ri_buf[1].iov_len > isize)) {
|
||||
XFS_CORRUPTION_ERROR("Bad log dinode size", XFS_ERRLEVEL_LOW,
|
||||
mp, ldip, sizeof(*ldip));
|
||||
xfs_alert(mp,
|
||||
"Bad inode 0x%llx log dinode size 0x%x",
|
||||
in_f->ilf_ino, item->ri_buf[1].i_len);
|
||||
"Bad inode 0x%llx log dinode size 0x%zx",
|
||||
in_f->ilf_ino, item->ri_buf[1].iov_len);
|
||||
error = -EFSCORRUPTED;
|
||||
goto out_release;
|
||||
}
|
||||
|
|
@ -500,8 +500,8 @@ xlog_recover_inode_commit_pass2(
|
|||
|
||||
if (in_f->ilf_size == 2)
|
||||
goto out_owner_change;
|
||||
len = item->ri_buf[2].i_len;
|
||||
src = item->ri_buf[2].i_addr;
|
||||
len = item->ri_buf[2].iov_len;
|
||||
src = item->ri_buf[2].iov_base;
|
||||
ASSERT(in_f->ilf_size <= 4);
|
||||
ASSERT((in_f->ilf_size == 3) || (fields & XFS_ILOG_AFORK));
|
||||
ASSERT(!(fields & XFS_ILOG_DFORK) ||
|
||||
|
|
@ -538,8 +538,8 @@ xlog_recover_inode_commit_pass2(
|
|||
} else {
|
||||
attr_index = 2;
|
||||
}
|
||||
len = item->ri_buf[attr_index].i_len;
|
||||
src = item->ri_buf[attr_index].i_addr;
|
||||
len = item->ri_buf[attr_index].iov_len;
|
||||
src = item->ri_buf[attr_index].iov_base;
|
||||
ASSERT(len == xlog_calc_iovec_len(in_f->ilf_asize));
|
||||
|
||||
switch (in_f->ilf_fields & XFS_ILOG_AFORK) {
|
||||
|
|
|
|||
|
|
@ -990,9 +990,8 @@ xfs_ioc_getlabel(
|
|||
BUILD_BUG_ON(sizeof(sbp->sb_fname) > FSLABEL_MAX);
|
||||
|
||||
/* 1 larger than sb_fname, so this ensures a trailing NUL char */
|
||||
memset(label, 0, sizeof(label));
|
||||
spin_lock(&mp->m_sb_lock);
|
||||
strncpy(label, sbp->sb_fname, XFSLABEL_MAX);
|
||||
memtostr_pad(label, sbp->sb_fname);
|
||||
spin_unlock(&mp->m_sb_lock);
|
||||
|
||||
if (copy_to_user(user_label, label, sizeof(label)))
|
||||
|
|
|
|||
|
|
@ -970,7 +970,7 @@ xfs_setattr_size(
|
|||
* change.
|
||||
*/
|
||||
if (xfs_is_zoned_inode(ip)) {
|
||||
error = xfs_zoned_space_reserve(ip, 1,
|
||||
error = xfs_zoned_space_reserve(mp, 1,
|
||||
XFS_ZR_NOWAIT | XFS_ZR_RESERVED, &ac);
|
||||
if (error) {
|
||||
if (error == -EAGAIN)
|
||||
|
|
@ -998,7 +998,7 @@ xfs_setattr_size(
|
|||
}
|
||||
|
||||
if (xfs_is_zoned_inode(ip))
|
||||
xfs_zoned_space_unreserve(ip, &ac);
|
||||
xfs_zoned_space_unreserve(mp, &ac);
|
||||
|
||||
if (error)
|
||||
return error;
|
||||
|
|
|
|||
|
|
@ -239,14 +239,10 @@ xfs_bulkstat_one(
|
|||
* Grab an empty transaction so that we can use its recursive buffer
|
||||
* locking abilities to detect cycles in the inobt without deadlocking.
|
||||
*/
|
||||
error = xfs_trans_alloc_empty(breq->mp, &tp);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
tp = xfs_trans_alloc_empty(breq->mp);
|
||||
error = xfs_bulkstat_one_int(breq->mp, breq->idmap, tp,
|
||||
breq->startino, &bc);
|
||||
xfs_trans_cancel(tp);
|
||||
out:
|
||||
kfree(bc.buf);
|
||||
|
||||
/*
|
||||
|
|
@ -331,17 +327,13 @@ xfs_bulkstat(
|
|||
* Grab an empty transaction so that we can use its recursive buffer
|
||||
* locking abilities to detect cycles in the inobt without deadlocking.
|
||||
*/
|
||||
error = xfs_trans_alloc_empty(breq->mp, &tp);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
tp = xfs_trans_alloc_empty(breq->mp);
|
||||
if (breq->flags & XFS_IBULK_SAME_AG)
|
||||
iwalk_flags |= XFS_IWALK_SAME_AG;
|
||||
|
||||
error = xfs_iwalk(breq->mp, tp, breq->startino, iwalk_flags,
|
||||
xfs_bulkstat_iwalk, breq->icount, &bc);
|
||||
xfs_trans_cancel(tp);
|
||||
out:
|
||||
kfree(bc.buf);
|
||||
|
||||
/*
|
||||
|
|
@ -464,14 +456,10 @@ xfs_inumbers(
|
|||
* Grab an empty transaction so that we can use its recursive buffer
|
||||
* locking abilities to detect cycles in the inobt without deadlocking.
|
||||
*/
|
||||
error = xfs_trans_alloc_empty(breq->mp, &tp);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
tp = xfs_trans_alloc_empty(breq->mp);
|
||||
error = xfs_inobt_walk(breq->mp, tp, breq->startino, breq->flags,
|
||||
xfs_inumbers_walk, breq->icount, &ic);
|
||||
xfs_trans_cancel(tp);
|
||||
out:
|
||||
|
||||
/*
|
||||
* We found some inode groups, so clear the error status and return
|
||||
|
|
|
|||
|
|
@ -377,11 +377,8 @@ xfs_iwalk_run_callbacks(
|
|||
if (!has_more)
|
||||
return 0;
|
||||
|
||||
if (iwag->drop_trans) {
|
||||
error = xfs_trans_alloc_empty(mp, &iwag->tp);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
if (iwag->drop_trans)
|
||||
iwag->tp = xfs_trans_alloc_empty(mp);
|
||||
|
||||
/* ...and recreate the cursor just past where we left off. */
|
||||
error = xfs_ialloc_read_agi(iwag->pag, iwag->tp, 0, agi_bpp);
|
||||
|
|
@ -617,9 +614,7 @@ xfs_iwalk_ag_work(
|
|||
* Grab an empty transaction so that we can use its recursive buffer
|
||||
* locking abilities to detect cycles in the inobt without deadlocking.
|
||||
*/
|
||||
error = xfs_trans_alloc_empty(mp, &iwag->tp);
|
||||
if (error)
|
||||
goto out;
|
||||
iwag->tp = xfs_trans_alloc_empty(mp);
|
||||
iwag->drop_trans = 1;
|
||||
|
||||
error = xfs_iwalk_ag(iwag);
|
||||
|
|
|
|||
|
|
@ -109,14 +109,14 @@ xlog_prepare_iovec(
|
|||
vec = &lv->lv_iovecp[0];
|
||||
}
|
||||
|
||||
len = lv->lv_buf_len + sizeof(struct xlog_op_header);
|
||||
len = lv->lv_buf_used + sizeof(struct xlog_op_header);
|
||||
if (!IS_ALIGNED(len, sizeof(uint64_t))) {
|
||||
lv->lv_buf_len = round_up(len, sizeof(uint64_t)) -
|
||||
lv->lv_buf_used = round_up(len, sizeof(uint64_t)) -
|
||||
sizeof(struct xlog_op_header);
|
||||
}
|
||||
|
||||
vec->i_type = type;
|
||||
vec->i_addr = lv->lv_buf + lv->lv_buf_len;
|
||||
vec->i_addr = lv->lv_buf + lv->lv_buf_used;
|
||||
|
||||
oph = vec->i_addr;
|
||||
oph->oh_clientid = XFS_TRANSACTION;
|
||||
|
|
@ -1931,9 +1931,9 @@ xlog_print_trans(
|
|||
if (!lv)
|
||||
continue;
|
||||
xfs_warn(mp, " niovecs = %d", lv->lv_niovecs);
|
||||
xfs_warn(mp, " size = %d", lv->lv_size);
|
||||
xfs_warn(mp, " alloc_size = %d", lv->lv_alloc_size);
|
||||
xfs_warn(mp, " bytes = %d", lv->lv_bytes);
|
||||
xfs_warn(mp, " buf len = %d", lv->lv_buf_len);
|
||||
xfs_warn(mp, " buf used= %d", lv->lv_buf_used);
|
||||
|
||||
/* dump each iovec for the log item */
|
||||
vec = lv->lv_iovecp;
|
||||
|
|
@ -3092,16 +3092,16 @@ xfs_log_force_seq(
|
|||
*/
|
||||
void
|
||||
xfs_log_ticket_put(
|
||||
xlog_ticket_t *ticket)
|
||||
struct xlog_ticket *ticket)
|
||||
{
|
||||
ASSERT(atomic_read(&ticket->t_ref) > 0);
|
||||
if (atomic_dec_and_test(&ticket->t_ref))
|
||||
kmem_cache_free(xfs_log_ticket_cache, ticket);
|
||||
}
|
||||
|
||||
xlog_ticket_t *
|
||||
struct xlog_ticket *
|
||||
xfs_log_ticket_get(
|
||||
xlog_ticket_t *ticket)
|
||||
struct xlog_ticket *ticket)
|
||||
{
|
||||
ASSERT(atomic_read(&ticket->t_ref) > 0);
|
||||
atomic_inc(&ticket->t_ref);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ struct xfs_log_vec {
|
|||
struct xfs_log_item *lv_item; /* owner */
|
||||
char *lv_buf; /* formatted buffer */
|
||||
int lv_bytes; /* accounted space in buffer */
|
||||
int lv_buf_len; /* aligned size of buffer */
|
||||
int lv_size; /* size of allocated lv */
|
||||
int lv_buf_used; /* buffer space used so far */
|
||||
int lv_alloc_size; /* size of allocated lv */
|
||||
};
|
||||
|
||||
#define XFS_LOG_VEC_ORDERED (-1)
|
||||
|
|
@ -64,12 +64,13 @@ xlog_finish_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec *vec,
|
|||
oph->oh_len = cpu_to_be32(len);
|
||||
|
||||
len += sizeof(struct xlog_op_header);
|
||||
lv->lv_buf_len += len;
|
||||
lv->lv_buf_used += len;
|
||||
lv->lv_bytes += len;
|
||||
vec->i_len = len;
|
||||
|
||||
/* Catch buffer overruns */
|
||||
ASSERT((void *)lv->lv_buf + lv->lv_bytes <= (void *)lv + lv->lv_size);
|
||||
ASSERT((void *)lv->lv_buf + lv->lv_bytes <=
|
||||
(void *)lv + lv->lv_alloc_size);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -87,13 +88,6 @@ xlog_copy_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
|
|||
return buf;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
xlog_copy_from_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
|
||||
const struct xfs_log_iovec *src)
|
||||
{
|
||||
return xlog_copy_iovec(lv, vecp, src->i_type, src->i_addr, src->i_len);
|
||||
}
|
||||
|
||||
/*
|
||||
* By comparing each component, we don't have to worry about extra
|
||||
* endian issues in treating two 32 bit numbers as one 64 bit number
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ xlog_cil_alloc_shadow_bufs(
|
|||
struct xfs_log_vec *lv;
|
||||
int niovecs = 0;
|
||||
int nbytes = 0;
|
||||
int buf_size;
|
||||
int alloc_size;
|
||||
bool ordered = false;
|
||||
|
||||
/* Skip items which aren't dirty in this transaction. */
|
||||
|
|
@ -316,14 +316,14 @@ xlog_cil_alloc_shadow_bufs(
|
|||
* that space to ensure we can align it appropriately and not
|
||||
* overrun the buffer.
|
||||
*/
|
||||
buf_size = nbytes + xlog_cil_iovec_space(niovecs);
|
||||
alloc_size = nbytes + xlog_cil_iovec_space(niovecs);
|
||||
|
||||
/*
|
||||
* if we have no shadow buffer, or it is too small, we need to
|
||||
* reallocate it.
|
||||
*/
|
||||
if (!lip->li_lv_shadow ||
|
||||
buf_size > lip->li_lv_shadow->lv_size) {
|
||||
alloc_size > lip->li_lv_shadow->lv_alloc_size) {
|
||||
/*
|
||||
* We free and allocate here as a realloc would copy
|
||||
* unnecessary data. We don't use kvzalloc() for the
|
||||
|
|
@ -332,15 +332,15 @@ xlog_cil_alloc_shadow_bufs(
|
|||
* storage.
|
||||
*/
|
||||
kvfree(lip->li_lv_shadow);
|
||||
lv = xlog_kvmalloc(buf_size);
|
||||
lv = xlog_kvmalloc(alloc_size);
|
||||
|
||||
memset(lv, 0, xlog_cil_iovec_space(niovecs));
|
||||
|
||||
INIT_LIST_HEAD(&lv->lv_list);
|
||||
lv->lv_item = lip;
|
||||
lv->lv_size = buf_size;
|
||||
lv->lv_alloc_size = alloc_size;
|
||||
if (ordered)
|
||||
lv->lv_buf_len = XFS_LOG_VEC_ORDERED;
|
||||
lv->lv_buf_used = XFS_LOG_VEC_ORDERED;
|
||||
else
|
||||
lv->lv_iovecp = (struct xfs_log_iovec *)&lv[1];
|
||||
lip->li_lv_shadow = lv;
|
||||
|
|
@ -348,9 +348,9 @@ xlog_cil_alloc_shadow_bufs(
|
|||
/* same or smaller, optimise common overwrite case */
|
||||
lv = lip->li_lv_shadow;
|
||||
if (ordered)
|
||||
lv->lv_buf_len = XFS_LOG_VEC_ORDERED;
|
||||
lv->lv_buf_used = XFS_LOG_VEC_ORDERED;
|
||||
else
|
||||
lv->lv_buf_len = 0;
|
||||
lv->lv_buf_used = 0;
|
||||
lv->lv_bytes = 0;
|
||||
}
|
||||
|
||||
|
|
@ -370,30 +370,30 @@ xlog_cil_alloc_shadow_bufs(
|
|||
STATIC void
|
||||
xfs_cil_prepare_item(
|
||||
struct xlog *log,
|
||||
struct xfs_log_item *lip,
|
||||
struct xfs_log_vec *lv,
|
||||
struct xfs_log_vec *old_lv,
|
||||
int *diff_len)
|
||||
{
|
||||
/* Account for the new LV being passed in */
|
||||
if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED)
|
||||
if (lv->lv_buf_used != XFS_LOG_VEC_ORDERED)
|
||||
*diff_len += lv->lv_bytes;
|
||||
|
||||
/*
|
||||
* If there is no old LV, this is the first time we've seen the item in
|
||||
* this CIL context and so we need to pin it. If we are replacing the
|
||||
* old_lv, then remove the space it accounts for and make it the shadow
|
||||
* old lv, then remove the space it accounts for and make it the shadow
|
||||
* buffer for later freeing. In both cases we are now switching to the
|
||||
* shadow buffer, so update the pointer to it appropriately.
|
||||
*/
|
||||
if (!old_lv) {
|
||||
if (!lip->li_lv) {
|
||||
if (lv->lv_item->li_ops->iop_pin)
|
||||
lv->lv_item->li_ops->iop_pin(lv->lv_item);
|
||||
lv->lv_item->li_lv_shadow = NULL;
|
||||
} else if (old_lv != lv) {
|
||||
ASSERT(lv->lv_buf_len != XFS_LOG_VEC_ORDERED);
|
||||
} else if (lip->li_lv != lv) {
|
||||
ASSERT(lv->lv_buf_used != XFS_LOG_VEC_ORDERED);
|
||||
|
||||
*diff_len -= old_lv->lv_bytes;
|
||||
lv->lv_item->li_lv_shadow = old_lv;
|
||||
*diff_len -= lip->li_lv->lv_bytes;
|
||||
lv->lv_item->li_lv_shadow = lip->li_lv;
|
||||
}
|
||||
|
||||
/* attach new log vector to log item */
|
||||
|
|
@ -452,10 +452,8 @@ xlog_cil_insert_format_items(
|
|||
}
|
||||
|
||||
list_for_each_entry(lip, &tp->t_items, li_trans) {
|
||||
struct xfs_log_vec *lv;
|
||||
struct xfs_log_vec *old_lv = NULL;
|
||||
struct xfs_log_vec *shadow;
|
||||
bool ordered = false;
|
||||
struct xfs_log_vec *lv = lip->li_lv;
|
||||
struct xfs_log_vec *shadow = lip->li_lv_shadow;
|
||||
|
||||
/* Skip items which aren't dirty in this transaction. */
|
||||
if (!test_bit(XFS_LI_DIRTY, &lip->li_flags))
|
||||
|
|
@ -465,22 +463,23 @@ xlog_cil_insert_format_items(
|
|||
* The formatting size information is already attached to
|
||||
* the shadow lv on the log item.
|
||||
*/
|
||||
shadow = lip->li_lv_shadow;
|
||||
if (shadow->lv_buf_len == XFS_LOG_VEC_ORDERED)
|
||||
ordered = true;
|
||||
if (shadow->lv_buf_used == XFS_LOG_VEC_ORDERED) {
|
||||
if (!lv) {
|
||||
lv = shadow;
|
||||
lv->lv_item = lip;
|
||||
}
|
||||
ASSERT(shadow->lv_alloc_size == lv->lv_alloc_size);
|
||||
xfs_cil_prepare_item(log, lip, lv, diff_len);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Skip items that do not have any vectors for writing */
|
||||
if (!shadow->lv_niovecs && !ordered)
|
||||
if (!shadow->lv_niovecs)
|
||||
continue;
|
||||
|
||||
/* compare to existing item size */
|
||||
old_lv = lip->li_lv;
|
||||
if (lip->li_lv && shadow->lv_size <= lip->li_lv->lv_size) {
|
||||
if (lv && shadow->lv_alloc_size <= lv->lv_alloc_size) {
|
||||
/* same or smaller, optimise common overwrite case */
|
||||
lv = lip->li_lv;
|
||||
|
||||
if (ordered)
|
||||
goto insert;
|
||||
|
||||
/*
|
||||
* set the item up as though it is a new insertion so
|
||||
|
|
@ -492,7 +491,7 @@ xlog_cil_insert_format_items(
|
|||
lv->lv_niovecs = shadow->lv_niovecs;
|
||||
|
||||
/* reset the lv buffer information for new formatting */
|
||||
lv->lv_buf_len = 0;
|
||||
lv->lv_buf_used = 0;
|
||||
lv->lv_bytes = 0;
|
||||
lv->lv_buf = (char *)lv +
|
||||
xlog_cil_iovec_space(lv->lv_niovecs);
|
||||
|
|
@ -500,17 +499,11 @@ xlog_cil_insert_format_items(
|
|||
/* switch to shadow buffer! */
|
||||
lv = shadow;
|
||||
lv->lv_item = lip;
|
||||
if (ordered) {
|
||||
/* track as an ordered logvec */
|
||||
ASSERT(lip->li_lv == NULL);
|
||||
goto insert;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t)));
|
||||
lip->li_ops->iop_format(lip, lv);
|
||||
insert:
|
||||
xfs_cil_prepare_item(log, lv, old_lv, diff_len);
|
||||
xfs_cil_prepare_item(log, lip, lv, diff_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1245,7 +1238,7 @@ xlog_cil_build_lv_chain(
|
|||
lv->lv_order_id = item->li_order_id;
|
||||
|
||||
/* we don't write ordered log vectors */
|
||||
if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED)
|
||||
if (lv->lv_buf_used != XFS_LOG_VEC_ORDERED)
|
||||
*num_bytes += lv->lv_bytes;
|
||||
*num_iovecs += lv->lv_niovecs;
|
||||
list_add_tail(&lv->lv_list, &ctx->lv_chain);
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ enum xlog_iclog_state {
|
|||
|
||||
#define XLOG_COVER_OPS 5
|
||||
|
||||
typedef struct xlog_ticket {
|
||||
struct xlog_ticket {
|
||||
struct list_head t_queue; /* reserve/write queue */
|
||||
struct task_struct *t_task; /* task that owns this ticket */
|
||||
xlog_tid_t t_tid; /* transaction identifier */
|
||||
|
|
@ -155,7 +155,7 @@ typedef struct xlog_ticket {
|
|||
char t_cnt; /* current unit count */
|
||||
uint8_t t_flags; /* properties of reservation */
|
||||
int t_iclog_hdrs; /* iclog hdrs in t_curr_res */
|
||||
} xlog_ticket_t;
|
||||
};
|
||||
|
||||
/*
|
||||
* - A log record header is 512 bytes. There is plenty of room to grow the
|
||||
|
|
|
|||
|
|
@ -2131,15 +2131,15 @@ xlog_recover_add_to_cont_trans(
|
|||
item = list_entry(trans->r_itemq.prev, struct xlog_recover_item,
|
||||
ri_list);
|
||||
|
||||
old_ptr = item->ri_buf[item->ri_cnt-1].i_addr;
|
||||
old_len = item->ri_buf[item->ri_cnt-1].i_len;
|
||||
old_ptr = item->ri_buf[item->ri_cnt-1].iov_base;
|
||||
old_len = item->ri_buf[item->ri_cnt-1].iov_len;
|
||||
|
||||
ptr = kvrealloc(old_ptr, len + old_len, GFP_KERNEL);
|
||||
if (!ptr)
|
||||
return -ENOMEM;
|
||||
memcpy(&ptr[old_len], dp, len);
|
||||
item->ri_buf[item->ri_cnt-1].i_len += len;
|
||||
item->ri_buf[item->ri_cnt-1].i_addr = ptr;
|
||||
item->ri_buf[item->ri_cnt-1].iov_len += len;
|
||||
item->ri_buf[item->ri_cnt-1].iov_base = ptr;
|
||||
trace_xfs_log_recover_item_add_cont(log, trans, item, 0);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2223,7 +2223,7 @@ xlog_recover_add_to_trans(
|
|||
}
|
||||
|
||||
item->ri_total = in_f->ilf_size;
|
||||
item->ri_buf = kzalloc(item->ri_total * sizeof(xfs_log_iovec_t),
|
||||
item->ri_buf = kcalloc(item->ri_total, sizeof(*item->ri_buf),
|
||||
GFP_KERNEL | __GFP_NOFAIL);
|
||||
}
|
||||
|
||||
|
|
@ -2237,8 +2237,8 @@ xlog_recover_add_to_trans(
|
|||
}
|
||||
|
||||
/* Description region is ri_buf[0] */
|
||||
item->ri_buf[item->ri_cnt].i_addr = ptr;
|
||||
item->ri_buf[item->ri_cnt].i_len = len;
|
||||
item->ri_buf[item->ri_cnt].iov_base = ptr;
|
||||
item->ri_buf[item->ri_cnt].iov_len = len;
|
||||
item->ri_cnt++;
|
||||
trace_xfs_log_recover_item_add(log, trans, item, 0);
|
||||
return 0;
|
||||
|
|
@ -2262,7 +2262,7 @@ xlog_recover_free_trans(
|
|||
/* Free the regions in the item. */
|
||||
list_del(&item->ri_list);
|
||||
for (i = 0; i < item->ri_cnt; i++)
|
||||
kvfree(item->ri_buf[i].i_addr);
|
||||
kvfree(item->ri_buf[i].iov_base);
|
||||
/* Free the item itself */
|
||||
kfree(item->ri_buf);
|
||||
kfree(item);
|
||||
|
|
|
|||
|
|
@ -279,10 +279,7 @@ xfs_dax_notify_dev_failure(
|
|||
kernel_frozen = xfs_dax_notify_failure_freeze(mp) == 0;
|
||||
}
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
start_gno = xfs_fsb_to_gno(mp, start_bno, type);
|
||||
end_gno = xfs_fsb_to_gno(mp, end_bno, type);
|
||||
while ((xg = xfs_group_next_range(mp, xg, start_gno, end_gno, type))) {
|
||||
|
|
@ -353,7 +350,6 @@ xfs_dax_notify_dev_failure(
|
|||
error = -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
out:
|
||||
/* Thaw the fs if it has been frozen before. */
|
||||
if (mf_flags & MF_MEM_PRE_REMOVE)
|
||||
xfs_dax_notify_failure_thaw(mp, kernel_frozen);
|
||||
|
|
|
|||
|
|
@ -660,10 +660,7 @@ xfs_qm_load_metadir_qinos(
|
|||
struct xfs_trans *tp;
|
||||
int error;
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
error = xfs_dqinode_load_parent(tp, &qi->qi_dirip);
|
||||
if (error == -ENOENT) {
|
||||
/* no quota dir directory, but we'll create one later */
|
||||
|
|
@ -1755,10 +1752,7 @@ xfs_qm_qino_load(
|
|||
struct xfs_inode *dp = NULL;
|
||||
int error;
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
if (xfs_has_metadir(mp)) {
|
||||
error = xfs_dqinode_load_parent(tp, &dp);
|
||||
if (error)
|
||||
|
|
|
|||
|
|
@ -717,18 +717,18 @@ xlog_recover_cui_commit_pass2(
|
|||
struct xfs_cui_log_format *cui_formatp;
|
||||
size_t len;
|
||||
|
||||
cui_formatp = item->ri_buf[0].i_addr;
|
||||
cui_formatp = item->ri_buf[0].iov_base;
|
||||
|
||||
if (item->ri_buf[0].i_len < xfs_cui_log_format_sizeof(0)) {
|
||||
if (item->ri_buf[0].iov_len < xfs_cui_log_format_sizeof(0)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
len = xfs_cui_log_format_sizeof(cui_formatp->cui_nextents);
|
||||
if (item->ri_buf[0].i_len != len) {
|
||||
if (item->ri_buf[0].iov_len != len) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -759,18 +759,18 @@ xlog_recover_rtcui_commit_pass2(
|
|||
struct xfs_cui_log_format *cui_formatp;
|
||||
size_t len;
|
||||
|
||||
cui_formatp = item->ri_buf[0].i_addr;
|
||||
cui_formatp = item->ri_buf[0].iov_base;
|
||||
|
||||
if (item->ri_buf[0].i_len < xfs_cui_log_format_sizeof(0)) {
|
||||
if (item->ri_buf[0].iov_len < xfs_cui_log_format_sizeof(0)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
len = xfs_cui_log_format_sizeof(cui_formatp->cui_nextents);
|
||||
if (item->ri_buf[0].i_len != len) {
|
||||
if (item->ri_buf[0].iov_len != len) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -791,7 +791,7 @@ xlog_recover_rtcui_commit_pass2(
|
|||
xfs_lsn_t lsn)
|
||||
{
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -817,10 +817,10 @@ xlog_recover_cud_commit_pass2(
|
|||
{
|
||||
struct xfs_cud_log_format *cud_formatp;
|
||||
|
||||
cud_formatp = item->ri_buf[0].i_addr;
|
||||
if (item->ri_buf[0].i_len != sizeof(struct xfs_cud_log_format)) {
|
||||
cud_formatp = item->ri_buf[0].iov_base;
|
||||
if (item->ri_buf[0].iov_len != sizeof(struct xfs_cud_log_format)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -843,10 +843,10 @@ xlog_recover_rtcud_commit_pass2(
|
|||
{
|
||||
struct xfs_cud_log_format *cud_formatp;
|
||||
|
||||
cud_formatp = item->ri_buf[0].i_addr;
|
||||
if (item->ri_buf[0].i_len != sizeof(struct xfs_cud_log_format)) {
|
||||
cud_formatp = item->ri_buf[0].iov_base;
|
||||
if (item->ri_buf[0].iov_len != sizeof(struct xfs_cud_log_format)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -746,18 +746,18 @@ xlog_recover_rui_commit_pass2(
|
|||
struct xfs_rui_log_format *rui_formatp;
|
||||
size_t len;
|
||||
|
||||
rui_formatp = item->ri_buf[0].i_addr;
|
||||
rui_formatp = item->ri_buf[0].iov_base;
|
||||
|
||||
if (item->ri_buf[0].i_len < xfs_rui_log_format_sizeof(0)) {
|
||||
if (item->ri_buf[0].iov_len < xfs_rui_log_format_sizeof(0)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
len = xfs_rui_log_format_sizeof(rui_formatp->rui_nextents);
|
||||
if (item->ri_buf[0].i_len != len) {
|
||||
if (item->ri_buf[0].iov_len != len) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -788,18 +788,18 @@ xlog_recover_rtrui_commit_pass2(
|
|||
struct xfs_rui_log_format *rui_formatp;
|
||||
size_t len;
|
||||
|
||||
rui_formatp = item->ri_buf[0].i_addr;
|
||||
rui_formatp = item->ri_buf[0].iov_base;
|
||||
|
||||
if (item->ri_buf[0].i_len < xfs_rui_log_format_sizeof(0)) {
|
||||
if (item->ri_buf[0].iov_len < xfs_rui_log_format_sizeof(0)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
len = xfs_rui_log_format_sizeof(rui_formatp->rui_nextents);
|
||||
if (item->ri_buf[0].i_len != len) {
|
||||
if (item->ri_buf[0].iov_len != len) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -820,7 +820,7 @@ xlog_recover_rtrui_commit_pass2(
|
|||
xfs_lsn_t lsn)
|
||||
{
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
item->ri_buf[0].i_addr, item->ri_buf[0].i_len);
|
||||
item->ri_buf[0].iov_base, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -846,10 +846,10 @@ xlog_recover_rud_commit_pass2(
|
|||
{
|
||||
struct xfs_rud_log_format *rud_formatp;
|
||||
|
||||
rud_formatp = item->ri_buf[0].i_addr;
|
||||
if (item->ri_buf[0].i_len != sizeof(struct xfs_rud_log_format)) {
|
||||
rud_formatp = item->ri_buf[0].iov_base;
|
||||
if (item->ri_buf[0].iov_len != sizeof(struct xfs_rud_log_format)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
rud_formatp, item->ri_buf[0].i_len);
|
||||
rud_formatp, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
@ -872,10 +872,10 @@ xlog_recover_rtrud_commit_pass2(
|
|||
{
|
||||
struct xfs_rud_log_format *rud_formatp;
|
||||
|
||||
rud_formatp = item->ri_buf[0].i_addr;
|
||||
if (item->ri_buf[0].i_len != sizeof(struct xfs_rud_log_format)) {
|
||||
rud_formatp = item->ri_buf[0].iov_base;
|
||||
if (item->ri_buf[0].iov_len != sizeof(struct xfs_rud_log_format)) {
|
||||
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
|
||||
rud_formatp, item->ri_buf[0].i_len);
|
||||
rud_formatp, item->ri_buf[0].iov_len);
|
||||
return -EFSCORRUPTED;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -729,9 +729,7 @@ xfs_rtginode_ensure(
|
|||
if (rtg->rtg_inodes[type])
|
||||
return 0;
|
||||
|
||||
error = xfs_trans_alloc_empty(rtg_mount(rtg), &tp);
|
||||
if (error)
|
||||
return error;
|
||||
tp = xfs_trans_alloc_empty(rtg_mount(rtg));
|
||||
error = xfs_rtginode_load(rtg, type, tp);
|
||||
xfs_trans_cancel(tp);
|
||||
|
||||
|
|
@ -1305,9 +1303,7 @@ xfs_growfs_rt_prep_groups(
|
|||
if (!mp->m_rtdirip) {
|
||||
struct xfs_trans *tp;
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
error = xfs_rtginode_load_parent(tp);
|
||||
xfs_trans_cancel(tp);
|
||||
|
||||
|
|
@ -1674,10 +1670,7 @@ xfs_rtmount_inodes(
|
|||
struct xfs_rtgroup *rtg = NULL;
|
||||
int error;
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
if (xfs_has_rtgroups(mp) && mp->m_sb.sb_rgcount > 0) {
|
||||
error = xfs_rtginode_load_parent(tp);
|
||||
if (error)
|
||||
|
|
|
|||
|
|
@ -425,8 +425,8 @@ DECLARE_EVENT_CLASS(xfs_zone_alloc_class,
|
|||
__field(dev_t, dev)
|
||||
__field(xfs_rgnumber_t, rgno)
|
||||
__field(xfs_rgblock_t, used)
|
||||
__field(xfs_rgblock_t, allocated)
|
||||
__field(xfs_rgblock_t, written)
|
||||
__field(xfs_rgblock_t, write_pointer)
|
||||
__field(xfs_rgblock_t, rgbno)
|
||||
__field(xfs_extlen_t, len)
|
||||
),
|
||||
|
|
@ -434,17 +434,17 @@ DECLARE_EVENT_CLASS(xfs_zone_alloc_class,
|
|||
__entry->dev = rtg_mount(oz->oz_rtg)->m_super->s_dev;
|
||||
__entry->rgno = rtg_rgno(oz->oz_rtg);
|
||||
__entry->used = rtg_rmap(oz->oz_rtg)->i_used_blocks;
|
||||
__entry->allocated = oz->oz_allocated;
|
||||
__entry->written = oz->oz_written;
|
||||
__entry->write_pointer = oz->oz_write_pointer;
|
||||
__entry->rgbno = rgbno;
|
||||
__entry->len = len;
|
||||
),
|
||||
TP_printk("dev %d:%d rgno 0x%x used 0x%x written 0x%x wp 0x%x rgbno 0x%x len 0x%x",
|
||||
TP_printk("dev %d:%d rgno 0x%x used 0x%x alloced 0x%x written 0x%x rgbno 0x%x len 0x%x",
|
||||
MAJOR(__entry->dev), MINOR(__entry->dev),
|
||||
__entry->rgno,
|
||||
__entry->used,
|
||||
__entry->allocated,
|
||||
__entry->written,
|
||||
__entry->write_pointer,
|
||||
__entry->rgbno,
|
||||
__entry->len)
|
||||
);
|
||||
|
|
@ -1079,7 +1079,9 @@ DEFINE_INODE_EVENT(xfs_get_acl);
|
|||
#endif
|
||||
DEFINE_INODE_EVENT(xfs_vm_bmap);
|
||||
DEFINE_INODE_EVENT(xfs_file_ioctl);
|
||||
#ifdef CONFIG_COMPAT
|
||||
DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
|
||||
#endif
|
||||
DEFINE_INODE_EVENT(xfs_ioctl_setattr);
|
||||
DEFINE_INODE_EVENT(xfs_dir_fsync);
|
||||
DEFINE_INODE_EVENT(xfs_file_fsync);
|
||||
|
|
@ -1394,7 +1396,6 @@ DEFINE_EVENT(xfs_dquot_class, name, \
|
|||
TP_ARGS(dqp))
|
||||
DEFINE_DQUOT_EVENT(xfs_dqadjust);
|
||||
DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
|
||||
DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
|
||||
DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
|
||||
DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
|
||||
DEFINE_DQUOT_EVENT(xfs_dqattach_found);
|
||||
|
|
@ -1599,7 +1600,6 @@ DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant);
|
|||
DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_sub);
|
||||
DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_exit);
|
||||
DEFINE_LOGGRANT_EVENT(xfs_log_cil_wait);
|
||||
DEFINE_LOGGRANT_EVENT(xfs_log_cil_return);
|
||||
|
||||
DECLARE_EVENT_CLASS(xfs_log_item_class,
|
||||
TP_PROTO(struct xfs_log_item *lip),
|
||||
|
|
@ -1862,8 +1862,6 @@ DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
|
|||
DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
|
||||
DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
|
||||
DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
|
||||
DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
|
||||
DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
|
||||
DEFINE_SIMPLE_IO_EVENT(xfs_file_splice_read);
|
||||
DEFINE_SIMPLE_IO_EVENT(xfs_zoned_map_blocks);
|
||||
|
||||
|
|
@ -1896,31 +1894,6 @@ DEFINE_EVENT(xfs_itrunc_class, name, \
|
|||
DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
|
||||
DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
|
||||
|
||||
TRACE_EVENT(xfs_pagecache_inval,
|
||||
TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
|
||||
TP_ARGS(ip, start, finish),
|
||||
TP_STRUCT__entry(
|
||||
__field(dev_t, dev)
|
||||
__field(xfs_ino_t, ino)
|
||||
__field(xfs_fsize_t, size)
|
||||
__field(xfs_off_t, start)
|
||||
__field(xfs_off_t, finish)
|
||||
),
|
||||
TP_fast_assign(
|
||||
__entry->dev = VFS_I(ip)->i_sb->s_dev;
|
||||
__entry->ino = ip->i_ino;
|
||||
__entry->size = ip->i_disk_size;
|
||||
__entry->start = start;
|
||||
__entry->finish = finish;
|
||||
),
|
||||
TP_printk("dev %d:%d ino 0x%llx disize 0x%llx start 0x%llx finish 0x%llx",
|
||||
MAJOR(__entry->dev), MINOR(__entry->dev),
|
||||
__entry->ino,
|
||||
__entry->size,
|
||||
__entry->start,
|
||||
__entry->finish)
|
||||
);
|
||||
|
||||
TRACE_EVENT(xfs_bunmap,
|
||||
TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t fileoff, xfs_filblks_t len,
|
||||
int flags, unsigned long caller_ip),
|
||||
|
|
@ -2266,14 +2239,12 @@ DEFINE_EVENT(xfs_alloc_class, name, \
|
|||
DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_cur);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_cur_right);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_cur_left);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup_done);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
|
||||
DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
|
||||
|
|
@ -2468,13 +2439,8 @@ DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
|
|||
DEFINE_ATTR_EVENT(xfs_attr_node_addname);
|
||||
DEFINE_ATTR_EVENT(xfs_attr_node_get);
|
||||
DEFINE_ATTR_EVENT(xfs_attr_node_replace);
|
||||
DEFINE_ATTR_EVENT(xfs_attr_node_removename);
|
||||
|
||||
DEFINE_ATTR_EVENT(xfs_attr_fillstate);
|
||||
DEFINE_ATTR_EVENT(xfs_attr_refillstate);
|
||||
|
||||
DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
|
||||
DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
|
||||
|
||||
#define DEFINE_DA_EVENT(name) \
|
||||
DEFINE_EVENT(xfs_da_class, name, \
|
||||
|
|
@ -2892,7 +2858,6 @@ DEFINE_EVENT(xfs_rtdiscard_class, name, \
|
|||
TP_ARGS(mp, rtbno, len))
|
||||
DEFINE_RTDISCARD_EVENT(xfs_discard_rtextent);
|
||||
DEFINE_RTDISCARD_EVENT(xfs_discard_rttoosmall);
|
||||
DEFINE_RTDISCARD_EVENT(xfs_discard_rtrelax);
|
||||
|
||||
DECLARE_EVENT_CLASS(xfs_btree_cur_class,
|
||||
TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
|
||||
|
|
@ -4209,36 +4174,6 @@ DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
|
|||
DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_src);
|
||||
DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_dest);
|
||||
|
||||
/* dedupe tracepoints */
|
||||
DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
|
||||
DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
|
||||
|
||||
/* ioctl tracepoints */
|
||||
TRACE_EVENT(xfs_ioctl_clone,
|
||||
TP_PROTO(struct inode *src, struct inode *dest),
|
||||
TP_ARGS(src, dest),
|
||||
TP_STRUCT__entry(
|
||||
__field(dev_t, dev)
|
||||
__field(unsigned long, src_ino)
|
||||
__field(loff_t, src_isize)
|
||||
__field(unsigned long, dest_ino)
|
||||
__field(loff_t, dest_isize)
|
||||
),
|
||||
TP_fast_assign(
|
||||
__entry->dev = src->i_sb->s_dev;
|
||||
__entry->src_ino = src->i_ino;
|
||||
__entry->src_isize = i_size_read(src);
|
||||
__entry->dest_ino = dest->i_ino;
|
||||
__entry->dest_isize = i_size_read(dest);
|
||||
),
|
||||
TP_printk("dev %d:%d ino 0x%lx isize 0x%llx -> ino 0x%lx isize 0x%llx",
|
||||
MAJOR(__entry->dev), MINOR(__entry->dev),
|
||||
__entry->src_ino,
|
||||
__entry->src_isize,
|
||||
__entry->dest_ino,
|
||||
__entry->dest_isize)
|
||||
);
|
||||
|
||||
/* unshare tracepoints */
|
||||
DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
|
||||
DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
|
||||
|
|
@ -4246,7 +4181,6 @@ DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
|
|||
/* copy on write */
|
||||
DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
|
||||
DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
|
||||
DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
|
||||
DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
|
||||
|
||||
DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
|
||||
|
|
@ -5031,7 +4965,6 @@ DEFINE_ICLOG_EVENT(xlog_iclog_switch);
|
|||
DEFINE_ICLOG_EVENT(xlog_iclog_sync);
|
||||
DEFINE_ICLOG_EVENT(xlog_iclog_syncing);
|
||||
DEFINE_ICLOG_EVENT(xlog_iclog_sync_done);
|
||||
DEFINE_ICLOG_EVENT(xlog_iclog_want_sync);
|
||||
DEFINE_ICLOG_EVENT(xlog_iclog_wait_on);
|
||||
DEFINE_ICLOG_EVENT(xlog_iclog_write);
|
||||
|
||||
|
|
@ -5080,7 +5013,6 @@ DEFINE_DAS_STATE_EVENT(xfs_attr_sf_addname_return);
|
|||
DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return);
|
||||
DEFINE_DAS_STATE_EVENT(xfs_attr_leaf_addname_return);
|
||||
DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return);
|
||||
DEFINE_DAS_STATE_EVENT(xfs_attr_remove_iter_return);
|
||||
DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_alloc);
|
||||
DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return);
|
||||
DEFINE_DAS_STATE_EVENT(xfs_attr_defer_add);
|
||||
|
|
|
|||
|
|
@ -134,18 +134,14 @@ xfs_trans_dup(
|
|||
}
|
||||
|
||||
/*
|
||||
* This is called to reserve free disk blocks and log space for the
|
||||
* given transaction. This must be done before allocating any resources
|
||||
* within the transaction.
|
||||
* This is called to reserve free disk blocks and log space for the given
|
||||
* transaction before allocating any resources within the transaction.
|
||||
*
|
||||
* This will return ENOSPC if there are not enough blocks available.
|
||||
* It will sleep waiting for available log space.
|
||||
* The only valid value for the flags parameter is XFS_RES_LOG_PERM, which
|
||||
* is used by long running transactions. If any one of the reservations
|
||||
* fails then they will all be backed out.
|
||||
*
|
||||
* This does not do quota reservations. That typically is done by the
|
||||
* caller afterwards.
|
||||
* This does not do quota reservations. That typically is done by the caller
|
||||
* afterwards.
|
||||
*/
|
||||
static int
|
||||
xfs_trans_reserve(
|
||||
|
|
@ -158,10 +154,12 @@ xfs_trans_reserve(
|
|||
int error = 0;
|
||||
bool rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0;
|
||||
|
||||
ASSERT(resp->tr_logres > 0);
|
||||
|
||||
/*
|
||||
* Attempt to reserve the needed disk blocks by decrementing
|
||||
* the number needed from the number available. This will
|
||||
* fail if the count would go below zero.
|
||||
* Attempt to reserve the needed disk blocks by decrementing the number
|
||||
* needed from the number available. This will fail if the count would
|
||||
* go below zero.
|
||||
*/
|
||||
if (blocks > 0) {
|
||||
error = xfs_dec_fdblocks(mp, blocks, rsvd);
|
||||
|
|
@ -173,42 +171,20 @@ xfs_trans_reserve(
|
|||
/*
|
||||
* Reserve the log space needed for this transaction.
|
||||
*/
|
||||
if (resp->tr_logres > 0) {
|
||||
bool permanent = false;
|
||||
if (resp->tr_logflags & XFS_TRANS_PERM_LOG_RES)
|
||||
tp->t_flags |= XFS_TRANS_PERM_LOG_RES;
|
||||
error = xfs_log_reserve(mp, resp->tr_logres, resp->tr_logcount,
|
||||
&tp->t_ticket, (tp->t_flags & XFS_TRANS_PERM_LOG_RES));
|
||||
if (error)
|
||||
goto undo_blocks;
|
||||
|
||||
ASSERT(tp->t_log_res == 0 ||
|
||||
tp->t_log_res == resp->tr_logres);
|
||||
ASSERT(tp->t_log_count == 0 ||
|
||||
tp->t_log_count == resp->tr_logcount);
|
||||
|
||||
if (resp->tr_logflags & XFS_TRANS_PERM_LOG_RES) {
|
||||
tp->t_flags |= XFS_TRANS_PERM_LOG_RES;
|
||||
permanent = true;
|
||||
} else {
|
||||
ASSERT(tp->t_ticket == NULL);
|
||||
ASSERT(!(tp->t_flags & XFS_TRANS_PERM_LOG_RES));
|
||||
}
|
||||
|
||||
if (tp->t_ticket != NULL) {
|
||||
ASSERT(resp->tr_logflags & XFS_TRANS_PERM_LOG_RES);
|
||||
error = xfs_log_regrant(mp, tp->t_ticket);
|
||||
} else {
|
||||
error = xfs_log_reserve(mp, resp->tr_logres,
|
||||
resp->tr_logcount,
|
||||
&tp->t_ticket, permanent);
|
||||
}
|
||||
|
||||
if (error)
|
||||
goto undo_blocks;
|
||||
|
||||
tp->t_log_res = resp->tr_logres;
|
||||
tp->t_log_count = resp->tr_logcount;
|
||||
}
|
||||
tp->t_log_res = resp->tr_logres;
|
||||
tp->t_log_count = resp->tr_logcount;
|
||||
|
||||
/*
|
||||
* Attempt to reserve the needed realtime extents by decrementing
|
||||
* the number needed from the number available. This will
|
||||
* fail if the count would go below zero.
|
||||
* Attempt to reserve the needed realtime extents by decrementing the
|
||||
* number needed from the number available. This will fail if the
|
||||
* count would go below zero.
|
||||
*/
|
||||
if (rtextents > 0) {
|
||||
error = xfs_dec_frextents(mp, rtextents);
|
||||
|
|
@ -221,18 +197,11 @@ xfs_trans_reserve(
|
|||
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Error cases jump to one of these labels to undo any
|
||||
* reservations which have already been performed.
|
||||
*/
|
||||
undo_log:
|
||||
if (resp->tr_logres > 0) {
|
||||
xfs_log_ticket_ungrant(mp->m_log, tp->t_ticket);
|
||||
tp->t_ticket = NULL;
|
||||
tp->t_log_res = 0;
|
||||
tp->t_flags &= ~XFS_TRANS_PERM_LOG_RES;
|
||||
}
|
||||
|
||||
xfs_log_ticket_ungrant(mp->m_log, tp->t_ticket);
|
||||
tp->t_ticket = NULL;
|
||||
tp->t_log_res = 0;
|
||||
tp->t_flags &= ~XFS_TRANS_PERM_LOG_RES;
|
||||
undo_blocks:
|
||||
if (blocks > 0) {
|
||||
xfs_add_fdblocks(mp, blocks);
|
||||
|
|
@ -241,6 +210,28 @@ xfs_trans_reserve(
|
|||
return error;
|
||||
}
|
||||
|
||||
static struct xfs_trans *
|
||||
__xfs_trans_alloc(
|
||||
struct xfs_mount *mp,
|
||||
uint flags)
|
||||
{
|
||||
struct xfs_trans *tp;
|
||||
|
||||
ASSERT(!(flags & XFS_TRANS_RES_FDBLKS) || xfs_has_lazysbcount(mp));
|
||||
|
||||
tp = kmem_cache_zalloc(xfs_trans_cache, GFP_KERNEL | __GFP_NOFAIL);
|
||||
if (!(flags & XFS_TRANS_NO_WRITECOUNT))
|
||||
sb_start_intwrite(mp->m_super);
|
||||
xfs_trans_set_context(tp);
|
||||
tp->t_flags = flags;
|
||||
tp->t_mountp = mp;
|
||||
INIT_LIST_HEAD(&tp->t_items);
|
||||
INIT_LIST_HEAD(&tp->t_busy);
|
||||
INIT_LIST_HEAD(&tp->t_dfops);
|
||||
tp->t_highest_agno = NULLAGNUMBER;
|
||||
return tp;
|
||||
}
|
||||
|
||||
int
|
||||
xfs_trans_alloc(
|
||||
struct xfs_mount *mp,
|
||||
|
|
@ -254,33 +245,16 @@ xfs_trans_alloc(
|
|||
bool want_retry = true;
|
||||
int error;
|
||||
|
||||
ASSERT(resp->tr_logres > 0);
|
||||
|
||||
/*
|
||||
* Allocate the handle before we do our freeze accounting and setting up
|
||||
* GFP_NOFS allocation context so that we avoid lockdep false positives
|
||||
* by doing GFP_KERNEL allocations inside sb_start_intwrite().
|
||||
*/
|
||||
retry:
|
||||
tp = kmem_cache_zalloc(xfs_trans_cache, GFP_KERNEL | __GFP_NOFAIL);
|
||||
if (!(flags & XFS_TRANS_NO_WRITECOUNT))
|
||||
sb_start_intwrite(mp->m_super);
|
||||
xfs_trans_set_context(tp);
|
||||
|
||||
/*
|
||||
* Zero-reservation ("empty") transactions can't modify anything, so
|
||||
* they're allowed to run while we're frozen.
|
||||
*/
|
||||
WARN_ON(resp->tr_logres > 0 &&
|
||||
mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);
|
||||
ASSERT(!(flags & XFS_TRANS_RES_FDBLKS) ||
|
||||
xfs_has_lazysbcount(mp));
|
||||
|
||||
tp->t_flags = flags;
|
||||
tp->t_mountp = mp;
|
||||
INIT_LIST_HEAD(&tp->t_items);
|
||||
INIT_LIST_HEAD(&tp->t_busy);
|
||||
INIT_LIST_HEAD(&tp->t_dfops);
|
||||
tp->t_highest_agno = NULLAGNUMBER;
|
||||
|
||||
WARN_ON(mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);
|
||||
tp = __xfs_trans_alloc(mp, flags);
|
||||
error = xfs_trans_reserve(tp, resp, blocks, rtextents);
|
||||
if (error == -ENOSPC && want_retry) {
|
||||
xfs_trans_cancel(tp);
|
||||
|
|
@ -324,14 +298,11 @@ xfs_trans_alloc(
|
|||
* where we can be grabbing buffers at the same time that freeze is trying to
|
||||
* drain the buffer LRU list.
|
||||
*/
|
||||
int
|
||||
struct xfs_trans *
|
||||
xfs_trans_alloc_empty(
|
||||
struct xfs_mount *mp,
|
||||
struct xfs_trans **tpp)
|
||||
struct xfs_mount *mp)
|
||||
{
|
||||
struct xfs_trans_res resv = {0};
|
||||
|
||||
return xfs_trans_alloc(mp, &resv, 0, 0, XFS_TRANS_NO_WRITECOUNT, tpp);
|
||||
return __xfs_trans_alloc(mp, XFS_TRANS_NO_WRITECOUNT);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1026,51 +997,57 @@ xfs_trans_cancel(
|
|||
}
|
||||
|
||||
/*
|
||||
* Roll from one trans in the sequence of PERMANENT transactions to
|
||||
* the next: permanent transactions are only flushed out when
|
||||
* committed with xfs_trans_commit(), but we still want as soon
|
||||
* as possible to let chunks of it go to the log. So we commit the
|
||||
* chunk we've been working on and get a new transaction to continue.
|
||||
* Roll from one trans in the sequence of PERMANENT transactions to the next:
|
||||
* permanent transactions are only flushed out when committed with
|
||||
* xfs_trans_commit(), but we still want as soon as possible to let chunks of it
|
||||
* go to the log. So we commit the chunk we've been working on and get a new
|
||||
* transaction to continue.
|
||||
*/
|
||||
int
|
||||
xfs_trans_roll(
|
||||
struct xfs_trans **tpp)
|
||||
{
|
||||
struct xfs_trans *trans = *tpp;
|
||||
struct xfs_trans_res tres;
|
||||
struct xfs_trans *tp = *tpp;
|
||||
unsigned int log_res = tp->t_log_res;
|
||||
unsigned int log_count = tp->t_log_count;
|
||||
int error;
|
||||
|
||||
trace_xfs_trans_roll(trans, _RET_IP_);
|
||||
trace_xfs_trans_roll(tp, _RET_IP_);
|
||||
|
||||
ASSERT(log_res > 0);
|
||||
|
||||
/*
|
||||
* Copy the critical parameters from one trans to the next.
|
||||
*/
|
||||
tres.tr_logres = trans->t_log_res;
|
||||
tres.tr_logcount = trans->t_log_count;
|
||||
|
||||
*tpp = xfs_trans_dup(trans);
|
||||
*tpp = xfs_trans_dup(tp);
|
||||
|
||||
/*
|
||||
* Commit the current transaction.
|
||||
* If this commit failed, then it'd just unlock those items that
|
||||
* are not marked ihold. That also means that a filesystem shutdown
|
||||
* is in progress. The caller takes the responsibility to cancel
|
||||
* the duplicate transaction that gets returned.
|
||||
*
|
||||
* If this commit failed, then it'd just unlock those items that are not
|
||||
* marked ihold. That also means that a filesystem shutdown is in
|
||||
* progress. The caller takes the responsibility to cancel the
|
||||
* duplicate transaction that gets returned.
|
||||
*/
|
||||
error = __xfs_trans_commit(trans, true);
|
||||
error = __xfs_trans_commit(tp, true);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/*
|
||||
* Reserve space in the log for the next transaction.
|
||||
* This also pushes items in the "AIL", the list of logged items,
|
||||
* out to disk if they are taking up space at the tail of the log
|
||||
* that we want to use. This requires that either nothing be locked
|
||||
* across this call, or that anything that is locked be logged in
|
||||
* the prior and the next transactions.
|
||||
*
|
||||
* This also pushes items in the AIL out to disk if they are taking up
|
||||
* space at the tail of the log that we want to use. This requires that
|
||||
* either nothing be locked across this call, or that anything that is
|
||||
* locked be logged in the prior and the next transactions.
|
||||
*/
|
||||
tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
|
||||
return xfs_trans_reserve(*tpp, &tres, 0, 0);
|
||||
tp = *tpp;
|
||||
error = xfs_log_regrant(tp->t_mountp, tp->t_ticket);
|
||||
if (error)
|
||||
return error;
|
||||
tp->t_log_res = log_res;
|
||||
tp->t_log_count = log_count;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1146,9 +1123,18 @@ xfs_trans_reserve_more(
|
|||
unsigned int blocks,
|
||||
unsigned int rtextents)
|
||||
{
|
||||
struct xfs_trans_res resv = { };
|
||||
bool rsvd = tp->t_flags & XFS_TRANS_RESERVE;
|
||||
|
||||
return xfs_trans_reserve(tp, &resv, blocks, rtextents);
|
||||
if (blocks && xfs_dec_fdblocks(tp->t_mountp, blocks, rsvd))
|
||||
return -ENOSPC;
|
||||
if (rtextents && xfs_dec_frextents(tp->t_mountp, rtextents)) {
|
||||
if (blocks)
|
||||
xfs_add_fdblocks(tp->t_mountp, blocks);
|
||||
return -ENOSPC;
|
||||
}
|
||||
tp->t_blk_res += blocks;
|
||||
tp->t_rtx_res += rtextents;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1163,14 +1149,13 @@ xfs_trans_reserve_more_inode(
|
|||
unsigned int rblocks,
|
||||
bool force_quota)
|
||||
{
|
||||
struct xfs_trans_res resv = { };
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
unsigned int rtx = xfs_extlen_to_rtxlen(mp, rblocks);
|
||||
int error;
|
||||
|
||||
xfs_assert_ilocked(ip, XFS_ILOCK_EXCL);
|
||||
|
||||
error = xfs_trans_reserve(tp, &resv, dblocks, rtx);
|
||||
error = xfs_trans_reserve_more(tp, dblocks, rtx);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ struct xfs_efd_log_item;
|
|||
struct xfs_efi_log_item;
|
||||
struct xfs_inode;
|
||||
struct xfs_item_ops;
|
||||
struct xfs_log_iovec;
|
||||
struct xfs_mount;
|
||||
struct xfs_trans;
|
||||
struct xfs_trans_res;
|
||||
|
|
@ -168,8 +167,7 @@ int xfs_trans_alloc(struct xfs_mount *mp, struct xfs_trans_res *resp,
|
|||
struct xfs_trans **tpp);
|
||||
int xfs_trans_reserve_more(struct xfs_trans *tp,
|
||||
unsigned int blocks, unsigned int rtextents);
|
||||
int xfs_trans_alloc_empty(struct xfs_mount *mp,
|
||||
struct xfs_trans **tpp);
|
||||
struct xfs_trans *xfs_trans_alloc_empty(struct xfs_mount *mp);
|
||||
void xfs_trans_mod_sb(xfs_trans_t *, uint, int64_t);
|
||||
|
||||
int xfs_trans_get_buf_map(struct xfs_trans *tp, struct xfs_buftarg *target,
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ xfs_init_open_zone(
|
|||
spin_lock_init(&oz->oz_alloc_lock);
|
||||
atomic_set(&oz->oz_ref, 1);
|
||||
oz->oz_rtg = rtg;
|
||||
oz->oz_write_pointer = write_pointer;
|
||||
oz->oz_allocated = write_pointer;
|
||||
oz->oz_written = write_pointer;
|
||||
oz->oz_write_hint = write_hint;
|
||||
oz->oz_is_gc = is_gc;
|
||||
|
|
@ -569,7 +569,7 @@ xfs_try_use_zone(
|
|||
struct xfs_open_zone *oz,
|
||||
bool lowspace)
|
||||
{
|
||||
if (oz->oz_write_pointer == rtg_blocks(oz->oz_rtg))
|
||||
if (oz->oz_allocated == rtg_blocks(oz->oz_rtg))
|
||||
return false;
|
||||
if (!lowspace && !xfs_good_hint_match(oz, file_hint))
|
||||
return false;
|
||||
|
|
@ -654,13 +654,6 @@ static inline bool xfs_zoned_pack_tight(struct xfs_inode *ip)
|
|||
!(ip->i_diflags & XFS_DIFLAG_APPEND);
|
||||
}
|
||||
|
||||
/*
|
||||
* Pick a new zone for writes.
|
||||
*
|
||||
* If we aren't using up our budget of open zones just open a new one from the
|
||||
* freelist. Else try to find one that matches the expected data lifetime. If
|
||||
* we don't find one that is good pick any zone that is available.
|
||||
*/
|
||||
static struct xfs_open_zone *
|
||||
xfs_select_zone_nowait(
|
||||
struct xfs_mount *mp,
|
||||
|
|
@ -688,7 +681,8 @@ xfs_select_zone_nowait(
|
|||
goto out_unlock;
|
||||
|
||||
/*
|
||||
* See if we can open a new zone and use that.
|
||||
* See if we can open a new zone and use that so that data for different
|
||||
* files is mixed as little as possible.
|
||||
*/
|
||||
oz = xfs_try_open_zone(mp, write_hint);
|
||||
if (oz)
|
||||
|
|
@ -744,25 +738,25 @@ xfs_zone_alloc_blocks(
|
|||
{
|
||||
struct xfs_rtgroup *rtg = oz->oz_rtg;
|
||||
struct xfs_mount *mp = rtg_mount(rtg);
|
||||
xfs_rgblock_t rgbno;
|
||||
xfs_rgblock_t allocated;
|
||||
|
||||
spin_lock(&oz->oz_alloc_lock);
|
||||
count_fsb = min3(count_fsb, XFS_MAX_BMBT_EXTLEN,
|
||||
(xfs_filblks_t)rtg_blocks(rtg) - oz->oz_write_pointer);
|
||||
(xfs_filblks_t)rtg_blocks(rtg) - oz->oz_allocated);
|
||||
if (!count_fsb) {
|
||||
spin_unlock(&oz->oz_alloc_lock);
|
||||
return 0;
|
||||
}
|
||||
rgbno = oz->oz_write_pointer;
|
||||
oz->oz_write_pointer += count_fsb;
|
||||
allocated = oz->oz_allocated;
|
||||
oz->oz_allocated += count_fsb;
|
||||
spin_unlock(&oz->oz_alloc_lock);
|
||||
|
||||
trace_xfs_zone_alloc_blocks(oz, rgbno, count_fsb);
|
||||
trace_xfs_zone_alloc_blocks(oz, allocated, count_fsb);
|
||||
|
||||
*sector = xfs_gbno_to_daddr(&rtg->rtg_group, 0);
|
||||
*is_seq = bdev_zone_is_seq(mp->m_rtdev_targp->bt_bdev, *sector);
|
||||
if (!*is_seq)
|
||||
*sector += XFS_FSB_TO_BB(mp, rgbno);
|
||||
*sector += XFS_FSB_TO_BB(mp, allocated);
|
||||
return XFS_FSB_TO_B(mp, count_fsb);
|
||||
}
|
||||
|
||||
|
|
@ -983,7 +977,7 @@ xfs_zone_rgbno_is_valid(
|
|||
lockdep_assert_held(&rtg_rmap(rtg)->i_lock);
|
||||
|
||||
if (rtg->rtg_open_zone)
|
||||
return rgbno < rtg->rtg_open_zone->oz_write_pointer;
|
||||
return rgbno < rtg->rtg_open_zone->oz_allocated;
|
||||
return !xa_get_mark(&rtg_mount(rtg)->m_groups[XG_TYPE_RTG].xa,
|
||||
rtg_rgno(rtg), XFS_RTG_FREE);
|
||||
}
|
||||
|
|
@ -1017,7 +1011,7 @@ xfs_init_zone(
|
|||
{
|
||||
struct xfs_mount *mp = rtg_mount(rtg);
|
||||
struct xfs_zone_info *zi = mp->m_zone_info;
|
||||
uint64_t used = rtg_rmap(rtg)->i_used_blocks;
|
||||
uint32_t used = rtg_rmap(rtg)->i_used_blocks;
|
||||
xfs_rgblock_t write_pointer, highest_rgbno;
|
||||
int error;
|
||||
|
||||
|
|
@ -1114,24 +1108,27 @@ xfs_get_zone_info_cb(
|
|||
}
|
||||
|
||||
/*
|
||||
* Calculate the max open zone limit based on the of number of
|
||||
* backing zones available
|
||||
* Calculate the max open zone limit based on the of number of backing zones
|
||||
* available.
|
||||
*/
|
||||
static inline uint32_t
|
||||
xfs_max_open_zones(
|
||||
struct xfs_mount *mp)
|
||||
{
|
||||
unsigned int max_open, max_open_data_zones;
|
||||
|
||||
/*
|
||||
* We need two zones for every open data zone,
|
||||
* one in reserve as we don't reclaim open zones. One data zone
|
||||
* and its spare is included in XFS_MIN_ZONES.
|
||||
* We need two zones for every open data zone, one in reserve as we
|
||||
* don't reclaim open zones. One data zone and its spare is included
|
||||
* in XFS_MIN_ZONES to support at least one user data writer.
|
||||
*/
|
||||
max_open_data_zones = (mp->m_sb.sb_rgcount - XFS_MIN_ZONES) / 2 + 1;
|
||||
max_open = max_open_data_zones + XFS_OPEN_GC_ZONES;
|
||||
|
||||
/*
|
||||
* Cap the max open limit to 1/4 of available space
|
||||
* Cap the max open limit to 1/4 of available space. Without this we'd
|
||||
* run out of easy reclaim targets too quickly and storage devices don't
|
||||
* handle huge numbers of concurrent write streams overly well.
|
||||
*/
|
||||
max_open = min(max_open, mp->m_sb.sb_rgcount / 4);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ struct xfs_zone_alloc_ctx {
|
|||
*/
|
||||
#define XFS_ZR_RESERVED (1U << 2)
|
||||
|
||||
int xfs_zoned_space_reserve(struct xfs_inode *ip, xfs_filblks_t count_fsb,
|
||||
int xfs_zoned_space_reserve(struct xfs_mount *mp, xfs_filblks_t count_fsb,
|
||||
unsigned int flags, struct xfs_zone_alloc_ctx *ac);
|
||||
void xfs_zoned_space_unreserve(struct xfs_inode *ip,
|
||||
void xfs_zoned_space_unreserve(struct xfs_mount *mp,
|
||||
struct xfs_zone_alloc_ctx *ac);
|
||||
void xfs_zoned_add_available(struct xfs_mount *mp, xfs_filblks_t count_fsb);
|
||||
|
||||
|
|
|
|||
|
|
@ -328,10 +328,7 @@ xfs_zone_gc_query(
|
|||
iter->rec_idx = 0;
|
||||
iter->rec_count = 0;
|
||||
|
||||
error = xfs_trans_alloc_empty(mp, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
tp = xfs_trans_alloc_empty(mp);
|
||||
xfs_rtgroup_lock(rtg, XFS_RTGLOCK_RMAP);
|
||||
cur = xfs_rtrmapbt_init_cursor(tp, rtg);
|
||||
error = xfs_rmap_query_range(cur, &ri_low, &ri_high,
|
||||
|
|
@ -533,8 +530,7 @@ xfs_zone_gc_steal_open(
|
|||
|
||||
spin_lock(&zi->zi_open_zones_lock);
|
||||
list_for_each_entry(oz, &zi->zi_open_zones, oz_entry) {
|
||||
if (!found ||
|
||||
oz->oz_write_pointer < found->oz_write_pointer)
|
||||
if (!found || oz->oz_allocated < found->oz_allocated)
|
||||
found = oz;
|
||||
}
|
||||
|
||||
|
|
@ -584,7 +580,7 @@ xfs_zone_gc_ensure_target(
|
|||
{
|
||||
struct xfs_open_zone *oz = mp->m_zone_info->zi_open_gc_zone;
|
||||
|
||||
if (!oz || oz->oz_write_pointer == rtg_blocks(oz->oz_rtg))
|
||||
if (!oz || oz->oz_allocated == rtg_blocks(oz->oz_rtg))
|
||||
return xfs_zone_gc_select_target(mp);
|
||||
return oz;
|
||||
}
|
||||
|
|
@ -605,7 +601,7 @@ xfs_zone_gc_space_available(
|
|||
oz = xfs_zone_gc_ensure_target(data->mp);
|
||||
if (!oz)
|
||||
return false;
|
||||
return oz->oz_write_pointer < rtg_blocks(oz->oz_rtg) &&
|
||||
return oz->oz_allocated < rtg_blocks(oz->oz_rtg) &&
|
||||
xfs_zone_gc_scratch_available(data);
|
||||
}
|
||||
|
||||
|
|
@ -647,7 +643,7 @@ xfs_zone_gc_alloc_blocks(
|
|||
*/
|
||||
spin_lock(&mp->m_sb_lock);
|
||||
*count_fsb = min(*count_fsb,
|
||||
rtg_blocks(oz->oz_rtg) - oz->oz_write_pointer);
|
||||
rtg_blocks(oz->oz_rtg) - oz->oz_allocated);
|
||||
*count_fsb = min3(*count_fsb,
|
||||
mp->m_free[XC_FREE_RTEXTENTS].res_avail,
|
||||
mp->m_free[XC_FREE_RTAVAILABLE].res_avail);
|
||||
|
|
@ -661,8 +657,8 @@ xfs_zone_gc_alloc_blocks(
|
|||
*daddr = xfs_gbno_to_daddr(&oz->oz_rtg->rtg_group, 0);
|
||||
*is_seq = bdev_zone_is_seq(mp->m_rtdev_targp->bt_bdev, *daddr);
|
||||
if (!*is_seq)
|
||||
*daddr += XFS_FSB_TO_BB(mp, oz->oz_write_pointer);
|
||||
oz->oz_write_pointer += *count_fsb;
|
||||
*daddr += XFS_FSB_TO_BB(mp, oz->oz_allocated);
|
||||
oz->oz_allocated += *count_fsb;
|
||||
atomic_inc(&oz->oz_ref);
|
||||
return oz;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ xfs_show_open_zone(
|
|||
{
|
||||
seq_printf(m, "\t zone %d, wp %u, written %u, used %u, hint %s\n",
|
||||
rtg_rgno(oz->oz_rtg),
|
||||
oz->oz_write_pointer, oz->oz_written,
|
||||
oz->oz_allocated, oz->oz_written,
|
||||
rtg_rmap(oz->oz_rtg)->i_used_blocks,
|
||||
xfs_write_hint_to_str(oz->oz_write_hint));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,18 +11,18 @@ struct xfs_open_zone {
|
|||
atomic_t oz_ref;
|
||||
|
||||
/*
|
||||
* oz_write_pointer is the write pointer at which space is handed out
|
||||
* for conventional zones, or simple the count of blocks handed out
|
||||
* so far for sequential write required zones and is protected by
|
||||
* oz_alloc_lock/
|
||||
* oz_allocated is the amount of space already allocated out of the zone
|
||||
* and is protected by oz_alloc_lock.
|
||||
*
|
||||
* For conventional zones it also is the offset of the next write.
|
||||
*/
|
||||
spinlock_t oz_alloc_lock;
|
||||
xfs_rgblock_t oz_write_pointer;
|
||||
xfs_rgblock_t oz_allocated;
|
||||
|
||||
/*
|
||||
* oz_written is the number of blocks for which we've received a
|
||||
* write completion. oz_written must always be <= oz_write_pointer
|
||||
* and is protected by the ILOCK of the rmap inode.
|
||||
* oz_written is the number of blocks for which we've received a write
|
||||
* completion. oz_written must always be <= oz_allocated and is
|
||||
* protected by the ILOCK of the rmap inode.
|
||||
*/
|
||||
xfs_rgblock_t oz_written;
|
||||
|
||||
|
|
|
|||
|
|
@ -117,11 +117,10 @@ xfs_zoned_space_wait_error(
|
|||
|
||||
static int
|
||||
xfs_zoned_reserve_available(
|
||||
struct xfs_inode *ip,
|
||||
struct xfs_mount *mp,
|
||||
xfs_filblks_t count_fsb,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
struct xfs_zone_info *zi = mp->m_zone_info;
|
||||
struct xfs_zone_reservation reservation = {
|
||||
.task = current,
|
||||
|
|
@ -198,11 +197,10 @@ xfs_zoned_reserve_available(
|
|||
*/
|
||||
static int
|
||||
xfs_zoned_reserve_extents_greedy(
|
||||
struct xfs_inode *ip,
|
||||
struct xfs_mount *mp,
|
||||
xfs_filblks_t *count_fsb,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
struct xfs_zone_info *zi = mp->m_zone_info;
|
||||
s64 len = *count_fsb;
|
||||
int error = -ENOSPC;
|
||||
|
|
@ -220,12 +218,11 @@ xfs_zoned_reserve_extents_greedy(
|
|||
|
||||
int
|
||||
xfs_zoned_space_reserve(
|
||||
struct xfs_inode *ip,
|
||||
struct xfs_mount *mp,
|
||||
xfs_filblks_t count_fsb,
|
||||
unsigned int flags,
|
||||
struct xfs_zone_alloc_ctx *ac)
|
||||
{
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
int error;
|
||||
|
||||
ASSERT(ac->reserved_blocks == 0);
|
||||
|
|
@ -234,11 +231,11 @@ xfs_zoned_space_reserve(
|
|||
error = xfs_dec_freecounter(mp, XC_FREE_RTEXTENTS, count_fsb,
|
||||
flags & XFS_ZR_RESERVED);
|
||||
if (error == -ENOSPC && (flags & XFS_ZR_GREEDY) && count_fsb > 1)
|
||||
error = xfs_zoned_reserve_extents_greedy(ip, &count_fsb, flags);
|
||||
error = xfs_zoned_reserve_extents_greedy(mp, &count_fsb, flags);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
error = xfs_zoned_reserve_available(ip, count_fsb, flags);
|
||||
error = xfs_zoned_reserve_available(mp, count_fsb, flags);
|
||||
if (error) {
|
||||
xfs_add_freecounter(mp, XC_FREE_RTEXTENTS, count_fsb);
|
||||
return error;
|
||||
|
|
@ -249,12 +246,10 @@ xfs_zoned_space_reserve(
|
|||
|
||||
void
|
||||
xfs_zoned_space_unreserve(
|
||||
struct xfs_inode *ip,
|
||||
struct xfs_mount *mp,
|
||||
struct xfs_zone_alloc_ctx *ac)
|
||||
{
|
||||
if (ac->reserved_blocks > 0) {
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
|
||||
xfs_zoned_add_available(mp, ac->reserved_blocks);
|
||||
xfs_add_freecounter(mp, XC_FREE_RTEXTENTS, ac->reserved_blocks);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user