int ext2_remount (struct super_block * sb, int * flags, char * data) { struct ext2_super_block * es; unsigned short resuid = sb->u.ext2_sb.s_resuid; unsigned short resgid = sb->u.ext2_sb.s_resgid; unsigned long new_mount_opt; unsigned long tmp; /* * Allow the "check" option to be passed as a remount option. */ new_mount_opt = EXT2_MOUNT_CHECK_NORMAL; if (!parse_options (data, &tmp, &resuid, &resgid, &new_mount_opt)) return -EINVAL; sb->u.ext2_sb.s_mount_opt = new_mount_opt; sb->u.ext2_sb.s_resuid = resuid; sb->u.ext2_sb.s_resgid = resgid; es = sb->u.ext2_sb.s_es; if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) return 0; if (*flags & MS_RDONLY) { if (es->s_state & EXT2_VALID_FS || !(sb->u.ext2_sb.s_mount_state & EXT2_VALID_FS)) return 0; /* * OK, we are remounting a valid rw partition rdonly, so set * the rdonly flag and then mark the partition as valid again. */ es->s_state = sb->u.ext2_sb.s_mount_state; es->s_mtime = CURRENT_TIME; mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1); sb->s_dirt = 1; ext2_commit_super (sb, es); } else { /* * Mounting a RDONLY partition read-write, so reread and * store the current valid flag. (It may have been changed * by e2fsck since we originally mounted the partition.) */ sb->u.ext2_sb.s_mount_state = es->s_state; sb->s_flags &= ~MS_RDONLY; ext2_setup_super (sb, es); } return 0; }
void ext2_write_super (struct super_block * sb) { struct ext2_super_block * es; if (!(sb->s_flags & MS_RDONLY)) { es = sb->u.ext2_sb.s_es; ext2_debug ("setting valid to 0\n"); if (es->s_state & EXT2_VALID_FS) { es->s_state &= ~EXT2_VALID_FS; es->s_mtime = CURRENT_TIME; } ext2_commit_super (sb, es); } sb->s_dirt = 0; }
void ext2_write_super (struct super_block * sb) { struct ext2_super_block * es; if (!(sb->s_flags & MS_RDONLY)) { es = sb->u.ext2_sb.s_es; if (le16_to_cpu(es->s_state) & EXT2_VALID_FS) { ext2_debug ("setting valid to 0\n"); es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT2_VALID_FS); es->s_mtime = cpu_to_le32(CURRENT_TIME); ext2_sync_super(sb, es); } else ext2_commit_super (sb, es); } sb->s_dirt = 0; }
void ext2_write_super (struct super_block * sb) { struct ext2_super_block * es; lock_kernel(); if (!(sb->s_flags & MS_RDONLY)) { es = EXT2_SB(sb)->s_es; if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) { ext2_debug ("setting valid to 0\n"); es->s_state &= cpu_to_le16(~EXT2_VALID_FS); es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb)); es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb)); es->s_mtime = cpu_to_le32(get_seconds()); ext2_sync_super(sb, es); } else ext2_commit_super (sb, es); } sb->s_dirt = 0; unlock_kernel(); }
static int ext2_sync_fs(struct super_block *sb, int wait) { struct ext2_super_block *es = EXT2_SB(sb)->s_es; lock_kernel(); if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) { ext2_debug("setting valid to 0\n"); es->s_state &= cpu_to_le16(~EXT2_VALID_FS); es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb)); es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb)); es->s_mtime = cpu_to_le32(get_seconds()); ext2_sync_super(sb, es); } else { ext2_commit_super(sb, es); } sb->s_dirt = 0; unlock_kernel(); return 0; }