diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-09-21 20:47:20 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-10-18 16:07:49 -0400 |
commit | 26af655233dd486659235f3049959d2f7dafc5a1 (patch) | |
tree | 590b4976871582d6cad34880705a9a4021e204f5 /fs/xfs/xfs_mount.c | |
parent | ebad861b5702c3e2332a3e906978f47144d22f70 (diff) |
xfs: kill XBF_FS_MANAGED buffers
Filesystem level managed buffers are buffers that have their
lifecycle controlled by the filesystem layer, not the buffer cache.
We currently cache these buffers, which makes cleanup and cache
walking somewhat troublesome. Convert the fs managed buffers to
uncached buffers obtained by via xfs_buf_get_uncached(), and remove
the XBF_FS_MANAGED special cases from the buffer cache.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 55 |
1 files changed, 16 insertions, 39 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 14fc6e9e1816..fbca293326e5 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -646,7 +646,6 @@ int | |||
646 | xfs_readsb(xfs_mount_t *mp, int flags) | 646 | xfs_readsb(xfs_mount_t *mp, int flags) |
647 | { | 647 | { |
648 | unsigned int sector_size; | 648 | unsigned int sector_size; |
649 | unsigned int extra_flags; | ||
650 | xfs_buf_t *bp; | 649 | xfs_buf_t *bp; |
651 | int error; | 650 | int error; |
652 | 651 | ||
@@ -659,28 +658,24 @@ xfs_readsb(xfs_mount_t *mp, int flags) | |||
659 | * access to the superblock. | 658 | * access to the superblock. |
660 | */ | 659 | */ |
661 | sector_size = xfs_getsize_buftarg(mp->m_ddev_targp); | 660 | sector_size = xfs_getsize_buftarg(mp->m_ddev_targp); |
662 | extra_flags = XBF_LOCK | XBF_FS_MANAGED | XBF_MAPPED; | ||
663 | 661 | ||
664 | bp = xfs_buf_read(mp->m_ddev_targp, XFS_SB_DADDR, BTOBB(sector_size), | 662 | reread: |
665 | extra_flags); | 663 | bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp, |
666 | if (!bp || XFS_BUF_ISERROR(bp)) { | 664 | XFS_SB_DADDR, sector_size, 0); |
667 | xfs_fs_mount_cmn_err(flags, "SB read failed"); | 665 | if (!bp) { |
668 | error = bp ? XFS_BUF_GETERROR(bp) : ENOMEM; | 666 | xfs_fs_mount_cmn_err(flags, "SB buffer read failed"); |
669 | goto fail; | 667 | return EIO; |
670 | } | 668 | } |
671 | ASSERT(XFS_BUF_ISBUSY(bp)); | ||
672 | ASSERT(XFS_BUF_VALUSEMA(bp) <= 0); | ||
673 | 669 | ||
674 | /* | 670 | /* |
675 | * Initialize the mount structure from the superblock. | 671 | * Initialize the mount structure from the superblock. |
676 | * But first do some basic consistency checking. | 672 | * But first do some basic consistency checking. |
677 | */ | 673 | */ |
678 | xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp)); | 674 | xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp)); |
679 | |||
680 | error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags); | 675 | error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags); |
681 | if (error) { | 676 | if (error) { |
682 | xfs_fs_mount_cmn_err(flags, "SB validate failed"); | 677 | xfs_fs_mount_cmn_err(flags, "SB validate failed"); |
683 | goto fail; | 678 | goto release_buf; |
684 | } | 679 | } |
685 | 680 | ||
686 | /* | 681 | /* |
@@ -691,7 +686,7 @@ xfs_readsb(xfs_mount_t *mp, int flags) | |||
691 | "device supports only %u byte sectors (not %u)", | 686 | "device supports only %u byte sectors (not %u)", |
692 | sector_size, mp->m_sb.sb_sectsize); | 687 | sector_size, mp->m_sb.sb_sectsize); |
693 | error = ENOSYS; | 688 | error = ENOSYS; |
694 | goto fail; | 689 | goto release_buf; |
695 | } | 690 | } |
696 | 691 | ||
697 | /* | 692 | /* |
@@ -699,33 +694,20 @@ xfs_readsb(xfs_mount_t *mp, int flags) | |||
699 | * re-read the superblock so the buffer is correctly sized. | 694 | * re-read the superblock so the buffer is correctly sized. |
700 | */ | 695 | */ |
701 | if (sector_size < mp->m_sb.sb_sectsize) { | 696 | if (sector_size < mp->m_sb.sb_sectsize) { |
702 | XFS_BUF_UNMANAGE(bp); | ||
703 | xfs_buf_relse(bp); | 697 | xfs_buf_relse(bp); |
704 | sector_size = mp->m_sb.sb_sectsize; | 698 | sector_size = mp->m_sb.sb_sectsize; |
705 | bp = xfs_buf_read(mp->m_ddev_targp, XFS_SB_DADDR, | 699 | goto reread; |
706 | BTOBB(sector_size), extra_flags); | ||
707 | if (!bp || XFS_BUF_ISERROR(bp)) { | ||
708 | xfs_fs_mount_cmn_err(flags, "SB re-read failed"); | ||
709 | error = bp ? XFS_BUF_GETERROR(bp) : ENOMEM; | ||
710 | goto fail; | ||
711 | } | ||
712 | ASSERT(XFS_BUF_ISBUSY(bp)); | ||
713 | ASSERT(XFS_BUF_VALUSEMA(bp) <= 0); | ||
714 | } | 700 | } |
715 | 701 | ||
716 | /* Initialize per-cpu counters */ | 702 | /* Initialize per-cpu counters */ |
717 | xfs_icsb_reinit_counters(mp); | 703 | xfs_icsb_reinit_counters(mp); |
718 | 704 | ||
719 | mp->m_sb_bp = bp; | 705 | mp->m_sb_bp = bp; |
720 | xfs_buf_relse(bp); | 706 | xfs_buf_unlock(bp); |
721 | ASSERT(XFS_BUF_VALUSEMA(bp) > 0); | ||
722 | return 0; | 707 | return 0; |
723 | 708 | ||
724 | fail: | 709 | release_buf: |
725 | if (bp) { | 710 | xfs_buf_relse(bp); |
726 | XFS_BUF_UNMANAGE(bp); | ||
727 | xfs_buf_relse(bp); | ||
728 | } | ||
729 | return error; | 711 | return error; |
730 | } | 712 | } |
731 | 713 | ||
@@ -2005,18 +1987,13 @@ xfs_getsb( | |||
2005 | */ | 1987 | */ |
2006 | void | 1988 | void |
2007 | xfs_freesb( | 1989 | xfs_freesb( |
2008 | xfs_mount_t *mp) | 1990 | struct xfs_mount *mp) |
2009 | { | 1991 | { |
2010 | xfs_buf_t *bp; | 1992 | struct xfs_buf *bp = mp->m_sb_bp; |
2011 | 1993 | ||
2012 | /* | 1994 | xfs_buf_lock(bp); |
2013 | * Use xfs_getsb() so that the buffer will be locked | ||
2014 | * when we call xfs_buf_relse(). | ||
2015 | */ | ||
2016 | bp = xfs_getsb(mp, 0); | ||
2017 | XFS_BUF_UNMANAGE(bp); | ||
2018 | xfs_buf_relse(bp); | ||
2019 | mp->m_sb_bp = NULL; | 1995 | mp->m_sb_bp = NULL; |
1996 | xfs_buf_relse(bp); | ||
2020 | } | 1997 | } |
2021 | 1998 | ||
2022 | /* | 1999 | /* |