diff options
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r-- | fs/gfs2/super.c | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 6a78b1b32e25..43a24f2e5905 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -97,7 +97,7 @@ void gfs2_tune_init(struct gfs2_tune *gt) | |||
97 | * changed. | 97 | * changed. |
98 | */ | 98 | */ |
99 | 99 | ||
100 | int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb *sb, int silent) | 100 | int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb_host *sb, int silent) |
101 | { | 101 | { |
102 | unsigned int x; | 102 | unsigned int x; |
103 | 103 | ||
@@ -180,6 +180,24 @@ static int end_bio_io_page(struct bio *bio, unsigned int bytes_done, int error) | |||
180 | return 0; | 180 | return 0; |
181 | } | 181 | } |
182 | 182 | ||
183 | /** | ||
184 | * gfs2_read_super - Read the gfs2 super block from disk | ||
185 | * @sb: The VFS super block | ||
186 | * @sector: The location of the super block | ||
187 | * | ||
188 | * This uses the bio functions to read the super block from disk | ||
189 | * because we want to be 100% sure that we never read cached data. | ||
190 | * A super block is read twice only during each GFS2 mount and is | ||
191 | * never written to by the filesystem. The first time its read no | ||
192 | * locks are held, and the only details which are looked at are those | ||
193 | * relating to the locking protocol. Once locking is up and working, | ||
194 | * the sb is read again under the lock to establish the location of | ||
195 | * the master directory (contains pointers to journals etc) and the | ||
196 | * root directory. | ||
197 | * | ||
198 | * Returns: A page containing the sb or NULL | ||
199 | */ | ||
200 | |||
183 | struct page *gfs2_read_super(struct super_block *sb, sector_t sector) | 201 | struct page *gfs2_read_super(struct super_block *sb, sector_t sector) |
184 | { | 202 | { |
185 | struct page *page; | 203 | struct page *page; |
@@ -199,7 +217,7 @@ struct page *gfs2_read_super(struct super_block *sb, sector_t sector) | |||
199 | return NULL; | 217 | return NULL; |
200 | } | 218 | } |
201 | 219 | ||
202 | bio->bi_sector = sector; | 220 | bio->bi_sector = sector * (sb->s_blocksize >> 9); |
203 | bio->bi_bdev = sb->s_bdev; | 221 | bio->bi_bdev = sb->s_bdev; |
204 | bio_add_page(bio, page, PAGE_SIZE, 0); | 222 | bio_add_page(bio, page, PAGE_SIZE, 0); |
205 | 223 | ||
@@ -508,7 +526,7 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp) | |||
508 | struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode); | 526 | struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode); |
509 | struct gfs2_glock *j_gl = ip->i_gl; | 527 | struct gfs2_glock *j_gl = ip->i_gl; |
510 | struct gfs2_holder t_gh; | 528 | struct gfs2_holder t_gh; |
511 | struct gfs2_log_header head; | 529 | struct gfs2_log_header_host head; |
512 | int error; | 530 | int error; |
513 | 531 | ||
514 | error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, | 532 | error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, |
@@ -517,7 +535,7 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp) | |||
517 | return error; | 535 | return error; |
518 | 536 | ||
519 | gfs2_meta_cache_flush(ip); | 537 | gfs2_meta_cache_flush(ip); |
520 | j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA); | 538 | j_gl->gl_ops->go_inval(j_gl, DIO_METADATA); |
521 | 539 | ||
522 | error = gfs2_find_jhead(sdp->sd_jdesc, &head); | 540 | error = gfs2_find_jhead(sdp->sd_jdesc, &head); |
523 | if (error) | 541 | if (error) |
@@ -587,9 +605,9 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp) | |||
587 | int gfs2_statfs_init(struct gfs2_sbd *sdp) | 605 | int gfs2_statfs_init(struct gfs2_sbd *sdp) |
588 | { | 606 | { |
589 | struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); | 607 | struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); |
590 | struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master; | 608 | struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master; |
591 | struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode); | 609 | struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode); |
592 | struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; | 610 | struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local; |
593 | struct buffer_head *m_bh, *l_bh; | 611 | struct buffer_head *m_bh, *l_bh; |
594 | struct gfs2_holder gh; | 612 | struct gfs2_holder gh; |
595 | int error; | 613 | int error; |
@@ -634,7 +652,7 @@ void gfs2_statfs_change(struct gfs2_sbd *sdp, s64 total, s64 free, | |||
634 | s64 dinodes) | 652 | s64 dinodes) |
635 | { | 653 | { |
636 | struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode); | 654 | struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode); |
637 | struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; | 655 | struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local; |
638 | struct buffer_head *l_bh; | 656 | struct buffer_head *l_bh; |
639 | int error; | 657 | int error; |
640 | 658 | ||
@@ -660,8 +678,8 @@ int gfs2_statfs_sync(struct gfs2_sbd *sdp) | |||
660 | { | 678 | { |
661 | struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); | 679 | struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); |
662 | struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode); | 680 | struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode); |
663 | struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master; | 681 | struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master; |
664 | struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; | 682 | struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local; |
665 | struct gfs2_holder gh; | 683 | struct gfs2_holder gh; |
666 | struct buffer_head *m_bh, *l_bh; | 684 | struct buffer_head *m_bh, *l_bh; |
667 | int error; | 685 | int error; |
@@ -727,10 +745,10 @@ out: | |||
727 | * Returns: errno | 745 | * Returns: errno |
728 | */ | 746 | */ |
729 | 747 | ||
730 | int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change *sc) | 748 | int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc) |
731 | { | 749 | { |
732 | struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master; | 750 | struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master; |
733 | struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; | 751 | struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local; |
734 | 752 | ||
735 | spin_lock(&sdp->sd_statfs_spin); | 753 | spin_lock(&sdp->sd_statfs_spin); |
736 | 754 | ||
@@ -760,7 +778,7 @@ int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change *sc) | |||
760 | */ | 778 | */ |
761 | 779 | ||
762 | static int statfs_slow_fill(struct gfs2_rgrpd *rgd, | 780 | static int statfs_slow_fill(struct gfs2_rgrpd *rgd, |
763 | struct gfs2_statfs_change *sc) | 781 | struct gfs2_statfs_change_host *sc) |
764 | { | 782 | { |
765 | gfs2_rgrp_verify(rgd); | 783 | gfs2_rgrp_verify(rgd); |
766 | sc->sc_total += rgd->rd_ri.ri_data; | 784 | sc->sc_total += rgd->rd_ri.ri_data; |
@@ -782,7 +800,7 @@ static int statfs_slow_fill(struct gfs2_rgrpd *rgd, | |||
782 | * Returns: errno | 800 | * Returns: errno |
783 | */ | 801 | */ |
784 | 802 | ||
785 | int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change *sc) | 803 | int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc) |
786 | { | 804 | { |
787 | struct gfs2_holder ri_gh; | 805 | struct gfs2_holder ri_gh; |
788 | struct gfs2_rgrpd *rgd_next; | 806 | struct gfs2_rgrpd *rgd_next; |
@@ -792,7 +810,7 @@ int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change *sc) | |||
792 | int done; | 810 | int done; |
793 | int error = 0, err; | 811 | int error = 0, err; |
794 | 812 | ||
795 | memset(sc, 0, sizeof(struct gfs2_statfs_change)); | 813 | memset(sc, 0, sizeof(struct gfs2_statfs_change_host)); |
796 | gha = kcalloc(slots, sizeof(struct gfs2_holder), GFP_KERNEL); | 814 | gha = kcalloc(slots, sizeof(struct gfs2_holder), GFP_KERNEL); |
797 | if (!gha) | 815 | if (!gha) |
798 | return -ENOMEM; | 816 | return -ENOMEM; |
@@ -873,7 +891,7 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp, | |||
873 | struct gfs2_jdesc *jd; | 891 | struct gfs2_jdesc *jd; |
874 | struct lfcc *lfcc; | 892 | struct lfcc *lfcc; |
875 | LIST_HEAD(list); | 893 | LIST_HEAD(list); |
876 | struct gfs2_log_header lh; | 894 | struct gfs2_log_header_host lh; |
877 | int error; | 895 | int error; |
878 | 896 | ||
879 | error = gfs2_jindex_hold(sdp, &ji_gh); | 897 | error = gfs2_jindex_hold(sdp, &ji_gh); |