diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-08-08 08:45:13 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-08-13 04:59:40 -0400 |
commit | 9b8df98fc8973ad1c5f0d7c4cf71c7fb84fe22c5 (patch) | |
tree | 6a0445afd83d0f7a63a301c2e146647abf59ad82 | |
parent | c1e817d03a7de57a963654c35e6e80af9a5dbff5 (diff) |
GFS2: Fix metafs mounts
This patch is intended to fix the issues reported in bz #457798. Instead
of having the metafs as a separate filesystem, it becomes a second root
of gfs2. As a result it will appear as type gfs2 in /proc/mounts, but it
is still possible (for backwards compatibility purposes) to mount it as
type gfs2meta. A new mount flag "meta" is introduced so that its possible
to tell the two cases apart in /proc/mounts.
As a result it becomes possible to mount type gfs2 with -o meta and
get the same result as mounting type gfs2meta. So it is possible to
mount just the metafs on its own. Currently if you do this, its then
impossible to mount the "normal" root of the gfs2 filesystem without
first unmounting the metafs root. I'm not sure if thats a feature or
a bug :-)
Either way, this is a great improvement on the previous scheme and I've
verified that it works ok with bind mounts on both the "normal" root
and the metafs root in various combinations.
There were also a bunch of functions in super.c which didn't belong there,
so this moves them into ops_fstype.c where they can be static. Hopefully
the mount/umount sequence is now more obvious as a result.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: Alexander Viro <aviro@redhat.com>
-rw-r--r-- | fs/gfs2/incore.h | 7 | ||||
-rw-r--r-- | fs/gfs2/mount.c | 7 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 566 | ||||
-rw-r--r-- | fs/gfs2/ops_super.c | 57 | ||||
-rw-r--r-- | fs/gfs2/super.c | 340 | ||||
-rw-r--r-- | fs/gfs2/super.h | 6 |
6 files changed, 448 insertions, 535 deletions
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 448697a5c462..a1777a1927b3 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -400,6 +400,7 @@ struct gfs2_args { | |||
400 | int ar_quota; /* off/account/on */ | 400 | int ar_quota; /* off/account/on */ |
401 | int ar_suiddir; /* suiddir support */ | 401 | int ar_suiddir; /* suiddir support */ |
402 | int ar_data; /* ordered/writeback */ | 402 | int ar_data; /* ordered/writeback */ |
403 | int ar_meta; /* mount metafs */ | ||
403 | }; | 404 | }; |
404 | 405 | ||
405 | struct gfs2_tune { | 406 | struct gfs2_tune { |
@@ -461,7 +462,6 @@ struct gfs2_sb_host { | |||
461 | 462 | ||
462 | struct gfs2_sbd { | 463 | struct gfs2_sbd { |
463 | struct super_block *sd_vfs; | 464 | struct super_block *sd_vfs; |
464 | struct super_block *sd_vfs_meta; | ||
465 | struct kobject sd_kobj; | 465 | struct kobject sd_kobj; |
466 | unsigned long sd_flags; /* SDF_... */ | 466 | unsigned long sd_flags; /* SDF_... */ |
467 | struct gfs2_sb_host sd_sb; | 467 | struct gfs2_sb_host sd_sb; |
@@ -499,7 +499,9 @@ struct gfs2_sbd { | |||
499 | 499 | ||
500 | /* Inode Stuff */ | 500 | /* Inode Stuff */ |
501 | 501 | ||
502 | struct inode *sd_master_dir; | 502 | struct dentry *sd_master_dir; |
503 | struct dentry *sd_root_dir; | ||
504 | |||
503 | struct inode *sd_jindex; | 505 | struct inode *sd_jindex; |
504 | struct inode *sd_inum_inode; | 506 | struct inode *sd_inum_inode; |
505 | struct inode *sd_statfs_inode; | 507 | struct inode *sd_statfs_inode; |
@@ -634,7 +636,6 @@ struct gfs2_sbd { | |||
634 | /* Debugging crud */ | 636 | /* Debugging crud */ |
635 | 637 | ||
636 | unsigned long sd_last_warning; | 638 | unsigned long sd_last_warning; |
637 | struct vfsmount *sd_gfs2mnt; | ||
638 | struct dentry *debugfs_dir; /* debugfs directory */ | 639 | struct dentry *debugfs_dir; /* debugfs directory */ |
639 | struct dentry *debugfs_dentry_glocks; /* for debugfs */ | 640 | struct dentry *debugfs_dentry_glocks; /* for debugfs */ |
640 | }; | 641 | }; |
diff --git a/fs/gfs2/mount.c b/fs/gfs2/mount.c index b941f9f9f958..df48333e6f01 100644 --- a/fs/gfs2/mount.c +++ b/fs/gfs2/mount.c | |||
@@ -42,6 +42,7 @@ enum { | |||
42 | Opt_nosuiddir, | 42 | Opt_nosuiddir, |
43 | Opt_data_writeback, | 43 | Opt_data_writeback, |
44 | Opt_data_ordered, | 44 | Opt_data_ordered, |
45 | Opt_meta, | ||
45 | Opt_err, | 46 | Opt_err, |
46 | }; | 47 | }; |
47 | 48 | ||
@@ -66,6 +67,7 @@ static match_table_t tokens = { | |||
66 | {Opt_nosuiddir, "nosuiddir"}, | 67 | {Opt_nosuiddir, "nosuiddir"}, |
67 | {Opt_data_writeback, "data=writeback"}, | 68 | {Opt_data_writeback, "data=writeback"}, |
68 | {Opt_data_ordered, "data=ordered"}, | 69 | {Opt_data_ordered, "data=ordered"}, |
70 | {Opt_meta, "meta"}, | ||
69 | {Opt_err, NULL} | 71 | {Opt_err, NULL} |
70 | }; | 72 | }; |
71 | 73 | ||
@@ -239,6 +241,11 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount) | |||
239 | case Opt_data_ordered: | 241 | case Opt_data_ordered: |
240 | args->ar_data = GFS2_DATA_ORDERED; | 242 | args->ar_data = GFS2_DATA_ORDERED; |
241 | break; | 243 | break; |
244 | case Opt_meta: | ||
245 | if (remount && args->ar_meta != 1) | ||
246 | goto cant_remount; | ||
247 | args->ar_meta = 1; | ||
248 | break; | ||
242 | case Opt_err: | 249 | case Opt_err: |
243 | default: | 250 | default: |
244 | fs_info(sdp, "unknown option: %s\n", o); | 251 | fs_info(sdp, "unknown option: %s\n", o); |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index b4d1d6490633..a6225cce2cbc 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -40,6 +40,45 @@ | |||
40 | #define DO 0 | 40 | #define DO 0 |
41 | #define UNDO 1 | 41 | #define UNDO 1 |
42 | 42 | ||
43 | static const u32 gfs2_old_fs_formats[] = { | ||
44 | 0 | ||
45 | }; | ||
46 | |||
47 | static const u32 gfs2_old_multihost_formats[] = { | ||
48 | 0 | ||
49 | }; | ||
50 | |||
51 | /** | ||
52 | * gfs2_tune_init - Fill a gfs2_tune structure with default values | ||
53 | * @gt: tune | ||
54 | * | ||
55 | */ | ||
56 | |||
57 | static void gfs2_tune_init(struct gfs2_tune *gt) | ||
58 | { | ||
59 | spin_lock_init(>->gt_spin); | ||
60 | |||
61 | gt->gt_demote_secs = 300; | ||
62 | gt->gt_incore_log_blocks = 1024; | ||
63 | gt->gt_log_flush_secs = 60; | ||
64 | gt->gt_recoverd_secs = 60; | ||
65 | gt->gt_logd_secs = 1; | ||
66 | gt->gt_quotad_secs = 5; | ||
67 | gt->gt_quota_simul_sync = 64; | ||
68 | gt->gt_quota_warn_period = 10; | ||
69 | gt->gt_quota_scale_num = 1; | ||
70 | gt->gt_quota_scale_den = 1; | ||
71 | gt->gt_quota_cache_secs = 300; | ||
72 | gt->gt_quota_quantum = 60; | ||
73 | gt->gt_atime_quantum = 3600; | ||
74 | gt->gt_new_files_jdata = 0; | ||
75 | gt->gt_max_readahead = 1 << 18; | ||
76 | gt->gt_stall_secs = 600; | ||
77 | gt->gt_complain_secs = 10; | ||
78 | gt->gt_statfs_quantum = 30; | ||
79 | gt->gt_statfs_slow = 0; | ||
80 | } | ||
81 | |||
43 | static struct gfs2_sbd *init_sbd(struct super_block *sb) | 82 | static struct gfs2_sbd *init_sbd(struct super_block *sb) |
44 | { | 83 | { |
45 | struct gfs2_sbd *sdp; | 84 | struct gfs2_sbd *sdp; |
@@ -113,6 +152,272 @@ static void init_vfs(struct super_block *sb, unsigned noatime) | |||
113 | sb->s_flags |= MS_NOATIME | MS_NODIRATIME; | 152 | sb->s_flags |= MS_NOATIME | MS_NODIRATIME; |
114 | } | 153 | } |
115 | 154 | ||
155 | /** | ||
156 | * gfs2_check_sb - Check superblock | ||
157 | * @sdp: the filesystem | ||
158 | * @sb: The superblock | ||
159 | * @silent: Don't print a message if the check fails | ||
160 | * | ||
161 | * Checks the version code of the FS is one that we understand how to | ||
162 | * read and that the sizes of the various on-disk structures have not | ||
163 | * changed. | ||
164 | */ | ||
165 | |||
166 | static int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb_host *sb, int silent) | ||
167 | { | ||
168 | unsigned int x; | ||
169 | |||
170 | if (sb->sb_magic != GFS2_MAGIC || | ||
171 | sb->sb_type != GFS2_METATYPE_SB) { | ||
172 | if (!silent) | ||
173 | printk(KERN_WARNING "GFS2: not a GFS2 filesystem\n"); | ||
174 | return -EINVAL; | ||
175 | } | ||
176 | |||
177 | /* If format numbers match exactly, we're done. */ | ||
178 | |||
179 | if (sb->sb_fs_format == GFS2_FORMAT_FS && | ||
180 | sb->sb_multihost_format == GFS2_FORMAT_MULTI) | ||
181 | return 0; | ||
182 | |||
183 | if (sb->sb_fs_format != GFS2_FORMAT_FS) { | ||
184 | for (x = 0; gfs2_old_fs_formats[x]; x++) | ||
185 | if (gfs2_old_fs_formats[x] == sb->sb_fs_format) | ||
186 | break; | ||
187 | |||
188 | if (!gfs2_old_fs_formats[x]) { | ||
189 | printk(KERN_WARNING | ||
190 | "GFS2: code version (%u, %u) is incompatible " | ||
191 | "with ondisk format (%u, %u)\n", | ||
192 | GFS2_FORMAT_FS, GFS2_FORMAT_MULTI, | ||
193 | sb->sb_fs_format, sb->sb_multihost_format); | ||
194 | printk(KERN_WARNING | ||
195 | "GFS2: I don't know how to upgrade this FS\n"); | ||
196 | return -EINVAL; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | if (sb->sb_multihost_format != GFS2_FORMAT_MULTI) { | ||
201 | for (x = 0; gfs2_old_multihost_formats[x]; x++) | ||
202 | if (gfs2_old_multihost_formats[x] == | ||
203 | sb->sb_multihost_format) | ||
204 | break; | ||
205 | |||
206 | if (!gfs2_old_multihost_formats[x]) { | ||
207 | printk(KERN_WARNING | ||
208 | "GFS2: code version (%u, %u) is incompatible " | ||
209 | "with ondisk format (%u, %u)\n", | ||
210 | GFS2_FORMAT_FS, GFS2_FORMAT_MULTI, | ||
211 | sb->sb_fs_format, sb->sb_multihost_format); | ||
212 | printk(KERN_WARNING | ||
213 | "GFS2: I don't know how to upgrade this FS\n"); | ||
214 | return -EINVAL; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | if (!sdp->sd_args.ar_upgrade) { | ||
219 | printk(KERN_WARNING | ||
220 | "GFS2: code version (%u, %u) is incompatible " | ||
221 | "with ondisk format (%u, %u)\n", | ||
222 | GFS2_FORMAT_FS, GFS2_FORMAT_MULTI, | ||
223 | sb->sb_fs_format, sb->sb_multihost_format); | ||
224 | printk(KERN_INFO | ||
225 | "GFS2: Use the \"upgrade\" mount option to upgrade " | ||
226 | "the FS\n"); | ||
227 | printk(KERN_INFO "GFS2: See the manual for more details\n"); | ||
228 | return -EINVAL; | ||
229 | } | ||
230 | |||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static void end_bio_io_page(struct bio *bio, int error) | ||
235 | { | ||
236 | struct page *page = bio->bi_private; | ||
237 | |||
238 | if (!error) | ||
239 | SetPageUptodate(page); | ||
240 | else | ||
241 | printk(KERN_WARNING "gfs2: error %d reading superblock\n", error); | ||
242 | unlock_page(page); | ||
243 | } | ||
244 | |||
245 | static void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf) | ||
246 | { | ||
247 | const struct gfs2_sb *str = buf; | ||
248 | |||
249 | sb->sb_magic = be32_to_cpu(str->sb_header.mh_magic); | ||
250 | sb->sb_type = be32_to_cpu(str->sb_header.mh_type); | ||
251 | sb->sb_format = be32_to_cpu(str->sb_header.mh_format); | ||
252 | sb->sb_fs_format = be32_to_cpu(str->sb_fs_format); | ||
253 | sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format); | ||
254 | sb->sb_bsize = be32_to_cpu(str->sb_bsize); | ||
255 | sb->sb_bsize_shift = be32_to_cpu(str->sb_bsize_shift); | ||
256 | sb->sb_master_dir.no_addr = be64_to_cpu(str->sb_master_dir.no_addr); | ||
257 | sb->sb_master_dir.no_formal_ino = be64_to_cpu(str->sb_master_dir.no_formal_ino); | ||
258 | sb->sb_root_dir.no_addr = be64_to_cpu(str->sb_root_dir.no_addr); | ||
259 | sb->sb_root_dir.no_formal_ino = be64_to_cpu(str->sb_root_dir.no_formal_ino); | ||
260 | |||
261 | memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN); | ||
262 | memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN); | ||
263 | } | ||
264 | |||
265 | /** | ||
266 | * gfs2_read_super - Read the gfs2 super block from disk | ||
267 | * @sdp: The GFS2 super block | ||
268 | * @sector: The location of the super block | ||
269 | * @error: The error code to return | ||
270 | * | ||
271 | * This uses the bio functions to read the super block from disk | ||
272 | * because we want to be 100% sure that we never read cached data. | ||
273 | * A super block is read twice only during each GFS2 mount and is | ||
274 | * never written to by the filesystem. The first time its read no | ||
275 | * locks are held, and the only details which are looked at are those | ||
276 | * relating to the locking protocol. Once locking is up and working, | ||
277 | * the sb is read again under the lock to establish the location of | ||
278 | * the master directory (contains pointers to journals etc) and the | ||
279 | * root directory. | ||
280 | * | ||
281 | * Returns: 0 on success or error | ||
282 | */ | ||
283 | |||
284 | static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector) | ||
285 | { | ||
286 | struct super_block *sb = sdp->sd_vfs; | ||
287 | struct gfs2_sb *p; | ||
288 | struct page *page; | ||
289 | struct bio *bio; | ||
290 | |||
291 | page = alloc_page(GFP_NOFS); | ||
292 | if (unlikely(!page)) | ||
293 | return -ENOBUFS; | ||
294 | |||
295 | ClearPageUptodate(page); | ||
296 | ClearPageDirty(page); | ||
297 | lock_page(page); | ||
298 | |||
299 | bio = bio_alloc(GFP_NOFS, 1); | ||
300 | if (unlikely(!bio)) { | ||
301 | __free_page(page); | ||
302 | return -ENOBUFS; | ||
303 | } | ||
304 | |||
305 | bio->bi_sector = sector * (sb->s_blocksize >> 9); | ||
306 | bio->bi_bdev = sb->s_bdev; | ||
307 | bio_add_page(bio, page, PAGE_SIZE, 0); | ||
308 | |||
309 | bio->bi_end_io = end_bio_io_page; | ||
310 | bio->bi_private = page; | ||
311 | submit_bio(READ_SYNC | (1 << BIO_RW_META), bio); | ||
312 | wait_on_page_locked(page); | ||
313 | bio_put(bio); | ||
314 | if (!PageUptodate(page)) { | ||
315 | __free_page(page); | ||
316 | return -EIO; | ||
317 | } | ||
318 | p = kmap(page); | ||
319 | gfs2_sb_in(&sdp->sd_sb, p); | ||
320 | kunmap(page); | ||
321 | __free_page(page); | ||
322 | return 0; | ||
323 | } | ||
324 | /** | ||
325 | * gfs2_read_sb - Read super block | ||
326 | * @sdp: The GFS2 superblock | ||
327 | * @gl: the glock for the superblock (assumed to be held) | ||
328 | * @silent: Don't print message if mount fails | ||
329 | * | ||
330 | */ | ||
331 | |||
332 | static int gfs2_read_sb(struct gfs2_sbd *sdp, struct gfs2_glock *gl, int silent) | ||
333 | { | ||
334 | u32 hash_blocks, ind_blocks, leaf_blocks; | ||
335 | u32 tmp_blocks; | ||
336 | unsigned int x; | ||
337 | int error; | ||
338 | |||
339 | error = gfs2_read_super(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift); | ||
340 | if (error) { | ||
341 | if (!silent) | ||
342 | fs_err(sdp, "can't read superblock\n"); | ||
343 | return error; | ||
344 | } | ||
345 | |||
346 | error = gfs2_check_sb(sdp, &sdp->sd_sb, silent); | ||
347 | if (error) | ||
348 | return error; | ||
349 | |||
350 | sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - | ||
351 | GFS2_BASIC_BLOCK_SHIFT; | ||
352 | sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift; | ||
353 | sdp->sd_diptrs = (sdp->sd_sb.sb_bsize - | ||
354 | sizeof(struct gfs2_dinode)) / sizeof(u64); | ||
355 | sdp->sd_inptrs = (sdp->sd_sb.sb_bsize - | ||
356 | sizeof(struct gfs2_meta_header)) / sizeof(u64); | ||
357 | sdp->sd_jbsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header); | ||
358 | sdp->sd_hash_bsize = sdp->sd_sb.sb_bsize / 2; | ||
359 | sdp->sd_hash_bsize_shift = sdp->sd_sb.sb_bsize_shift - 1; | ||
360 | sdp->sd_hash_ptrs = sdp->sd_hash_bsize / sizeof(u64); | ||
361 | sdp->sd_qc_per_block = (sdp->sd_sb.sb_bsize - | ||
362 | sizeof(struct gfs2_meta_header)) / | ||
363 | sizeof(struct gfs2_quota_change); | ||
364 | |||
365 | /* Compute maximum reservation required to add a entry to a directory */ | ||
366 | |||
367 | hash_blocks = DIV_ROUND_UP(sizeof(u64) * (1 << GFS2_DIR_MAX_DEPTH), | ||
368 | sdp->sd_jbsize); | ||
369 | |||
370 | ind_blocks = 0; | ||
371 | for (tmp_blocks = hash_blocks; tmp_blocks > sdp->sd_diptrs;) { | ||
372 | tmp_blocks = DIV_ROUND_UP(tmp_blocks, sdp->sd_inptrs); | ||
373 | ind_blocks += tmp_blocks; | ||
374 | } | ||
375 | |||
376 | leaf_blocks = 2 + GFS2_DIR_MAX_DEPTH; | ||
377 | |||
378 | sdp->sd_max_dirres = hash_blocks + ind_blocks + leaf_blocks; | ||
379 | |||
380 | sdp->sd_heightsize[0] = sdp->sd_sb.sb_bsize - | ||
381 | sizeof(struct gfs2_dinode); | ||
382 | sdp->sd_heightsize[1] = sdp->sd_sb.sb_bsize * sdp->sd_diptrs; | ||
383 | for (x = 2;; x++) { | ||
384 | u64 space, d; | ||
385 | u32 m; | ||
386 | |||
387 | space = sdp->sd_heightsize[x - 1] * sdp->sd_inptrs; | ||
388 | d = space; | ||
389 | m = do_div(d, sdp->sd_inptrs); | ||
390 | |||
391 | if (d != sdp->sd_heightsize[x - 1] || m) | ||
392 | break; | ||
393 | sdp->sd_heightsize[x] = space; | ||
394 | } | ||
395 | sdp->sd_max_height = x; | ||
396 | sdp->sd_heightsize[x] = ~0; | ||
397 | gfs2_assert(sdp, sdp->sd_max_height <= GFS2_MAX_META_HEIGHT); | ||
398 | |||
399 | sdp->sd_jheightsize[0] = sdp->sd_sb.sb_bsize - | ||
400 | sizeof(struct gfs2_dinode); | ||
401 | sdp->sd_jheightsize[1] = sdp->sd_jbsize * sdp->sd_diptrs; | ||
402 | for (x = 2;; x++) { | ||
403 | u64 space, d; | ||
404 | u32 m; | ||
405 | |||
406 | space = sdp->sd_jheightsize[x - 1] * sdp->sd_inptrs; | ||
407 | d = space; | ||
408 | m = do_div(d, sdp->sd_inptrs); | ||
409 | |||
410 | if (d != sdp->sd_jheightsize[x - 1] || m) | ||
411 | break; | ||
412 | sdp->sd_jheightsize[x] = space; | ||
413 | } | ||
414 | sdp->sd_max_jheight = x; | ||
415 | sdp->sd_jheightsize[x] = ~0; | ||
416 | gfs2_assert(sdp, sdp->sd_max_jheight <= GFS2_MAX_META_HEIGHT); | ||
417 | |||
418 | return 0; | ||
419 | } | ||
420 | |||
116 | static int init_names(struct gfs2_sbd *sdp, int silent) | 421 | static int init_names(struct gfs2_sbd *sdp, int silent) |
117 | { | 422 | { |
118 | char *proto, *table; | 423 | char *proto, *table; |
@@ -224,51 +529,59 @@ fail: | |||
224 | return error; | 529 | return error; |
225 | } | 530 | } |
226 | 531 | ||
227 | static inline struct inode *gfs2_lookup_root(struct super_block *sb, | 532 | static int gfs2_lookup_root(struct super_block *sb, struct dentry **dptr, |
228 | u64 no_addr) | 533 | u64 no_addr, const char *name) |
229 | { | 534 | { |
230 | return gfs2_inode_lookup(sb, DT_DIR, no_addr, 0, 0); | 535 | struct gfs2_sbd *sdp = sb->s_fs_info; |
536 | struct dentry *dentry; | ||
537 | struct inode *inode; | ||
538 | |||
539 | inode = gfs2_inode_lookup(sb, DT_DIR, no_addr, 0, 0); | ||
540 | if (IS_ERR(inode)) { | ||
541 | fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode)); | ||
542 | return PTR_ERR(inode); | ||
543 | } | ||
544 | dentry = d_alloc_root(inode); | ||
545 | if (!dentry) { | ||
546 | fs_err(sdp, "can't alloc %s dentry\n", name); | ||
547 | iput(inode); | ||
548 | return -ENOMEM; | ||
549 | } | ||
550 | dentry->d_op = &gfs2_dops; | ||
551 | *dptr = dentry; | ||
552 | return 0; | ||
231 | } | 553 | } |
232 | 554 | ||
233 | static int init_sb(struct gfs2_sbd *sdp, int silent, int undo) | 555 | static int init_sb(struct gfs2_sbd *sdp, int silent) |
234 | { | 556 | { |
235 | struct super_block *sb = sdp->sd_vfs; | 557 | struct super_block *sb = sdp->sd_vfs; |
236 | struct gfs2_holder sb_gh; | 558 | struct gfs2_holder sb_gh; |
237 | u64 no_addr; | 559 | u64 no_addr; |
238 | struct inode *inode; | 560 | int ret; |
239 | int error = 0; | ||
240 | 561 | ||
241 | if (undo) { | 562 | ret = gfs2_glock_nq_num(sdp, GFS2_SB_LOCK, &gfs2_meta_glops, |
242 | if (sb->s_root) { | 563 | LM_ST_SHARED, 0, &sb_gh); |
243 | dput(sb->s_root); | 564 | if (ret) { |
244 | sb->s_root = NULL; | 565 | fs_err(sdp, "can't acquire superblock glock: %d\n", ret); |
245 | } | 566 | return ret; |
246 | return 0; | ||
247 | } | 567 | } |
248 | 568 | ||
249 | error = gfs2_glock_nq_num(sdp, GFS2_SB_LOCK, &gfs2_meta_glops, | 569 | ret = gfs2_read_sb(sdp, sb_gh.gh_gl, silent); |
250 | LM_ST_SHARED, 0, &sb_gh); | 570 | if (ret) { |
251 | if (error) { | 571 | fs_err(sdp, "can't read superblock: %d\n", ret); |
252 | fs_err(sdp, "can't acquire superblock glock: %d\n", error); | ||
253 | return error; | ||
254 | } | ||
255 | |||
256 | error = gfs2_read_sb(sdp, sb_gh.gh_gl, silent); | ||
257 | if (error) { | ||
258 | fs_err(sdp, "can't read superblock: %d\n", error); | ||
259 | goto out; | 572 | goto out; |
260 | } | 573 | } |
261 | 574 | ||
262 | /* Set up the buffer cache and SB for real */ | 575 | /* Set up the buffer cache and SB for real */ |
263 | if (sdp->sd_sb.sb_bsize < bdev_hardsect_size(sb->s_bdev)) { | 576 | if (sdp->sd_sb.sb_bsize < bdev_hardsect_size(sb->s_bdev)) { |
264 | error = -EINVAL; | 577 | ret = -EINVAL; |
265 | fs_err(sdp, "FS block size (%u) is too small for device " | 578 | fs_err(sdp, "FS block size (%u) is too small for device " |
266 | "block size (%u)\n", | 579 | "block size (%u)\n", |
267 | sdp->sd_sb.sb_bsize, bdev_hardsect_size(sb->s_bdev)); | 580 | sdp->sd_sb.sb_bsize, bdev_hardsect_size(sb->s_bdev)); |
268 | goto out; | 581 | goto out; |
269 | } | 582 | } |
270 | if (sdp->sd_sb.sb_bsize > PAGE_SIZE) { | 583 | if (sdp->sd_sb.sb_bsize > PAGE_SIZE) { |
271 | error = -EINVAL; | 584 | ret = -EINVAL; |
272 | fs_err(sdp, "FS block size (%u) is too big for machine " | 585 | fs_err(sdp, "FS block size (%u) is too big for machine " |
273 | "page size (%u)\n", | 586 | "page size (%u)\n", |
274 | sdp->sd_sb.sb_bsize, (unsigned int)PAGE_SIZE); | 587 | sdp->sd_sb.sb_bsize, (unsigned int)PAGE_SIZE); |
@@ -278,26 +591,21 @@ static int init_sb(struct gfs2_sbd *sdp, int silent, int undo) | |||
278 | 591 | ||
279 | /* Get the root inode */ | 592 | /* Get the root inode */ |
280 | no_addr = sdp->sd_sb.sb_root_dir.no_addr; | 593 | no_addr = sdp->sd_sb.sb_root_dir.no_addr; |
281 | if (sb->s_type == &gfs2meta_fs_type) | 594 | ret = gfs2_lookup_root(sb, &sdp->sd_root_dir, no_addr, "root"); |
282 | no_addr = sdp->sd_sb.sb_master_dir.no_addr; | 595 | if (ret) |
283 | inode = gfs2_lookup_root(sb, no_addr); | ||
284 | if (IS_ERR(inode)) { | ||
285 | error = PTR_ERR(inode); | ||
286 | fs_err(sdp, "can't read in root inode: %d\n", error); | ||
287 | goto out; | 596 | goto out; |
288 | } | ||
289 | 597 | ||
290 | sb->s_root = d_alloc_root(inode); | 598 | /* Get the master inode */ |
291 | if (!sb->s_root) { | 599 | no_addr = sdp->sd_sb.sb_master_dir.no_addr; |
292 | fs_err(sdp, "can't get root dentry\n"); | 600 | ret = gfs2_lookup_root(sb, &sdp->sd_master_dir, no_addr, "master"); |
293 | error = -ENOMEM; | 601 | if (ret) { |
294 | iput(inode); | 602 | dput(sdp->sd_root_dir); |
295 | } else | 603 | goto out; |
296 | sb->s_root->d_op = &gfs2_dops; | 604 | } |
297 | 605 | sb->s_root = dget(sdp->sd_args.ar_meta ? sdp->sd_master_dir : sdp->sd_root_dir); | |
298 | out: | 606 | out: |
299 | gfs2_glock_dq_uninit(&sb_gh); | 607 | gfs2_glock_dq_uninit(&sb_gh); |
300 | return error; | 608 | return ret; |
301 | } | 609 | } |
302 | 610 | ||
303 | /** | 611 | /** |
@@ -372,6 +680,7 @@ static void gfs2_lm_others_may_mount(struct gfs2_sbd *sdp) | |||
372 | 680 | ||
373 | static int init_journal(struct gfs2_sbd *sdp, int undo) | 681 | static int init_journal(struct gfs2_sbd *sdp, int undo) |
374 | { | 682 | { |
683 | struct inode *master = sdp->sd_master_dir->d_inode; | ||
375 | struct gfs2_holder ji_gh; | 684 | struct gfs2_holder ji_gh; |
376 | struct task_struct *p; | 685 | struct task_struct *p; |
377 | struct gfs2_inode *ip; | 686 | struct gfs2_inode *ip; |
@@ -383,7 +692,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) | |||
383 | goto fail_recoverd; | 692 | goto fail_recoverd; |
384 | } | 693 | } |
385 | 694 | ||
386 | sdp->sd_jindex = gfs2_lookup_simple(sdp->sd_master_dir, "jindex"); | 695 | sdp->sd_jindex = gfs2_lookup_simple(master, "jindex"); |
387 | if (IS_ERR(sdp->sd_jindex)) { | 696 | if (IS_ERR(sdp->sd_jindex)) { |
388 | fs_err(sdp, "can't lookup journal index: %d\n", error); | 697 | fs_err(sdp, "can't lookup journal index: %d\n", error); |
389 | return PTR_ERR(sdp->sd_jindex); | 698 | return PTR_ERR(sdp->sd_jindex); |
@@ -506,25 +815,17 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo) | |||
506 | { | 815 | { |
507 | int error = 0; | 816 | int error = 0; |
508 | struct gfs2_inode *ip; | 817 | struct gfs2_inode *ip; |
509 | struct inode *inode; | 818 | struct inode *master = sdp->sd_master_dir->d_inode; |
510 | 819 | ||
511 | if (undo) | 820 | if (undo) |
512 | goto fail_qinode; | 821 | goto fail_qinode; |
513 | 822 | ||
514 | inode = gfs2_lookup_root(sdp->sd_vfs, sdp->sd_sb.sb_master_dir.no_addr); | ||
515 | if (IS_ERR(inode)) { | ||
516 | error = PTR_ERR(inode); | ||
517 | fs_err(sdp, "can't read in master directory: %d\n", error); | ||
518 | goto fail; | ||
519 | } | ||
520 | sdp->sd_master_dir = inode; | ||
521 | |||
522 | error = init_journal(sdp, undo); | 823 | error = init_journal(sdp, undo); |
523 | if (error) | 824 | if (error) |
524 | goto fail_master; | 825 | goto fail; |
525 | 826 | ||
526 | /* Read in the master inode number inode */ | 827 | /* Read in the master inode number inode */ |
527 | sdp->sd_inum_inode = gfs2_lookup_simple(sdp->sd_master_dir, "inum"); | 828 | sdp->sd_inum_inode = gfs2_lookup_simple(master, "inum"); |
528 | if (IS_ERR(sdp->sd_inum_inode)) { | 829 | if (IS_ERR(sdp->sd_inum_inode)) { |
529 | error = PTR_ERR(sdp->sd_inum_inode); | 830 | error = PTR_ERR(sdp->sd_inum_inode); |
530 | fs_err(sdp, "can't read in inum inode: %d\n", error); | 831 | fs_err(sdp, "can't read in inum inode: %d\n", error); |
@@ -533,7 +834,7 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo) | |||
533 | 834 | ||
534 | 835 | ||
535 | /* Read in the master statfs inode */ | 836 | /* Read in the master statfs inode */ |
536 | sdp->sd_statfs_inode = gfs2_lookup_simple(sdp->sd_master_dir, "statfs"); | 837 | sdp->sd_statfs_inode = gfs2_lookup_simple(master, "statfs"); |
537 | if (IS_ERR(sdp->sd_statfs_inode)) { | 838 | if (IS_ERR(sdp->sd_statfs_inode)) { |
538 | error = PTR_ERR(sdp->sd_statfs_inode); | 839 | error = PTR_ERR(sdp->sd_statfs_inode); |
539 | fs_err(sdp, "can't read in statfs inode: %d\n", error); | 840 | fs_err(sdp, "can't read in statfs inode: %d\n", error); |
@@ -541,7 +842,7 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo) | |||
541 | } | 842 | } |
542 | 843 | ||
543 | /* Read in the resource index inode */ | 844 | /* Read in the resource index inode */ |
544 | sdp->sd_rindex = gfs2_lookup_simple(sdp->sd_master_dir, "rindex"); | 845 | sdp->sd_rindex = gfs2_lookup_simple(master, "rindex"); |
545 | if (IS_ERR(sdp->sd_rindex)) { | 846 | if (IS_ERR(sdp->sd_rindex)) { |
546 | error = PTR_ERR(sdp->sd_rindex); | 847 | error = PTR_ERR(sdp->sd_rindex); |
547 | fs_err(sdp, "can't get resource index inode: %d\n", error); | 848 | fs_err(sdp, "can't get resource index inode: %d\n", error); |
@@ -552,7 +853,7 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo) | |||
552 | sdp->sd_rindex_uptodate = 0; | 853 | sdp->sd_rindex_uptodate = 0; |
553 | 854 | ||
554 | /* Read in the quota inode */ | 855 | /* Read in the quota inode */ |
555 | sdp->sd_quota_inode = gfs2_lookup_simple(sdp->sd_master_dir, "quota"); | 856 | sdp->sd_quota_inode = gfs2_lookup_simple(master, "quota"); |
556 | if (IS_ERR(sdp->sd_quota_inode)) { | 857 | if (IS_ERR(sdp->sd_quota_inode)) { |
557 | error = PTR_ERR(sdp->sd_quota_inode); | 858 | error = PTR_ERR(sdp->sd_quota_inode); |
558 | fs_err(sdp, "can't get quota file inode: %d\n", error); | 859 | fs_err(sdp, "can't get quota file inode: %d\n", error); |
@@ -571,8 +872,6 @@ fail_inum: | |||
571 | iput(sdp->sd_inum_inode); | 872 | iput(sdp->sd_inum_inode); |
572 | fail_journal: | 873 | fail_journal: |
573 | init_journal(sdp, UNDO); | 874 | init_journal(sdp, UNDO); |
574 | fail_master: | ||
575 | iput(sdp->sd_master_dir); | ||
576 | fail: | 875 | fail: |
577 | return error; | 876 | return error; |
578 | } | 877 | } |
@@ -583,6 +882,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo) | |||
583 | char buf[30]; | 882 | char buf[30]; |
584 | int error = 0; | 883 | int error = 0; |
585 | struct gfs2_inode *ip; | 884 | struct gfs2_inode *ip; |
885 | struct inode *master = sdp->sd_master_dir->d_inode; | ||
586 | 886 | ||
587 | if (sdp->sd_args.ar_spectator) | 887 | if (sdp->sd_args.ar_spectator) |
588 | return 0; | 888 | return 0; |
@@ -590,7 +890,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo) | |||
590 | if (undo) | 890 | if (undo) |
591 | goto fail_qc_gh; | 891 | goto fail_qc_gh; |
592 | 892 | ||
593 | pn = gfs2_lookup_simple(sdp->sd_master_dir, "per_node"); | 893 | pn = gfs2_lookup_simple(master, "per_node"); |
594 | if (IS_ERR(pn)) { | 894 | if (IS_ERR(pn)) { |
595 | error = PTR_ERR(pn); | 895 | error = PTR_ERR(pn); |
596 | fs_err(sdp, "can't find per_node directory: %d\n", error); | 896 | fs_err(sdp, "can't find per_node directory: %d\n", error); |
@@ -828,7 +1128,7 @@ static int fill_super(struct super_block *sb, void *data, int silent) | |||
828 | if (error) | 1128 | if (error) |
829 | goto fail_lm; | 1129 | goto fail_lm; |
830 | 1130 | ||
831 | error = init_sb(sdp, silent, DO); | 1131 | error = init_sb(sdp, silent); |
832 | if (error) | 1132 | if (error) |
833 | goto fail_locking; | 1133 | goto fail_locking; |
834 | 1134 | ||
@@ -869,7 +1169,11 @@ fail_per_node: | |||
869 | fail_inodes: | 1169 | fail_inodes: |
870 | init_inodes(sdp, UNDO); | 1170 | init_inodes(sdp, UNDO); |
871 | fail_sb: | 1171 | fail_sb: |
872 | init_sb(sdp, 0, UNDO); | 1172 | if (sdp->sd_root_dir) |
1173 | dput(sdp->sd_root_dir); | ||
1174 | if (sdp->sd_master_dir) | ||
1175 | dput(sdp->sd_master_dir); | ||
1176 | sb->s_root = NULL; | ||
873 | fail_locking: | 1177 | fail_locking: |
874 | init_locking(sdp, &mount_gh, UNDO); | 1178 | init_locking(sdp, &mount_gh, UNDO); |
875 | fail_lm: | 1179 | fail_lm: |
@@ -887,151 +1191,60 @@ fail: | |||
887 | } | 1191 | } |
888 | 1192 | ||
889 | static int gfs2_get_sb(struct file_system_type *fs_type, int flags, | 1193 | static int gfs2_get_sb(struct file_system_type *fs_type, int flags, |
890 | const char *dev_name, void *data, struct vfsmount *mnt) | 1194 | const char *dev_name, void *data, struct vfsmount *mnt) |
891 | { | 1195 | { |
892 | struct super_block *sb; | 1196 | return get_sb_bdev(fs_type, flags, dev_name, data, fill_super, mnt); |
893 | struct gfs2_sbd *sdp; | ||
894 | int error = get_sb_bdev(fs_type, flags, dev_name, data, fill_super, mnt); | ||
895 | if (error) | ||
896 | goto out; | ||
897 | sb = mnt->mnt_sb; | ||
898 | sdp = sb->s_fs_info; | ||
899 | sdp->sd_gfs2mnt = mnt; | ||
900 | out: | ||
901 | return error; | ||
902 | } | 1197 | } |
903 | 1198 | ||
904 | static int fill_super_meta(struct super_block *sb, struct super_block *new, | 1199 | static struct super_block *get_gfs2_sb(const char *dev_name) |
905 | void *data, int silent) | ||
906 | { | 1200 | { |
907 | struct gfs2_sbd *sdp = sb->s_fs_info; | 1201 | struct super_block *sb; |
908 | struct inode *inode; | ||
909 | int error = 0; | ||
910 | |||
911 | new->s_fs_info = sdp; | ||
912 | sdp->sd_vfs_meta = sb; | ||
913 | |||
914 | init_vfs(new, SDF_NOATIME); | ||
915 | |||
916 | /* Get the master inode */ | ||
917 | inode = igrab(sdp->sd_master_dir); | ||
918 | |||
919 | new->s_root = d_alloc_root(inode); | ||
920 | if (!new->s_root) { | ||
921 | fs_err(sdp, "can't get root dentry\n"); | ||
922 | error = -ENOMEM; | ||
923 | iput(inode); | ||
924 | } else | ||
925 | new->s_root->d_op = &gfs2_dops; | ||
926 | |||
927 | return error; | ||
928 | } | ||
929 | |||
930 | static int set_bdev_super(struct super_block *s, void *data) | ||
931 | { | ||
932 | s->s_bdev = data; | ||
933 | s->s_dev = s->s_bdev->bd_dev; | ||
934 | return 0; | ||
935 | } | ||
936 | |||
937 | static int test_bdev_super(struct super_block *s, void *data) | ||
938 | { | ||
939 | return s->s_bdev == data; | ||
940 | } | ||
941 | |||
942 | static struct super_block* get_gfs2_sb(const char *dev_name) | ||
943 | { | ||
944 | struct kstat stat; | ||
945 | struct nameidata nd; | 1202 | struct nameidata nd; |
946 | struct super_block *sb = NULL, *s; | ||
947 | int error; | 1203 | int error; |
948 | 1204 | ||
949 | error = path_lookup(dev_name, LOOKUP_FOLLOW, &nd); | 1205 | error = path_lookup(dev_name, LOOKUP_FOLLOW, &nd); |
950 | if (error) { | 1206 | if (error) { |
951 | printk(KERN_WARNING "GFS2: path_lookup on %s returned error\n", | 1207 | printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n", |
952 | dev_name); | 1208 | dev_name, error); |
953 | goto out; | 1209 | return NULL; |
954 | } | ||
955 | error = vfs_getattr(nd.path.mnt, nd.path.dentry, &stat); | ||
956 | |||
957 | list_for_each_entry(s, &gfs2_fs_type.fs_supers, s_instances) { | ||
958 | if ((S_ISBLK(stat.mode) && s->s_dev == stat.rdev) || | ||
959 | (S_ISDIR(stat.mode) && | ||
960 | s == nd.path.dentry->d_inode->i_sb)) { | ||
961 | sb = s; | ||
962 | goto free_nd; | ||
963 | } | ||
964 | } | 1210 | } |
965 | 1211 | sb = nd.path.dentry->d_inode->i_sb; | |
966 | printk(KERN_WARNING "GFS2: Unrecognized block device or " | 1212 | if (sb && (sb->s_type == &gfs2_fs_type)) |
967 | "mount point %s\n", dev_name); | 1213 | atomic_inc(&sb->s_active); |
968 | 1214 | else | |
969 | free_nd: | 1215 | sb = NULL; |
970 | path_put(&nd.path); | 1216 | path_put(&nd.path); |
971 | out: | ||
972 | return sb; | 1217 | return sb; |
973 | } | 1218 | } |
974 | 1219 | ||
975 | static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, | 1220 | static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, |
976 | const char *dev_name, void *data, struct vfsmount *mnt) | 1221 | const char *dev_name, void *data, struct vfsmount *mnt) |
977 | { | 1222 | { |
978 | int error = 0; | 1223 | struct super_block *sb = NULL; |
979 | struct super_block *sb = NULL, *new; | ||
980 | struct gfs2_sbd *sdp; | 1224 | struct gfs2_sbd *sdp; |
981 | 1225 | ||
982 | sb = get_gfs2_sb(dev_name); | 1226 | sb = get_gfs2_sb(dev_name); |
983 | if (!sb) { | 1227 | if (!sb) { |
984 | printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n"); | 1228 | printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n"); |
985 | error = -ENOENT; | 1229 | return -ENOENT; |
986 | goto error; | ||
987 | } | 1230 | } |
988 | sdp = sb->s_fs_info; | 1231 | sdp = sb->s_fs_info; |
989 | if (sdp->sd_vfs_meta) { | 1232 | mnt->mnt_sb = sb; |
990 | printk(KERN_WARNING "GFS2: gfs2meta mount already exists\n"); | 1233 | mnt->mnt_root = dget(sdp->sd_master_dir); |
991 | error = -EBUSY; | 1234 | return 0; |
992 | goto error; | ||
993 | } | ||
994 | down(&sb->s_bdev->bd_mount_sem); | ||
995 | new = sget(fs_type, test_bdev_super, set_bdev_super, sb->s_bdev); | ||
996 | up(&sb->s_bdev->bd_mount_sem); | ||
997 | if (IS_ERR(new)) { | ||
998 | error = PTR_ERR(new); | ||
999 | goto error; | ||
1000 | } | ||
1001 | new->s_flags = flags; | ||
1002 | strlcpy(new->s_id, sb->s_id, sizeof(new->s_id)); | ||
1003 | sb_set_blocksize(new, sb->s_blocksize); | ||
1004 | error = fill_super_meta(sb, new, data, flags & MS_SILENT ? 1 : 0); | ||
1005 | if (error) { | ||
1006 | up_write(&new->s_umount); | ||
1007 | deactivate_super(new); | ||
1008 | goto error; | ||
1009 | } | ||
1010 | |||
1011 | new->s_flags |= MS_ACTIVE; | ||
1012 | |||
1013 | /* Grab a reference to the gfs2 mount point */ | ||
1014 | atomic_inc(&sdp->sd_gfs2mnt->mnt_count); | ||
1015 | return simple_set_mnt(mnt, new); | ||
1016 | error: | ||
1017 | return error; | ||
1018 | } | 1235 | } |
1019 | 1236 | ||
1020 | static void gfs2_kill_sb(struct super_block *sb) | 1237 | static void gfs2_kill_sb(struct super_block *sb) |
1021 | { | 1238 | { |
1022 | if (sb->s_fs_info) { | ||
1023 | gfs2_delete_debugfs_file(sb->s_fs_info); | ||
1024 | gfs2_meta_syncfs(sb->s_fs_info); | ||
1025 | } | ||
1026 | kill_block_super(sb); | ||
1027 | } | ||
1028 | |||
1029 | static void gfs2_kill_sb_meta(struct super_block *sb) | ||
1030 | { | ||
1031 | struct gfs2_sbd *sdp = sb->s_fs_info; | 1239 | struct gfs2_sbd *sdp = sb->s_fs_info; |
1032 | generic_shutdown_super(sb); | 1240 | gfs2_meta_syncfs(sdp); |
1033 | sdp->sd_vfs_meta = NULL; | 1241 | dput(sdp->sd_root_dir); |
1034 | atomic_dec(&sdp->sd_gfs2mnt->mnt_count); | 1242 | dput(sdp->sd_master_dir); |
1243 | sdp->sd_root_dir = NULL; | ||
1244 | sdp->sd_master_dir = NULL; | ||
1245 | shrink_dcache_sb(sb); | ||
1246 | kill_block_super(sb); | ||
1247 | gfs2_delete_debugfs_file(sdp); | ||
1035 | } | 1248 | } |
1036 | 1249 | ||
1037 | struct file_system_type gfs2_fs_type = { | 1250 | struct file_system_type gfs2_fs_type = { |
@@ -1046,7 +1259,6 @@ struct file_system_type gfs2meta_fs_type = { | |||
1046 | .name = "gfs2meta", | 1259 | .name = "gfs2meta", |
1047 | .fs_flags = FS_REQUIRES_DEV, | 1260 | .fs_flags = FS_REQUIRES_DEV, |
1048 | .get_sb = gfs2_get_sb_meta, | 1261 | .get_sb = gfs2_get_sb_meta, |
1049 | .kill_sb = gfs2_kill_sb_meta, | ||
1050 | .owner = THIS_MODULE, | 1262 | .owner = THIS_MODULE, |
1051 | }; | 1263 | }; |
1052 | 1264 | ||
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c index f66ea0f7a356..8f332d26b5dd 100644 --- a/fs/gfs2/ops_super.c +++ b/fs/gfs2/ops_super.c | |||
@@ -63,6 +63,39 @@ static int gfs2_write_inode(struct inode *inode, int sync) | |||
63 | } | 63 | } |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * gfs2_make_fs_ro - Turn a Read-Write FS into a Read-Only one | ||
67 | * @sdp: the filesystem | ||
68 | * | ||
69 | * Returns: errno | ||
70 | */ | ||
71 | |||
72 | static int gfs2_make_fs_ro(struct gfs2_sbd *sdp) | ||
73 | { | ||
74 | struct gfs2_holder t_gh; | ||
75 | int error; | ||
76 | |||
77 | gfs2_quota_sync(sdp); | ||
78 | gfs2_statfs_sync(sdp); | ||
79 | |||
80 | error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, GL_NOCACHE, | ||
81 | &t_gh); | ||
82 | if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) | ||
83 | return error; | ||
84 | |||
85 | gfs2_meta_syncfs(sdp); | ||
86 | gfs2_log_shutdown(sdp); | ||
87 | |||
88 | clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags); | ||
89 | |||
90 | if (t_gh.gh_gl) | ||
91 | gfs2_glock_dq_uninit(&t_gh); | ||
92 | |||
93 | gfs2_quota_cleanup(sdp); | ||
94 | |||
95 | return error; | ||
96 | } | ||
97 | |||
98 | /** | ||
66 | * gfs2_put_super - Unmount the filesystem | 99 | * gfs2_put_super - Unmount the filesystem |
67 | * @sb: The VFS superblock | 100 | * @sb: The VFS superblock |
68 | * | 101 | * |
@@ -73,12 +106,6 @@ static void gfs2_put_super(struct super_block *sb) | |||
73 | struct gfs2_sbd *sdp = sb->s_fs_info; | 106 | struct gfs2_sbd *sdp = sb->s_fs_info; |
74 | int error; | 107 | int error; |
75 | 108 | ||
76 | if (!sdp) | ||
77 | return; | ||
78 | |||
79 | if (!strncmp(sb->s_type->name, "gfs2meta", 8)) | ||
80 | return; /* Nothing to do */ | ||
81 | |||
82 | /* Unfreeze the filesystem, if we need to */ | 109 | /* Unfreeze the filesystem, if we need to */ |
83 | 110 | ||
84 | mutex_lock(&sdp->sd_freeze_lock); | 111 | mutex_lock(&sdp->sd_freeze_lock); |
@@ -101,7 +128,6 @@ static void gfs2_put_super(struct super_block *sb) | |||
101 | 128 | ||
102 | /* Release stuff */ | 129 | /* Release stuff */ |
103 | 130 | ||
104 | iput(sdp->sd_master_dir); | ||
105 | iput(sdp->sd_jindex); | 131 | iput(sdp->sd_jindex); |
106 | iput(sdp->sd_inum_inode); | 132 | iput(sdp->sd_inum_inode); |
107 | iput(sdp->sd_statfs_inode); | 133 | iput(sdp->sd_statfs_inode); |
@@ -152,6 +178,7 @@ static void gfs2_write_super(struct super_block *sb) | |||
152 | * | 178 | * |
153 | * Flushes the log to disk. | 179 | * Flushes the log to disk. |
154 | */ | 180 | */ |
181 | |||
155 | static int gfs2_sync_fs(struct super_block *sb, int wait) | 182 | static int gfs2_sync_fs(struct super_block *sb, int wait) |
156 | { | 183 | { |
157 | sb->s_dirt = 0; | 184 | sb->s_dirt = 0; |
@@ -295,6 +322,7 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) | |||
295 | * inode's blocks, or alternatively pass the baton on to another | 322 | * inode's blocks, or alternatively pass the baton on to another |
296 | * node for later deallocation. | 323 | * node for later deallocation. |
297 | */ | 324 | */ |
325 | |||
298 | static void gfs2_drop_inode(struct inode *inode) | 326 | static void gfs2_drop_inode(struct inode *inode) |
299 | { | 327 | { |
300 | struct gfs2_inode *ip = GFS2_I(inode); | 328 | struct gfs2_inode *ip = GFS2_I(inode); |
@@ -333,6 +361,16 @@ static void gfs2_clear_inode(struct inode *inode) | |||
333 | } | 361 | } |
334 | } | 362 | } |
335 | 363 | ||
364 | static int is_ancestor(const struct dentry *d1, const struct dentry *d2) | ||
365 | { | ||
366 | do { | ||
367 | if (d1 == d2) | ||
368 | return 1; | ||
369 | d1 = d1->d_parent; | ||
370 | } while (!IS_ROOT(d1)); | ||
371 | return 0; | ||
372 | } | ||
373 | |||
336 | /** | 374 | /** |
337 | * gfs2_show_options - Show mount options for /proc/mounts | 375 | * gfs2_show_options - Show mount options for /proc/mounts |
338 | * @s: seq_file structure | 376 | * @s: seq_file structure |
@@ -346,6 +384,8 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
346 | struct gfs2_sbd *sdp = mnt->mnt_sb->s_fs_info; | 384 | struct gfs2_sbd *sdp = mnt->mnt_sb->s_fs_info; |
347 | struct gfs2_args *args = &sdp->sd_args; | 385 | struct gfs2_args *args = &sdp->sd_args; |
348 | 386 | ||
387 | if (is_ancestor(mnt->mnt_root, sdp->sd_master_dir)) | ||
388 | seq_printf(s, ",meta"); | ||
349 | if (args->ar_lockproto[0]) | 389 | if (args->ar_lockproto[0]) |
350 | seq_printf(s, ",lockproto=%s", args->ar_lockproto); | 390 | seq_printf(s, ",lockproto=%s", args->ar_lockproto); |
351 | if (args->ar_locktable[0]) | 391 | if (args->ar_locktable[0]) |
@@ -414,6 +454,7 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
414 | * conversion on the iopen lock, but we can change that later. This | 454 | * conversion on the iopen lock, but we can change that later. This |
415 | * is safe, just less efficient. | 455 | * is safe, just less efficient. |
416 | */ | 456 | */ |
457 | |||
417 | static void gfs2_delete_inode(struct inode *inode) | 458 | static void gfs2_delete_inode(struct inode *inode) |
418 | { | 459 | { |
419 | struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; | 460 | struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; |
@@ -478,8 +519,6 @@ out: | |||
478 | clear_inode(inode); | 519 | clear_inode(inode); |
479 | } | 520 | } |
480 | 521 | ||
481 | |||
482 | |||
483 | static struct inode *gfs2_alloc_inode(struct super_block *sb) | 522 | static struct inode *gfs2_alloc_inode(struct super_block *sb) |
484 | { | 523 | { |
485 | struct gfs2_inode *ip; | 524 | struct gfs2_inode *ip; |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index ca831991cbc2..c3ba3d9d0aac 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -33,313 +33,6 @@ | |||
33 | #include "trans.h" | 33 | #include "trans.h" |
34 | #include "util.h" | 34 | #include "util.h" |
35 | 35 | ||
36 | static const u32 gfs2_old_fs_formats[] = { | ||
37 | 0 | ||
38 | }; | ||
39 | |||
40 | static const u32 gfs2_old_multihost_formats[] = { | ||
41 | 0 | ||
42 | }; | ||
43 | |||
44 | /** | ||
45 | * gfs2_tune_init - Fill a gfs2_tune structure with default values | ||
46 | * @gt: tune | ||
47 | * | ||
48 | */ | ||
49 | |||
50 | void gfs2_tune_init(struct gfs2_tune *gt) | ||
51 | { | ||
52 | spin_lock_init(>->gt_spin); | ||
53 | |||
54 | gt->gt_demote_secs = 300; | ||
55 | gt->gt_incore_log_blocks = 1024; | ||
56 | gt->gt_log_flush_secs = 60; | ||
57 | gt->gt_recoverd_secs = 60; | ||
58 | gt->gt_logd_secs = 1; | ||
59 | gt->gt_quotad_secs = 5; | ||
60 | gt->gt_quota_simul_sync = 64; | ||
61 | gt->gt_quota_warn_period = 10; | ||
62 | gt->gt_quota_scale_num = 1; | ||
63 | gt->gt_quota_scale_den = 1; | ||
64 | gt->gt_quota_cache_secs = 300; | ||
65 | gt->gt_quota_quantum = 60; | ||
66 | gt->gt_atime_quantum = 3600; | ||
67 | gt->gt_new_files_jdata = 0; | ||
68 | gt->gt_max_readahead = 1 << 18; | ||
69 | gt->gt_stall_secs = 600; | ||
70 | gt->gt_complain_secs = 10; | ||
71 | gt->gt_statfs_quantum = 30; | ||
72 | gt->gt_statfs_slow = 0; | ||
73 | } | ||
74 | |||
75 | /** | ||
76 | * gfs2_check_sb - Check superblock | ||
77 | * @sdp: the filesystem | ||
78 | * @sb: The superblock | ||
79 | * @silent: Don't print a message if the check fails | ||
80 | * | ||
81 | * Checks the version code of the FS is one that we understand how to | ||
82 | * read and that the sizes of the various on-disk structures have not | ||
83 | * changed. | ||
84 | */ | ||
85 | |||
86 | int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb_host *sb, int silent) | ||
87 | { | ||
88 | unsigned int x; | ||
89 | |||
90 | if (sb->sb_magic != GFS2_MAGIC || | ||
91 | sb->sb_type != GFS2_METATYPE_SB) { | ||
92 | if (!silent) | ||
93 | printk(KERN_WARNING "GFS2: not a GFS2 filesystem\n"); | ||
94 | return -EINVAL; | ||
95 | } | ||
96 | |||
97 | /* If format numbers match exactly, we're done. */ | ||
98 | |||
99 | if (sb->sb_fs_format == GFS2_FORMAT_FS && | ||
100 | sb->sb_multihost_format == GFS2_FORMAT_MULTI) | ||
101 | return 0; | ||
102 | |||
103 | if (sb->sb_fs_format != GFS2_FORMAT_FS) { | ||
104 | for (x = 0; gfs2_old_fs_formats[x]; x++) | ||
105 | if (gfs2_old_fs_formats[x] == sb->sb_fs_format) | ||
106 | break; | ||
107 | |||
108 | if (!gfs2_old_fs_formats[x]) { | ||
109 | printk(KERN_WARNING | ||
110 | "GFS2: code version (%u, %u) is incompatible " | ||
111 | "with ondisk format (%u, %u)\n", | ||
112 | GFS2_FORMAT_FS, GFS2_FORMAT_MULTI, | ||
113 | sb->sb_fs_format, sb->sb_multihost_format); | ||
114 | printk(KERN_WARNING | ||
115 | "GFS2: I don't know how to upgrade this FS\n"); | ||
116 | return -EINVAL; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | if (sb->sb_multihost_format != GFS2_FORMAT_MULTI) { | ||
121 | for (x = 0; gfs2_old_multihost_formats[x]; x++) | ||
122 | if (gfs2_old_multihost_formats[x] == | ||
123 | sb->sb_multihost_format) | ||
124 | break; | ||
125 | |||
126 | if (!gfs2_old_multihost_formats[x]) { | ||
127 | printk(KERN_WARNING | ||
128 | "GFS2: code version (%u, %u) is incompatible " | ||
129 | "with ondisk format (%u, %u)\n", | ||
130 | GFS2_FORMAT_FS, GFS2_FORMAT_MULTI, | ||
131 | sb->sb_fs_format, sb->sb_multihost_format); | ||
132 | printk(KERN_WARNING | ||
133 | "GFS2: I don't know how to upgrade this FS\n"); | ||
134 | return -EINVAL; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | if (!sdp->sd_args.ar_upgrade) { | ||
139 | printk(KERN_WARNING | ||
140 | "GFS2: code version (%u, %u) is incompatible " | ||
141 | "with ondisk format (%u, %u)\n", | ||
142 | GFS2_FORMAT_FS, GFS2_FORMAT_MULTI, | ||
143 | sb->sb_fs_format, sb->sb_multihost_format); | ||
144 | printk(KERN_INFO | ||
145 | "GFS2: Use the \"upgrade\" mount option to upgrade " | ||
146 | "the FS\n"); | ||
147 | printk(KERN_INFO "GFS2: See the manual for more details\n"); | ||
148 | return -EINVAL; | ||
149 | } | ||
150 | |||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | |||
155 | static void end_bio_io_page(struct bio *bio, int error) | ||
156 | { | ||
157 | struct page *page = bio->bi_private; | ||
158 | |||
159 | if (!error) | ||
160 | SetPageUptodate(page); | ||
161 | else | ||
162 | printk(KERN_WARNING "gfs2: error %d reading superblock\n", error); | ||
163 | unlock_page(page); | ||
164 | } | ||
165 | |||
166 | static void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf) | ||
167 | { | ||
168 | const struct gfs2_sb *str = buf; | ||
169 | |||
170 | sb->sb_magic = be32_to_cpu(str->sb_header.mh_magic); | ||
171 | sb->sb_type = be32_to_cpu(str->sb_header.mh_type); | ||
172 | sb->sb_format = be32_to_cpu(str->sb_header.mh_format); | ||
173 | sb->sb_fs_format = be32_to_cpu(str->sb_fs_format); | ||
174 | sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format); | ||
175 | sb->sb_bsize = be32_to_cpu(str->sb_bsize); | ||
176 | sb->sb_bsize_shift = be32_to_cpu(str->sb_bsize_shift); | ||
177 | sb->sb_master_dir.no_addr = be64_to_cpu(str->sb_master_dir.no_addr); | ||
178 | sb->sb_master_dir.no_formal_ino = be64_to_cpu(str->sb_master_dir.no_formal_ino); | ||
179 | sb->sb_root_dir.no_addr = be64_to_cpu(str->sb_root_dir.no_addr); | ||
180 | sb->sb_root_dir.no_formal_ino = be64_to_cpu(str->sb_root_dir.no_formal_ino); | ||
181 | |||
182 | memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN); | ||
183 | memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN); | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * gfs2_read_super - Read the gfs2 super block from disk | ||
188 | * @sdp: The GFS2 super block | ||
189 | * @sector: The location of the super block | ||
190 | * @error: The error code to return | ||
191 | * | ||
192 | * This uses the bio functions to read the super block from disk | ||
193 | * because we want to be 100% sure that we never read cached data. | ||
194 | * A super block is read twice only during each GFS2 mount and is | ||
195 | * never written to by the filesystem. The first time its read no | ||
196 | * locks are held, and the only details which are looked at are those | ||
197 | * relating to the locking protocol. Once locking is up and working, | ||
198 | * the sb is read again under the lock to establish the location of | ||
199 | * the master directory (contains pointers to journals etc) and the | ||
200 | * root directory. | ||
201 | * | ||
202 | * Returns: 0 on success or error | ||
203 | */ | ||
204 | |||
205 | int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector) | ||
206 | { | ||
207 | struct super_block *sb = sdp->sd_vfs; | ||
208 | struct gfs2_sb *p; | ||
209 | struct page *page; | ||
210 | struct bio *bio; | ||
211 | |||
212 | page = alloc_page(GFP_NOFS); | ||
213 | if (unlikely(!page)) | ||
214 | return -ENOBUFS; | ||
215 | |||
216 | ClearPageUptodate(page); | ||
217 | ClearPageDirty(page); | ||
218 | lock_page(page); | ||
219 | |||
220 | bio = bio_alloc(GFP_NOFS, 1); | ||
221 | if (unlikely(!bio)) { | ||
222 | __free_page(page); | ||
223 | return -ENOBUFS; | ||
224 | } | ||
225 | |||
226 | bio->bi_sector = sector * (sb->s_blocksize >> 9); | ||
227 | bio->bi_bdev = sb->s_bdev; | ||
228 | bio_add_page(bio, page, PAGE_SIZE, 0); | ||
229 | |||
230 | bio->bi_end_io = end_bio_io_page; | ||
231 | bio->bi_private = page; | ||
232 | submit_bio(READ_SYNC | (1 << BIO_RW_META), bio); | ||
233 | wait_on_page_locked(page); | ||
234 | bio_put(bio); | ||
235 | if (!PageUptodate(page)) { | ||
236 | __free_page(page); | ||
237 | return -EIO; | ||
238 | } | ||
239 | p = kmap(page); | ||
240 | gfs2_sb_in(&sdp->sd_sb, p); | ||
241 | kunmap(page); | ||
242 | __free_page(page); | ||
243 | return 0; | ||
244 | } | ||
245 | |||
246 | /** | ||
247 | * gfs2_read_sb - Read super block | ||
248 | * @sdp: The GFS2 superblock | ||
249 | * @gl: the glock for the superblock (assumed to be held) | ||
250 | * @silent: Don't print message if mount fails | ||
251 | * | ||
252 | */ | ||
253 | |||
254 | int gfs2_read_sb(struct gfs2_sbd *sdp, struct gfs2_glock *gl, int silent) | ||
255 | { | ||
256 | u32 hash_blocks, ind_blocks, leaf_blocks; | ||
257 | u32 tmp_blocks; | ||
258 | unsigned int x; | ||
259 | int error; | ||
260 | |||
261 | error = gfs2_read_super(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift); | ||
262 | if (error) { | ||
263 | if (!silent) | ||
264 | fs_err(sdp, "can't read superblock\n"); | ||
265 | return error; | ||
266 | } | ||
267 | |||
268 | error = gfs2_check_sb(sdp, &sdp->sd_sb, silent); | ||
269 | if (error) | ||
270 | return error; | ||
271 | |||
272 | sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - | ||
273 | GFS2_BASIC_BLOCK_SHIFT; | ||
274 | sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift; | ||
275 | sdp->sd_diptrs = (sdp->sd_sb.sb_bsize - | ||
276 | sizeof(struct gfs2_dinode)) / sizeof(u64); | ||
277 | sdp->sd_inptrs = (sdp->sd_sb.sb_bsize - | ||
278 | sizeof(struct gfs2_meta_header)) / sizeof(u64); | ||
279 | sdp->sd_jbsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header); | ||
280 | sdp->sd_hash_bsize = sdp->sd_sb.sb_bsize / 2; | ||
281 | sdp->sd_hash_bsize_shift = sdp->sd_sb.sb_bsize_shift - 1; | ||
282 | sdp->sd_hash_ptrs = sdp->sd_hash_bsize / sizeof(u64); | ||
283 | sdp->sd_qc_per_block = (sdp->sd_sb.sb_bsize - | ||
284 | sizeof(struct gfs2_meta_header)) / | ||
285 | sizeof(struct gfs2_quota_change); | ||
286 | |||
287 | /* Compute maximum reservation required to add a entry to a directory */ | ||
288 | |||
289 | hash_blocks = DIV_ROUND_UP(sizeof(u64) * (1 << GFS2_DIR_MAX_DEPTH), | ||
290 | sdp->sd_jbsize); | ||
291 | |||
292 | ind_blocks = 0; | ||
293 | for (tmp_blocks = hash_blocks; tmp_blocks > sdp->sd_diptrs;) { | ||
294 | tmp_blocks = DIV_ROUND_UP(tmp_blocks, sdp->sd_inptrs); | ||
295 | ind_blocks += tmp_blocks; | ||
296 | } | ||
297 | |||
298 | leaf_blocks = 2 + GFS2_DIR_MAX_DEPTH; | ||
299 | |||
300 | sdp->sd_max_dirres = hash_blocks + ind_blocks + leaf_blocks; | ||
301 | |||
302 | sdp->sd_heightsize[0] = sdp->sd_sb.sb_bsize - | ||
303 | sizeof(struct gfs2_dinode); | ||
304 | sdp->sd_heightsize[1] = sdp->sd_sb.sb_bsize * sdp->sd_diptrs; | ||
305 | for (x = 2;; x++) { | ||
306 | u64 space, d; | ||
307 | u32 m; | ||
308 | |||
309 | space = sdp->sd_heightsize[x - 1] * sdp->sd_inptrs; | ||
310 | d = space; | ||
311 | m = do_div(d, sdp->sd_inptrs); | ||
312 | |||
313 | if (d != sdp->sd_heightsize[x - 1] || m) | ||
314 | break; | ||
315 | sdp->sd_heightsize[x] = space; | ||
316 | } | ||
317 | sdp->sd_max_height = x; | ||
318 | sdp->sd_heightsize[x] = ~0; | ||
319 | gfs2_assert(sdp, sdp->sd_max_height <= GFS2_MAX_META_HEIGHT); | ||
320 | |||
321 | sdp->sd_jheightsize[0] = sdp->sd_sb.sb_bsize - | ||
322 | sizeof(struct gfs2_dinode); | ||
323 | sdp->sd_jheightsize[1] = sdp->sd_jbsize * sdp->sd_diptrs; | ||
324 | for (x = 2;; x++) { | ||
325 | u64 space, d; | ||
326 | u32 m; | ||
327 | |||
328 | space = sdp->sd_jheightsize[x - 1] * sdp->sd_inptrs; | ||
329 | d = space; | ||
330 | m = do_div(d, sdp->sd_inptrs); | ||
331 | |||
332 | if (d != sdp->sd_jheightsize[x - 1] || m) | ||
333 | break; | ||
334 | sdp->sd_jheightsize[x] = space; | ||
335 | } | ||
336 | sdp->sd_max_jheight = x; | ||
337 | sdp->sd_jheightsize[x] = ~0; | ||
338 | gfs2_assert(sdp, sdp->sd_max_jheight <= GFS2_MAX_META_HEIGHT); | ||
339 | |||
340 | return 0; | ||
341 | } | ||
342 | |||
343 | /** | 36 | /** |
344 | * gfs2_jindex_hold - Grab a lock on the jindex | 37 | * gfs2_jindex_hold - Grab a lock on the jindex |
345 | * @sdp: The GFS2 superblock | 38 | * @sdp: The GFS2 superblock |
@@ -581,39 +274,6 @@ fail: | |||
581 | return error; | 274 | return error; |
582 | } | 275 | } |
583 | 276 | ||
584 | /** | ||
585 | * gfs2_make_fs_ro - Turn a Read-Write FS into a Read-Only one | ||
586 | * @sdp: the filesystem | ||
587 | * | ||
588 | * Returns: errno | ||
589 | */ | ||
590 | |||
591 | int gfs2_make_fs_ro(struct gfs2_sbd *sdp) | ||
592 | { | ||
593 | struct gfs2_holder t_gh; | ||
594 | int error; | ||
595 | |||
596 | gfs2_quota_sync(sdp); | ||
597 | gfs2_statfs_sync(sdp); | ||
598 | |||
599 | error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, GL_NOCACHE, | ||
600 | &t_gh); | ||
601 | if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) | ||
602 | return error; | ||
603 | |||
604 | gfs2_meta_syncfs(sdp); | ||
605 | gfs2_log_shutdown(sdp); | ||
606 | |||
607 | clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags); | ||
608 | |||
609 | if (t_gh.gh_gl) | ||
610 | gfs2_glock_dq_uninit(&t_gh); | ||
611 | |||
612 | gfs2_quota_cleanup(sdp); | ||
613 | |||
614 | return error; | ||
615 | } | ||
616 | |||
617 | static void gfs2_statfs_change_in(struct gfs2_statfs_change_host *sc, const void *buf) | 277 | static void gfs2_statfs_change_in(struct gfs2_statfs_change_host *sc, const void *buf) |
618 | { | 278 | { |
619 | const struct gfs2_statfs_change *str = buf; | 279 | const struct gfs2_statfs_change *str = buf; |
diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h index 44361ecc44f7..50a4c9b1215e 100644 --- a/fs/gfs2/super.h +++ b/fs/gfs2/super.h | |||
@@ -12,11 +12,6 @@ | |||
12 | 12 | ||
13 | #include "incore.h" | 13 | #include "incore.h" |
14 | 14 | ||
15 | void gfs2_tune_init(struct gfs2_tune *gt); | ||
16 | |||
17 | int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb_host *sb, int silent); | ||
18 | int gfs2_read_sb(struct gfs2_sbd *sdp, struct gfs2_glock *gl, int silent); | ||
19 | int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector); | ||
20 | void gfs2_lm_unmount(struct gfs2_sbd *sdp); | 15 | void gfs2_lm_unmount(struct gfs2_sbd *sdp); |
21 | 16 | ||
22 | static inline unsigned int gfs2_jindex_size(struct gfs2_sbd *sdp) | 17 | static inline unsigned int gfs2_jindex_size(struct gfs2_sbd *sdp) |
@@ -40,7 +35,6 @@ int gfs2_lookup_in_master_dir(struct gfs2_sbd *sdp, char *filename, | |||
40 | struct gfs2_inode **ipp); | 35 | struct gfs2_inode **ipp); |
41 | 36 | ||
42 | int gfs2_make_fs_rw(struct gfs2_sbd *sdp); | 37 | int gfs2_make_fs_rw(struct gfs2_sbd *sdp); |
43 | int gfs2_make_fs_ro(struct gfs2_sbd *sdp); | ||
44 | 38 | ||
45 | int gfs2_statfs_init(struct gfs2_sbd *sdp); | 39 | int gfs2_statfs_init(struct gfs2_sbd *sdp); |
46 | void gfs2_statfs_change(struct gfs2_sbd *sdp, | 40 | void gfs2_statfs_change(struct gfs2_sbd *sdp, |