aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS4
-rw-r--r--fs/xfs/libxfs/xfs_ag_resv.c3
-rw-r--r--fs/xfs/libxfs/xfs_refcount_btree.c9
-rw-r--r--fs/xfs/libxfs/xfs_refcount_btree.h3
-rw-r--r--fs/xfs/libxfs/xfs_rmap_btree.c14
-rw-r--r--fs/xfs/libxfs/xfs_rmap_btree.h3
-rw-r--r--fs/xfs/xfs_fsops.c14
-rw-r--r--fs/xfs/xfs_icache.c3
-rw-r--r--fs/xfs/xfs_refcount_item.c3
-rw-r--r--fs/xfs/xfs_sysfs.c4
10 files changed, 42 insertions, 18 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 97d0b689270a..ea11bb03f550 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13534,11 +13534,11 @@ F: arch/x86/xen/*swiotlb*
13534F: drivers/xen/*swiotlb* 13534F: drivers/xen/*swiotlb*
13535 13535
13536XFS FILESYSTEM 13536XFS FILESYSTEM
13537M: Dave Chinner <david@fromorbit.com> 13537M: Darrick J. Wong <darrick.wong@oracle.com>
13538M: linux-xfs@vger.kernel.org 13538M: linux-xfs@vger.kernel.org
13539L: linux-xfs@vger.kernel.org 13539L: linux-xfs@vger.kernel.org
13540W: http://xfs.org/ 13540W: http://xfs.org/
13541T: git git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git 13541T: git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
13542S: Supported 13542S: Supported
13543F: Documentation/filesystems/xfs.txt 13543F: Documentation/filesystems/xfs.txt
13544F: fs/xfs/ 13544F: fs/xfs/
diff --git a/fs/xfs/libxfs/xfs_ag_resv.c b/fs/xfs/libxfs/xfs_ag_resv.c
index e5ebc3770460..d346d42c54d1 100644
--- a/fs/xfs/libxfs/xfs_ag_resv.c
+++ b/fs/xfs/libxfs/xfs_ag_resv.c
@@ -256,6 +256,9 @@ xfs_ag_resv_init(
256 goto out; 256 goto out;
257 } 257 }
258 258
259 ASSERT(xfs_perag_resv(pag, XFS_AG_RESV_METADATA)->ar_reserved +
260 xfs_perag_resv(pag, XFS_AG_RESV_AGFL)->ar_reserved <=
261 pag->pagf_freeblks + pag->pagf_flcount);
259out: 262out:
260 return error; 263 return error;
261} 264}
diff --git a/fs/xfs/libxfs/xfs_refcount_btree.c b/fs/xfs/libxfs/xfs_refcount_btree.c
index 6fb2215f8ff7..50add5272807 100644
--- a/fs/xfs/libxfs/xfs_refcount_btree.c
+++ b/fs/xfs/libxfs/xfs_refcount_btree.c
@@ -409,13 +409,14 @@ xfs_refcountbt_calc_size(
409 */ 409 */
410xfs_extlen_t 410xfs_extlen_t
411xfs_refcountbt_max_size( 411xfs_refcountbt_max_size(
412 struct xfs_mount *mp) 412 struct xfs_mount *mp,
413 xfs_agblock_t agblocks)
413{ 414{
414 /* Bail out if we're uninitialized, which can happen in mkfs. */ 415 /* Bail out if we're uninitialized, which can happen in mkfs. */
415 if (mp->m_refc_mxr[0] == 0) 416 if (mp->m_refc_mxr[0] == 0)
416 return 0; 417 return 0;
417 418
418 return xfs_refcountbt_calc_size(mp, mp->m_sb.sb_agblocks); 419 return xfs_refcountbt_calc_size(mp, agblocks);
419} 420}
420 421
421/* 422/*
@@ -430,22 +431,24 @@ xfs_refcountbt_calc_reserves(
430{ 431{
431 struct xfs_buf *agbp; 432 struct xfs_buf *agbp;
432 struct xfs_agf *agf; 433 struct xfs_agf *agf;
434 xfs_agblock_t agblocks;
433 xfs_extlen_t tree_len; 435 xfs_extlen_t tree_len;
434 int error; 436 int error;
435 437
436 if (!xfs_sb_version_hasreflink(&mp->m_sb)) 438 if (!xfs_sb_version_hasreflink(&mp->m_sb))
437 return 0; 439 return 0;
438 440
439 *ask += xfs_refcountbt_max_size(mp);
440 441
441 error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp); 442 error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
442 if (error) 443 if (error)
443 return error; 444 return error;
444 445
445 agf = XFS_BUF_TO_AGF(agbp); 446 agf = XFS_BUF_TO_AGF(agbp);
447 agblocks = be32_to_cpu(agf->agf_length);
446 tree_len = be32_to_cpu(agf->agf_refcount_blocks); 448 tree_len = be32_to_cpu(agf->agf_refcount_blocks);
447 xfs_buf_relse(agbp); 449 xfs_buf_relse(agbp);
448 450
451 *ask += xfs_refcountbt_max_size(mp, agblocks);
449 *used += tree_len; 452 *used += tree_len;
450 453
451 return error; 454 return error;
diff --git a/fs/xfs/libxfs/xfs_refcount_btree.h b/fs/xfs/libxfs/xfs_refcount_btree.h
index 3be7768bd51a..9db008b955b7 100644
--- a/fs/xfs/libxfs/xfs_refcount_btree.h
+++ b/fs/xfs/libxfs/xfs_refcount_btree.h
@@ -66,7 +66,8 @@ extern void xfs_refcountbt_compute_maxlevels(struct xfs_mount *mp);
66 66
67extern xfs_extlen_t xfs_refcountbt_calc_size(struct xfs_mount *mp, 67extern xfs_extlen_t xfs_refcountbt_calc_size(struct xfs_mount *mp,
68 unsigned long long len); 68 unsigned long long len);
69extern xfs_extlen_t xfs_refcountbt_max_size(struct xfs_mount *mp); 69extern xfs_extlen_t xfs_refcountbt_max_size(struct xfs_mount *mp,
70 xfs_agblock_t agblocks);
70 71
71extern int xfs_refcountbt_calc_reserves(struct xfs_mount *mp, 72extern int xfs_refcountbt_calc_reserves(struct xfs_mount *mp,
72 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used); 73 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used);
diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c
index de25771764ba..74e5a54bc428 100644
--- a/fs/xfs/libxfs/xfs_rmap_btree.c
+++ b/fs/xfs/libxfs/xfs_rmap_btree.c
@@ -550,13 +550,14 @@ xfs_rmapbt_calc_size(
550 */ 550 */
551xfs_extlen_t 551xfs_extlen_t
552xfs_rmapbt_max_size( 552xfs_rmapbt_max_size(
553 struct xfs_mount *mp) 553 struct xfs_mount *mp,
554 xfs_agblock_t agblocks)
554{ 555{
555 /* Bail out if we're uninitialized, which can happen in mkfs. */ 556 /* Bail out if we're uninitialized, which can happen in mkfs. */
556 if (mp->m_rmap_mxr[0] == 0) 557 if (mp->m_rmap_mxr[0] == 0)
557 return 0; 558 return 0;
558 559
559 return xfs_rmapbt_calc_size(mp, mp->m_sb.sb_agblocks); 560 return xfs_rmapbt_calc_size(mp, agblocks);
560} 561}
561 562
562/* 563/*
@@ -571,25 +572,24 @@ xfs_rmapbt_calc_reserves(
571{ 572{
572 struct xfs_buf *agbp; 573 struct xfs_buf *agbp;
573 struct xfs_agf *agf; 574 struct xfs_agf *agf;
574 xfs_extlen_t pool_len; 575 xfs_agblock_t agblocks;
575 xfs_extlen_t tree_len; 576 xfs_extlen_t tree_len;
576 int error; 577 int error;
577 578
578 if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) 579 if (!xfs_sb_version_hasrmapbt(&mp->m_sb))
579 return 0; 580 return 0;
580 581
581 /* Reserve 1% of the AG or enough for 1 block per record. */
582 pool_len = max(mp->m_sb.sb_agblocks / 100, xfs_rmapbt_max_size(mp));
583 *ask += pool_len;
584
585 error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp); 582 error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
586 if (error) 583 if (error)
587 return error; 584 return error;
588 585
589 agf = XFS_BUF_TO_AGF(agbp); 586 agf = XFS_BUF_TO_AGF(agbp);
587 agblocks = be32_to_cpu(agf->agf_length);
590 tree_len = be32_to_cpu(agf->agf_rmap_blocks); 588 tree_len = be32_to_cpu(agf->agf_rmap_blocks);
591 xfs_buf_relse(agbp); 589 xfs_buf_relse(agbp);
592 590
591 /* Reserve 1% of the AG or enough for 1 block per record. */
592 *ask += max(agblocks / 100, xfs_rmapbt_max_size(mp, agblocks));
593 *used += tree_len; 593 *used += tree_len;
594 594
595 return error; 595 return error;
diff --git a/fs/xfs/libxfs/xfs_rmap_btree.h b/fs/xfs/libxfs/xfs_rmap_btree.h
index 2a9ac472fb15..19c08e933049 100644
--- a/fs/xfs/libxfs/xfs_rmap_btree.h
+++ b/fs/xfs/libxfs/xfs_rmap_btree.h
@@ -60,7 +60,8 @@ extern void xfs_rmapbt_compute_maxlevels(struct xfs_mount *mp);
60 60
61extern xfs_extlen_t xfs_rmapbt_calc_size(struct xfs_mount *mp, 61extern xfs_extlen_t xfs_rmapbt_calc_size(struct xfs_mount *mp,
62 unsigned long long len); 62 unsigned long long len);
63extern xfs_extlen_t xfs_rmapbt_max_size(struct xfs_mount *mp); 63extern xfs_extlen_t xfs_rmapbt_max_size(struct xfs_mount *mp,
64 xfs_agblock_t agblocks);
64 65
65extern int xfs_rmapbt_calc_reserves(struct xfs_mount *mp, 66extern int xfs_rmapbt_calc_reserves(struct xfs_mount *mp,
66 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used); 67 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used);
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 93d12fa2670d..242e8091296d 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -631,6 +631,20 @@ xfs_growfs_data_private(
631 xfs_set_low_space_thresholds(mp); 631 xfs_set_low_space_thresholds(mp);
632 mp->m_alloc_set_aside = xfs_alloc_set_aside(mp); 632 mp->m_alloc_set_aside = xfs_alloc_set_aside(mp);
633 633
634 /*
635 * If we expanded the last AG, free the per-AG reservation
636 * so we can reinitialize it with the new size.
637 */
638 if (new) {
639 struct xfs_perag *pag;
640
641 pag = xfs_perag_get(mp, agno);
642 error = xfs_ag_resv_free(pag);
643 xfs_perag_put(pag);
644 if (error)
645 goto out;
646 }
647
634 /* Reserve AG metadata blocks. */ 648 /* Reserve AG metadata blocks. */
635 error = xfs_fs_reserve_ag_blocks(mp); 649 error = xfs_fs_reserve_ag_blocks(mp);
636 if (error && error != -ENOSPC) 650 if (error && error != -ENOSPC)
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index ff4d6311c7f4..70ca4f608321 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -1597,7 +1597,8 @@ xfs_inode_free_cowblocks(
1597 * If the mapping is dirty or under writeback we cannot touch the 1597 * If the mapping is dirty or under writeback we cannot touch the
1598 * CoW fork. Leave it alone if we're in the midst of a directio. 1598 * CoW fork. Leave it alone if we're in the midst of a directio.
1599 */ 1599 */
1600 if (mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY) || 1600 if ((VFS_I(ip)->i_state & I_DIRTY_PAGES) ||
1601 mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY) ||
1601 mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_WRITEBACK) || 1602 mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_WRITEBACK) ||
1602 atomic_read(&VFS_I(ip)->i_dio_count)) 1603 atomic_read(&VFS_I(ip)->i_dio_count))
1603 return 0; 1604 return 0;
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index fe86a668a57e..6e4c7446c3d4 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -526,13 +526,14 @@ xfs_cui_recover(
526 xfs_refcount_finish_one_cleanup(tp, rcur, error); 526 xfs_refcount_finish_one_cleanup(tp, rcur, error);
527 error = xfs_defer_finish(&tp, &dfops, NULL); 527 error = xfs_defer_finish(&tp, &dfops, NULL);
528 if (error) 528 if (error)
529 goto abort_error; 529 goto abort_defer;
530 set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags); 530 set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags);
531 error = xfs_trans_commit(tp); 531 error = xfs_trans_commit(tp);
532 return error; 532 return error;
533 533
534abort_error: 534abort_error:
535 xfs_refcount_finish_one_cleanup(tp, rcur, error); 535 xfs_refcount_finish_one_cleanup(tp, rcur, error);
536abort_defer:
536 xfs_defer_cancel(&dfops); 537 xfs_defer_cancel(&dfops);
537 xfs_trans_cancel(tp); 538 xfs_trans_cancel(tp);
538 return error; 539 return error;
diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
index 276d3023d60f..de6195e38910 100644
--- a/fs/xfs/xfs_sysfs.c
+++ b/fs/xfs/xfs_sysfs.c
@@ -396,7 +396,7 @@ max_retries_show(
396 int retries; 396 int retries;
397 struct xfs_error_cfg *cfg = to_error_cfg(kobject); 397 struct xfs_error_cfg *cfg = to_error_cfg(kobject);
398 398
399 if (cfg->retry_timeout == XFS_ERR_RETRY_FOREVER) 399 if (cfg->max_retries == XFS_ERR_RETRY_FOREVER)
400 retries = -1; 400 retries = -1;
401 else 401 else
402 retries = cfg->max_retries; 402 retries = cfg->max_retries;
@@ -422,7 +422,7 @@ max_retries_store(
422 return -EINVAL; 422 return -EINVAL;
423 423
424 if (val == -1) 424 if (val == -1)
425 cfg->retry_timeout = XFS_ERR_RETRY_FOREVER; 425 cfg->max_retries = XFS_ERR_RETRY_FOREVER;
426 else 426 else
427 cfg->max_retries = val; 427 cfg->max_retries = val;
428 return count; 428 return count;