the_nilfs.c (a057d2c01161444c48b12a60351ae6c7135f6e61) the_nilfs.c (0234576d041b9b2cc7043691ea61d2c2ca597aaa)
1/*
2 * the_nilfs.c - the_nilfs shared structure.
3 *
4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 250 unchanged lines hidden (view full) ---

259int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi)
260{
261 struct nilfs_recovery_info ri;
262 unsigned int s_flags = sbi->s_super->s_flags;
263 int really_read_only = bdev_read_only(nilfs->ns_bdev);
264 int valid_fs = nilfs_valid_fs(nilfs);
265 int err;
266
1/*
2 * the_nilfs.c - the_nilfs shared structure.
3 *
4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 250 unchanged lines hidden (view full) ---

259int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi)
260{
261 struct nilfs_recovery_info ri;
262 unsigned int s_flags = sbi->s_super->s_flags;
263 int really_read_only = bdev_read_only(nilfs->ns_bdev);
264 int valid_fs = nilfs_valid_fs(nilfs);
265 int err;
266
267 if (nilfs_loaded(nilfs))
268 return 0;
267 if (nilfs_loaded(nilfs)) {
268 if (valid_fs ||
269 ((s_flags & MS_RDONLY) && nilfs_test_opt(sbi, NORECOVERY)))
270 return 0;
271 printk(KERN_ERR "NILFS: the filesystem is in an incomplete "
272 "recovery state.\n");
273 return -EINVAL;
274 }
269
270 if (!valid_fs) {
271 printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n");
272 if (s_flags & MS_RDONLY) {
273 printk(KERN_INFO "NILFS: INFO: recovery "
274 "required for readonly filesystem.\n");
275 printk(KERN_INFO "NILFS: write access will "
276 "be enabled during recovery.\n");

--- 13 unchanged lines hidden (view full) ---

290 printk(KERN_ERR "NILFS: error loading super root.\n");
291 goto failed;
292 }
293
294 if (valid_fs)
295 goto skip_recovery;
296
297 if (s_flags & MS_RDONLY) {
275
276 if (!valid_fs) {
277 printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n");
278 if (s_flags & MS_RDONLY) {
279 printk(KERN_INFO "NILFS: INFO: recovery "
280 "required for readonly filesystem.\n");
281 printk(KERN_INFO "NILFS: write access will "
282 "be enabled during recovery.\n");

--- 13 unchanged lines hidden (view full) ---

296 printk(KERN_ERR "NILFS: error loading super root.\n");
297 goto failed;
298 }
299
300 if (valid_fs)
301 goto skip_recovery;
302
303 if (s_flags & MS_RDONLY) {
304 if (nilfs_test_opt(sbi, NORECOVERY)) {
305 printk(KERN_INFO "NILFS: norecovery option specified. "
306 "skipping roll-forward recovery\n");
307 goto skip_recovery;
308 }
298 if (really_read_only) {
299 printk(KERN_ERR "NILFS: write access "
300 "unavailable, cannot proceed.\n");
301 err = -EROFS;
302 goto failed_unload;
303 }
304 sbi->s_super->s_flags &= ~MS_RDONLY;
309 if (really_read_only) {
310 printk(KERN_ERR "NILFS: write access "
311 "unavailable, cannot proceed.\n");
312 err = -EROFS;
313 goto failed_unload;
314 }
315 sbi->s_super->s_flags &= ~MS_RDONLY;
316 } else if (nilfs_test_opt(sbi, NORECOVERY)) {
317 printk(KERN_ERR "NILFS: recovery cancelled because norecovery "
318 "option was specified for a read/write mount\n");
319 err = -EINVAL;
320 goto failed_unload;
305 }
306
307 err = nilfs_recover_logical_segments(nilfs, sbi, &ri);
308 if (err)
309 goto failed_unload;
310
311 down_write(&nilfs->ns_sem);
312 nilfs->ns_mount_state |= NILFS_VALID_FS;

--- 419 unchanged lines hidden ---
321 }
322
323 err = nilfs_recover_logical_segments(nilfs, sbi, &ri);
324 if (err)
325 goto failed_unload;
326
327 down_write(&nilfs->ns_sem);
328 nilfs->ns_mount_state |= NILFS_VALID_FS;

--- 419 unchanged lines hidden ---