xfs_ag.c (9b2e5a234c89f097ec36f922763dfa1465dc06f8) xfs_ag.c (d5c88131dbf01a30a222ad82d58e0c21a15f0d8e)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
4 * Copyright (c) 2018 Red Hat, Inc.
5 * All rights reserved.
6 */
7
8#include "xfs.h"

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

255 xfs_agnumber_t agno;
256
257 for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
258 spin_lock(&mp->m_perag_lock);
259 pag = radix_tree_delete(&mp->m_perag_tree, agno);
260 spin_unlock(&mp->m_perag_lock);
261 ASSERT(pag);
262 XFS_IS_CORRUPT(pag->pag_mount, atomic_read(&pag->pag_ref) != 0);
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
4 * Copyright (c) 2018 Red Hat, Inc.
5 * All rights reserved.
6 */
7
8#include "xfs.h"

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

255 xfs_agnumber_t agno;
256
257 for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
258 spin_lock(&mp->m_perag_lock);
259 pag = radix_tree_delete(&mp->m_perag_tree, agno);
260 spin_unlock(&mp->m_perag_lock);
261 ASSERT(pag);
262 XFS_IS_CORRUPT(pag->pag_mount, atomic_read(&pag->pag_ref) != 0);
263 xfs_defer_drain_free(&pag->pag_intents_drain);
263
264 cancel_delayed_work_sync(&pag->pag_blockgc_work);
265 xfs_buf_hash_destroy(pag);
266
267 /* drop the mount's active reference */
268 xfs_perag_rele(pag);
269 XFS_IS_CORRUPT(pag->pag_mount,
270 atomic_read(&pag->pag_active_ref) != 0);

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

380
381#ifdef __KERNEL__
382 /* Place kernel structure only init below this point. */
383 spin_lock_init(&pag->pag_ici_lock);
384 spin_lock_init(&pag->pagb_lock);
385 spin_lock_init(&pag->pag_state_lock);
386 INIT_DELAYED_WORK(&pag->pag_blockgc_work, xfs_blockgc_worker);
387 INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC);
264
265 cancel_delayed_work_sync(&pag->pag_blockgc_work);
266 xfs_buf_hash_destroy(pag);
267
268 /* drop the mount's active reference */
269 xfs_perag_rele(pag);
270 XFS_IS_CORRUPT(pag->pag_mount,
271 atomic_read(&pag->pag_active_ref) != 0);

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

381
382#ifdef __KERNEL__
383 /* Place kernel structure only init below this point. */
384 spin_lock_init(&pag->pag_ici_lock);
385 spin_lock_init(&pag->pagb_lock);
386 spin_lock_init(&pag->pag_state_lock);
387 INIT_DELAYED_WORK(&pag->pag_blockgc_work, xfs_blockgc_worker);
388 INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC);
389 xfs_defer_drain_init(&pag->pag_intents_drain);
388 init_waitqueue_head(&pag->pagb_wait);
389 init_waitqueue_head(&pag->pag_active_wq);
390 pag->pagb_count = 0;
391 pag->pagb_tree = RB_ROOT;
392#endif /* __KERNEL__ */
393
394 error = xfs_buf_hash_init(pag);
395 if (error)

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

416
417 if (maxagi)
418 *maxagi = index;
419
420 mp->m_ag_prealloc_blocks = xfs_prealloc_blocks(mp);
421 return 0;
422
423out_remove_pag:
390 init_waitqueue_head(&pag->pagb_wait);
391 init_waitqueue_head(&pag->pag_active_wq);
392 pag->pagb_count = 0;
393 pag->pagb_tree = RB_ROOT;
394#endif /* __KERNEL__ */
395
396 error = xfs_buf_hash_init(pag);
397 if (error)

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

418
419 if (maxagi)
420 *maxagi = index;
421
422 mp->m_ag_prealloc_blocks = xfs_prealloc_blocks(mp);
423 return 0;
424
425out_remove_pag:
426 xfs_defer_drain_free(&pag->pag_intents_drain);
424 radix_tree_delete(&mp->m_perag_tree, index);
425out_free_pag:
426 kmem_free(pag);
427out_unwind_new_pags:
428 /* unwind any prior newly initialized pags */
429 for (index = first_initialised; index < agcount; index++) {
430 pag = radix_tree_delete(&mp->m_perag_tree, index);
431 if (!pag)
432 break;
433 xfs_buf_hash_destroy(pag);
427 radix_tree_delete(&mp->m_perag_tree, index);
428out_free_pag:
429 kmem_free(pag);
430out_unwind_new_pags:
431 /* unwind any prior newly initialized pags */
432 for (index = first_initialised; index < agcount; index++) {
433 pag = radix_tree_delete(&mp->m_perag_tree, index);
434 if (!pag)
435 break;
436 xfs_buf_hash_destroy(pag);
437 xfs_defer_drain_free(&pag->pag_intents_drain);
434 kmem_free(pag);
435 }
436 return error;
437}
438
439static int
440xfs_get_aghdr_buf(
441 struct xfs_mount *mp,

--- 673 unchanged lines hidden ---
438 kmem_free(pag);
439 }
440 return error;
441}
442
443static int
444xfs_get_aghdr_buf(
445 struct xfs_mount *mp,

--- 673 unchanged lines hidden ---