super.c (bde4e696e4a527c3cc579ed77e4844d11ca17e12) | super.c (7ecaa46cfea453238a369b3019739d50ff5d7c37) |
---|---|
1/* 2 * super.c - NILFS module and super block management. 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 --- 264 unchanged lines hidden (view full) --- 273 if (dupsb && sbp[1]) { 274 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); 275 nilfs->ns_sbwtime[1] = t; 276 } 277 clear_nilfs_sb_dirty(nilfs); 278 return nilfs_sync_super(sbi, dupsb); 279} 280 | 1/* 2 * super.c - NILFS module and super block management. 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 --- 264 unchanged lines hidden (view full) --- 273 if (dupsb && sbp[1]) { 274 memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); 275 nilfs->ns_sbwtime[1] = t; 276 } 277 clear_nilfs_sb_dirty(nilfs); 278 return nilfs_sync_super(sbi, dupsb); 279} 280 |
281/** 282 * nilfs_cleanup_super() - write filesystem state for cleanup 283 * @sbi: nilfs_sb_info to be unmounted or degraded to read-only 284 * 285 * This function restores state flags in the on-disk super block. 286 * This will set "clean" flag (i.e. NILFS_VALID_FS) unless the 287 * filesystem was not clean previously. 288 */ 289int nilfs_cleanup_super(struct nilfs_sb_info *sbi) 290{ 291 struct nilfs_super_block **sbp = sbi->s_nilfs->ns_sbp; 292 int ret; 293 294 sbp[0]->s_state = cpu_to_le16(sbi->s_nilfs->ns_mount_state); 295 ret = nilfs_commit_super(sbi, 1); 296 return ret; 297} 298 |
|
281static void nilfs_put_super(struct super_block *sb) 282{ 283 struct nilfs_sb_info *sbi = NILFS_SB(sb); 284 struct the_nilfs *nilfs = sbi->s_nilfs; 285 286 lock_kernel(); 287 288 nilfs_detach_segment_constructor(sbi); 289 290 if (!(sb->s_flags & MS_RDONLY)) { 291 down_write(&nilfs->ns_sem); | 299static void nilfs_put_super(struct super_block *sb) 300{ 301 struct nilfs_sb_info *sbi = NILFS_SB(sb); 302 struct the_nilfs *nilfs = sbi->s_nilfs; 303 304 lock_kernel(); 305 306 nilfs_detach_segment_constructor(sbi); 307 308 if (!(sb->s_flags & MS_RDONLY)) { 309 down_write(&nilfs->ns_sem); |
292 nilfs->ns_sbp[0]->s_state = cpu_to_le16(nilfs->ns_mount_state); 293 nilfs_commit_super(sbi, 1); | 310 nilfs_cleanup_super(sbi); |
294 up_write(&nilfs->ns_sem); 295 } 296 down_write(&nilfs->ns_super_sem); 297 if (nilfs->ns_current == sbi) 298 nilfs->ns_current = NULL; 299 up_write(&nilfs->ns_super_sem); 300 301 nilfs_detach_checkpoint(sbi); --- 512 unchanged lines hidden (view full) --- 814 sb->s_fs_info = NULL; 815 nilfs_put_sbinfo(sbi); 816 return err; 817} 818 819static int nilfs_remount(struct super_block *sb, int *flags, char *data) 820{ 821 struct nilfs_sb_info *sbi = NILFS_SB(sb); | 311 up_write(&nilfs->ns_sem); 312 } 313 down_write(&nilfs->ns_super_sem); 314 if (nilfs->ns_current == sbi) 315 nilfs->ns_current = NULL; 316 up_write(&nilfs->ns_super_sem); 317 318 nilfs_detach_checkpoint(sbi); --- 512 unchanged lines hidden (view full) --- 831 sb->s_fs_info = NULL; 832 nilfs_put_sbinfo(sbi); 833 return err; 834} 835 836static int nilfs_remount(struct super_block *sb, int *flags, char *data) 837{ 838 struct nilfs_sb_info *sbi = NILFS_SB(sb); |
822 struct nilfs_super_block *sbp; | |
823 struct the_nilfs *nilfs = sbi->s_nilfs; 824 unsigned long old_sb_flags; 825 struct nilfs_mount_options old_opts; 826 int was_snapshot, err; 827 828 lock_kernel(); 829 830 down_write(&nilfs->ns_super_sem); --- 44 unchanged lines hidden (view full) --- 875 nilfs_detach_segment_constructor(sbi); 876 sb->s_flags |= MS_RDONLY; 877 878 /* 879 * Remounting a valid RW partition RDONLY, so set 880 * the RDONLY flag and then mark the partition as valid again. 881 */ 882 down_write(&nilfs->ns_sem); | 839 struct the_nilfs *nilfs = sbi->s_nilfs; 840 unsigned long old_sb_flags; 841 struct nilfs_mount_options old_opts; 842 int was_snapshot, err; 843 844 lock_kernel(); 845 846 down_write(&nilfs->ns_super_sem); --- 44 unchanged lines hidden (view full) --- 891 nilfs_detach_segment_constructor(sbi); 892 sb->s_flags |= MS_RDONLY; 893 894 /* 895 * Remounting a valid RW partition RDONLY, so set 896 * the RDONLY flag and then mark the partition as valid again. 897 */ 898 down_write(&nilfs->ns_sem); |
883 sbp = nilfs->ns_sbp[0]; 884 if (!(sbp->s_state & le16_to_cpu(NILFS_VALID_FS)) && 885 (nilfs->ns_mount_state & NILFS_VALID_FS)) 886 sbp->s_state = cpu_to_le16(nilfs->ns_mount_state); 887 nilfs_commit_super(sbi, 1); | 899 nilfs_cleanup_super(sbi); |
888 up_write(&nilfs->ns_sem); 889 } else { 890 /* 891 * Mounting a RDONLY partition read-write, so reread and 892 * store the current valid flag. (It may have been changed 893 * by fsck since we originally mounted the partition.) 894 */ 895 sb->s_flags &= ~MS_RDONLY; --- 308 unchanged lines hidden --- | 900 up_write(&nilfs->ns_sem); 901 } else { 902 /* 903 * Mounting a RDONLY partition read-write, so reread and 904 * store the current valid flag. (It may have been changed 905 * by fsck since we originally mounted the partition.) 906 */ 907 sb->s_flags &= ~MS_RDONLY; --- 308 unchanged lines hidden --- |