xfs_alloc.c (adbc76aa0fedcb6da2d1ceb1ce786d1f963afee8) xfs_alloc.c (77a530e6c49d22bd4a221d2f059db24fc30094db)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_format.h"

--- 261 unchanged lines hidden (view full) ---

270 struct xfs_btree_cur *cur,
271 xfs_failaddr_t fa,
272 const struct xfs_alloc_rec_incore *irec)
273{
274 struct xfs_mount *mp = cur->bc_mp;
275
276 xfs_warn(mp,
277 "%sbt record corruption in AG %d detected at %pS!",
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_format.h"

--- 261 unchanged lines hidden (view full) ---

270 struct xfs_btree_cur *cur,
271 xfs_failaddr_t fa,
272 const struct xfs_alloc_rec_incore *irec)
273{
274 struct xfs_mount *mp = cur->bc_mp;
275
276 xfs_warn(mp,
277 "%sbt record corruption in AG %d detected at %pS!",
278 cur->bc_ops->name, pag_agno(cur->bc_ag.pag), fa);
278 cur->bc_ops->name, cur->bc_group->xg_gno, fa);
279 xfs_warn(mp,
280 "start block 0x%x block count 0x%x", irec->ar_startblock,
281 irec->ar_blockcount);
282 xfs_btree_mark_sick(cur);
283 return -EFSCORRUPTED;
284}
285
286/*

--- 11 unchanged lines hidden (view full) ---

298 xfs_failaddr_t fa;
299 int error;
300
301 error = xfs_btree_get_rec(cur, &rec, stat);
302 if (error || !(*stat))
303 return error;
304
305 xfs_alloc_btrec_to_irec(rec, &irec);
279 xfs_warn(mp,
280 "start block 0x%x block count 0x%x", irec->ar_startblock,
281 irec->ar_blockcount);
282 xfs_btree_mark_sick(cur);
283 return -EFSCORRUPTED;
284}
285
286/*

--- 11 unchanged lines hidden (view full) ---

298 xfs_failaddr_t fa;
299 int error;
300
301 error = xfs_btree_get_rec(cur, &rec, stat);
302 if (error || !(*stat))
303 return error;
304
305 xfs_alloc_btrec_to_irec(rec, &irec);
306 fa = xfs_alloc_check_irec(cur->bc_ag.pag, &irec);
306 fa = xfs_alloc_check_irec(to_perag(cur->bc_group), &irec);
307 if (fa)
308 return xfs_alloc_complain_bad_rec(cur, fa, &irec);
309
310 *bno = irec.ar_startblock;
311 *len = irec.ar_blockcount;
312 return 0;
313}
314

--- 220 unchanged lines hidden (view full) ---

535 * Needing to update the longest extent can be determined by calling
536 * xfs_alloc_cursor_at_lastrec() after the cursor is positioned for record
537 * modification but before the modification begins.
538 */
539static int
540xfs_alloc_fixup_longest(
541 struct xfs_btree_cur *cnt_cur)
542{
307 if (fa)
308 return xfs_alloc_complain_bad_rec(cur, fa, &irec);
309
310 *bno = irec.ar_startblock;
311 *len = irec.ar_blockcount;
312 return 0;
313}
314

--- 220 unchanged lines hidden (view full) ---

535 * Needing to update the longest extent can be determined by calling
536 * xfs_alloc_cursor_at_lastrec() after the cursor is positioned for record
537 * modification but before the modification begins.
538 */
539static int
540xfs_alloc_fixup_longest(
541 struct xfs_btree_cur *cnt_cur)
542{
543 struct xfs_perag *pag = cnt_cur->bc_ag.pag;
543 struct xfs_perag *pag = to_perag(cnt_cur->bc_group);
544 struct xfs_buf *bp = cnt_cur->bc_ag.agbp;
545 struct xfs_agf *agf = bp->b_addr;
546 xfs_extlen_t longest = 0;
547 int error;
548
549 /* Lookup last rec in order to update AGF. */
550 error = xfs_cntbt_longest(cnt_cur, &longest);
551 if (error)

--- 3487 unchanged lines hidden (view full) ---

4039 const union xfs_btree_rec *rec,
4040 void *priv)
4041{
4042 struct xfs_alloc_query_range_info *query = priv;
4043 struct xfs_alloc_rec_incore irec;
4044 xfs_failaddr_t fa;
4045
4046 xfs_alloc_btrec_to_irec(rec, &irec);
544 struct xfs_buf *bp = cnt_cur->bc_ag.agbp;
545 struct xfs_agf *agf = bp->b_addr;
546 xfs_extlen_t longest = 0;
547 int error;
548
549 /* Lookup last rec in order to update AGF. */
550 error = xfs_cntbt_longest(cnt_cur, &longest);
551 if (error)

--- 3487 unchanged lines hidden (view full) ---

4039 const union xfs_btree_rec *rec,
4040 void *priv)
4041{
4042 struct xfs_alloc_query_range_info *query = priv;
4043 struct xfs_alloc_rec_incore irec;
4044 xfs_failaddr_t fa;
4045
4046 xfs_alloc_btrec_to_irec(rec, &irec);
4047 fa = xfs_alloc_check_irec(cur->bc_ag.pag, &irec);
4047 fa = xfs_alloc_check_irec(to_perag(cur->bc_group), &irec);
4048 if (fa)
4049 return xfs_alloc_complain_bad_rec(cur, fa, &irec);
4050
4051 return query->fn(cur, &irec, query->priv);
4052}
4053
4054/* Find all free space within a given range of blocks. */
4055int

--- 106 unchanged lines hidden ---
4048 if (fa)
4049 return xfs_alloc_complain_bad_rec(cur, fa, &irec);
4050
4051 return query->fn(cur, &irec, query->priv);
4052}
4053
4054/* Find all free space within a given range of blocks. */
4055int

--- 106 unchanged lines hidden ---