Lines Matching refs:sb
10 static __le32 ext4_mmp_csum(struct super_block *sb, struct mmp_struct *mmp) in ext4_mmp_csum() argument
12 struct ext4_sb_info *sbi = EXT4_SB(sb); in ext4_mmp_csum()
21 static int ext4_mmp_csum_verify(struct super_block *sb, struct mmp_struct *mmp) in ext4_mmp_csum_verify() argument
23 if (!ext4_has_metadata_csum(sb)) in ext4_mmp_csum_verify()
26 return mmp->mmp_checksum == ext4_mmp_csum(sb, mmp); in ext4_mmp_csum_verify()
29 static void ext4_mmp_csum_set(struct super_block *sb, struct mmp_struct *mmp) in ext4_mmp_csum_set() argument
31 if (!ext4_has_metadata_csum(sb)) in ext4_mmp_csum_set()
34 mmp->mmp_checksum = ext4_mmp_csum(sb, mmp); in ext4_mmp_csum_set()
41 static int write_mmp_block(struct super_block *sb, struct buffer_head *bh) in write_mmp_block() argument
49 sb_start_write(sb); in write_mmp_block()
50 ext4_mmp_csum_set(sb, mmp); in write_mmp_block()
57 sb_end_write(sb); in write_mmp_block()
68 static int read_mmp_block(struct super_block *sb, struct buffer_head **bh, in read_mmp_block() argument
80 *bh = sb_getblk(sb, mmp_block); in read_mmp_block()
95 ext4_warning(sb, "Error while reading MMP block %llu", in read_mmp_block()
102 !ext4_mmp_csum_verify(sb, mmp)) in read_mmp_block()
111 void __dump_mmp_msg(struct super_block *sb, struct mmp_struct *mmp, in __dump_mmp_msg() argument
114 __ext4_warning(sb, function, line, msg); in __dump_mmp_msg()
115 __ext4_warning(sb, function, line, in __dump_mmp_msg()
127 struct super_block *sb = ((struct mmpd_data *) data)->sb; in kmmpd() local
129 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in kmmpd()
163 retval = write_mmp_block(sb, bh); in kmmpd()
170 ext4_error(sb, "Error writing to MMP block"); in kmmpd()
176 ext4_warning(sb, "kmmpd being stopped since MMP feature" in kmmpd()
178 EXT4_SB(sb)->s_mmp_tsk = NULL; in kmmpd()
182 if (sb->s_flags & MS_RDONLY) { in kmmpd()
183 ext4_warning(sb, "kmmpd being stopped since filesystem " in kmmpd()
185 EXT4_SB(sb)->s_mmp_tsk = NULL; in kmmpd()
204 retval = read_mmp_block(sb, &bh_check, mmp_block); in kmmpd()
206 ext4_error(sb, "error reading MMP data: %d", in kmmpd()
209 EXT4_SB(sb)->s_mmp_tsk = NULL; in kmmpd()
217 dump_mmp_msg(sb, mmp_check, in kmmpd()
221 ext4_error(sb, "abort"); in kmmpd()
243 retval = write_mmp_block(sb, bh); in kmmpd()
269 int ext4_multi_mount_protect(struct super_block *sb, in ext4_multi_mount_protect() argument
272 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in ext4_multi_mount_protect()
283 ext4_warning(sb, "Invalid MMP block in superblock"); in ext4_multi_mount_protect()
287 retval = read_mmp_block(sb, &bh, mmp_block); in ext4_multi_mount_protect()
308 dump_mmp_msg(sb, mmp, "fsck is running on the filesystem"); in ext4_multi_mount_protect()
317 ext4_warning(sb, "MMP interval %u higher than expected, please" in ext4_multi_mount_protect()
321 ext4_warning(sb, "MMP startup interrupted, failing mount\n"); in ext4_multi_mount_protect()
325 retval = read_mmp_block(sb, &bh, mmp_block); in ext4_multi_mount_protect()
330 dump_mmp_msg(sb, mmp, in ext4_multi_mount_protect()
342 retval = write_mmp_block(sb, bh); in ext4_multi_mount_protect()
350 ext4_warning(sb, "MMP startup interrupted, failing mount\n"); in ext4_multi_mount_protect()
354 retval = read_mmp_block(sb, &bh, mmp_block); in ext4_multi_mount_protect()
359 dump_mmp_msg(sb, mmp, in ext4_multi_mount_protect()
366 ext4_warning(sb, "not enough memory for mmpd_data"); in ext4_multi_mount_protect()
369 mmpd_data->sb = sb; in ext4_multi_mount_protect()
375 EXT4_SB(sb)->s_mmp_tsk = kthread_run(kmmpd, mmpd_data, "kmmpd-%s", in ext4_multi_mount_protect()
378 if (IS_ERR(EXT4_SB(sb)->s_mmp_tsk)) { in ext4_multi_mount_protect()
379 EXT4_SB(sb)->s_mmp_tsk = NULL; in ext4_multi_mount_protect()
381 ext4_warning(sb, "Unable to create kmmpd thread for %s.", in ext4_multi_mount_protect()
382 sb->s_id); in ext4_multi_mount_protect()