diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/ops_fstype.c | 41 | ||||
-rw-r--r-- | fs/gfs2/super.c | 4 | ||||
-rw-r--r-- | fs/gfs2/super.h | 1 |
3 files changed, 16 insertions, 30 deletions
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index a9aa2edd756f..178b33911843 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -116,7 +116,7 @@ static void init_vfs(struct super_block *sb, unsigned noatime) | |||
116 | 116 | ||
117 | static int init_names(struct gfs2_sbd *sdp, int silent) | 117 | static int init_names(struct gfs2_sbd *sdp, int silent) |
118 | { | 118 | { |
119 | struct gfs2_sb *sb = NULL; | 119 | struct page *page; |
120 | char *proto, *table; | 120 | char *proto, *table; |
121 | int error = 0; | 121 | int error = 0; |
122 | 122 | ||
@@ -126,37 +126,23 @@ static int init_names(struct gfs2_sbd *sdp, int silent) | |||
126 | /* Try to autodetect */ | 126 | /* Try to autodetect */ |
127 | 127 | ||
128 | if (!proto[0] || !table[0]) { | 128 | if (!proto[0] || !table[0]) { |
129 | struct buffer_head *bh; | 129 | struct gfs2_sb *sb; |
130 | bh = sb_getblk(sdp->sd_vfs, | 130 | page = gfs2_read_super(sdp->sd_vfs, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift); |
131 | GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift); | 131 | if (!page) |
132 | lock_buffer(bh); | 132 | return -ENOBUFS; |
133 | clear_buffer_uptodate(bh); | 133 | sb = kmap(page); |
134 | clear_buffer_dirty(bh); | 134 | gfs2_sb_in(&sdp->sd_sb, sb); |
135 | unlock_buffer(bh); | 135 | kunmap(page); |
136 | ll_rw_block(READ, 1, &bh); | 136 | __free_page(page); |
137 | wait_on_buffer(bh); | 137 | |
138 | 138 | error = gfs2_check_sb(sdp, &sdp->sd_sb, silent); | |
139 | if (!buffer_uptodate(bh)) { | ||
140 | brelse(bh); | ||
141 | return -EIO; | ||
142 | } | ||
143 | |||
144 | sb = kmalloc(sizeof(struct gfs2_sb), GFP_KERNEL); | ||
145 | if (!sb) { | ||
146 | brelse(bh); | ||
147 | return -ENOMEM; | ||
148 | } | ||
149 | gfs2_sb_in(sb, bh->b_data); | ||
150 | brelse(bh); | ||
151 | |||
152 | error = gfs2_check_sb(sdp, sb, silent); | ||
153 | if (error) | 139 | if (error) |
154 | goto out; | 140 | goto out; |
155 | 141 | ||
156 | if (!proto[0]) | 142 | if (!proto[0]) |
157 | proto = sb->sb_lockproto; | 143 | proto = sdp->sd_sb.sb_lockproto; |
158 | if (!table[0]) | 144 | if (!table[0]) |
159 | table = sb->sb_locktable; | 145 | table = sdp->sd_sb.sb_locktable; |
160 | } | 146 | } |
161 | 147 | ||
162 | if (!table[0]) | 148 | if (!table[0]) |
@@ -166,7 +152,6 @@ static int init_names(struct gfs2_sbd *sdp, int silent) | |||
166 | snprintf(sdp->sd_table_name, GFS2_FSNAME_LEN, "%s", table); | 152 | snprintf(sdp->sd_table_name, GFS2_FSNAME_LEN, "%s", table); |
167 | 153 | ||
168 | out: | 154 | out: |
169 | kfree(sb); | ||
170 | return error; | 155 | return error; |
171 | } | 156 | } |
172 | 157 | ||
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index f6ce5e4eaf7e..6a78b1b32e25 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -180,7 +180,7 @@ 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 | static struct page *gfs2_read_super(struct super_block *sb, sector_t sector) | 183 | struct page *gfs2_read_super(struct super_block *sb, sector_t sector) |
184 | { | 184 | { |
185 | struct page *page; | 185 | struct page *page; |
186 | struct bio *bio; | 186 | struct bio *bio; |
@@ -205,7 +205,7 @@ static struct page *gfs2_read_super(struct super_block *sb, sector_t sector) | |||
205 | 205 | ||
206 | bio->bi_end_io = end_bio_io_page; | 206 | bio->bi_end_io = end_bio_io_page; |
207 | bio->bi_private = page; | 207 | bio->bi_private = page; |
208 | submit_bio(READ_SYNC, bio); | 208 | submit_bio(READ_SYNC | (1 << BIO_RW_META), bio); |
209 | wait_on_page_locked(page); | 209 | wait_on_page_locked(page); |
210 | bio_put(bio); | 210 | bio_put(bio); |
211 | if (!PageUptodate(page)) { | 211 | if (!PageUptodate(page)) { |
diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h index 5fa5119cfba6..5bb443ae0f59 100644 --- a/fs/gfs2/super.h +++ b/fs/gfs2/super.h | |||
@@ -16,6 +16,7 @@ void gfs2_tune_init(struct gfs2_tune *gt); | |||
16 | 16 | ||
17 | int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb *sb, int silent); | 17 | int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb *sb, int silent); |
18 | int gfs2_read_sb(struct gfs2_sbd *sdp, struct gfs2_glock *gl, int silent); | 18 | int gfs2_read_sb(struct gfs2_sbd *sdp, struct gfs2_glock *gl, int silent); |
19 | struct page *gfs2_read_super(struct super_block *sb, sector_t sector); | ||
19 | 20 | ||
20 | static inline unsigned int gfs2_jindex_size(struct gfs2_sbd *sdp) | 21 | static inline unsigned int gfs2_jindex_size(struct gfs2_sbd *sdp) |
21 | { | 22 | { |