Lines Matching +full:update +full:- +full:interval

1 // SPDX-License-Identifier: GPL-2.0
17 csum = ext4_chksum(sbi, sbi->s_csum_seed, (char *)mmp, offset); in ext4_mmp_csum()
27 return mmp->mmp_checksum == ext4_mmp_csum(sb, mmp); in ext4_mmp_csum_verify()
35 mmp->mmp_checksum = ext4_mmp_csum(sb, mmp); in ext4_mmp_csum_set()
39 * Write the MMP block using REQ_SYNC to try to get the block on-disk
44 struct mmp_struct *mmp = (struct mmp_struct *)(bh->b_data); in write_mmp_block()
53 bh->b_end_io = end_buffer_write_sync; in write_mmp_block()
59 return -EIO; in write_mmp_block()
83 ret = -ENOMEM; in read_mmp_block()
93 mmp = (struct mmp_struct *)((*bh)->b_data); in read_mmp_block()
94 if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC) { in read_mmp_block()
95 ret = -EFSCORRUPTED; in read_mmp_block()
99 ret = -EFSBADCRC; in read_mmp_block()
119 … "MMP failure info: last update time: %llu, last update node: %.*s, last update device: %.*s", in __dump_mmp_msg()
120 (unsigned long long)le64_to_cpu(mmp->mmp_time), in __dump_mmp_msg()
121 (int)sizeof(mmp->mmp_nodename), mmp->mmp_nodename, in __dump_mmp_msg()
122 (int)sizeof(mmp->mmp_bdevname), mmp->mmp_bdevname); in __dump_mmp_msg()
126 * kmmpd will update the MMP sequence every s_mmp_update_interval seconds
131 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in kmmpd()
132 struct buffer_head *bh = EXT4_SB(sb)->s_mmp_bh; in kmmpd()
137 int mmp_update_interval = le16_to_cpu(es->s_mmp_update_interval); in kmmpd()
143 mmp_block = le64_to_cpu(es->s_mmp_block); in kmmpd()
144 mmp = (struct mmp_struct *)(bh->b_data); in kmmpd()
145 mmp->mmp_time = cpu_to_le64(ktime_get_real_seconds()); in kmmpd()
152 mmp->mmp_check_interval = cpu_to_le16(mmp_check_interval); in kmmpd()
154 memcpy(mmp->mmp_nodename, init_utsname()->nodename, in kmmpd()
155 sizeof(mmp->mmp_nodename)); in kmmpd()
166 mmp->mmp_seq = cpu_to_le32(seq); in kmmpd()
167 mmp->mmp_time = cpu_to_le64(ktime_get_real_seconds()); in kmmpd()
177 ext4_error_err(sb, -retval, in kmmpd()
183 diff = jiffies - last_update_time; in kmmpd()
186 HZ - diff); in kmmpd()
193 diff = jiffies - last_update_time; in kmmpd()
200 ext4_error_err(sb, -retval, in kmmpd()
206 mmp_check = (struct mmp_struct *)(bh_check->b_data); in kmmpd()
207 if (mmp->mmp_seq != mmp_check->mmp_seq || in kmmpd()
208 memcmp(mmp->mmp_nodename, mmp_check->mmp_nodename, in kmmpd()
209 sizeof(mmp->mmp_nodename))) { in kmmpd()
216 retval = -EBUSY; in kmmpd()
229 mmp->mmp_check_interval = cpu_to_le16(mmp_check_interval); in kmmpd()
235 mmp->mmp_seq = cpu_to_le32(EXT4_MMP_SEQ_CLEAN); in kmmpd()
236 mmp->mmp_time = cpu_to_le64(ktime_get_real_seconds()); in kmmpd()
252 if (sbi->s_mmp_tsk) { in ext4_stop_mmpd()
253 kthread_stop(sbi->s_mmp_tsk); in ext4_stop_mmpd()
254 brelse(sbi->s_mmp_bh); in ext4_stop_mmpd()
255 sbi->s_mmp_tsk = NULL; in ext4_stop_mmpd()
280 struct ext4_super_block *es = EXT4_SB(sb)->s_es; in ext4_multi_mount_protect()
284 unsigned int mmp_check_interval = le16_to_cpu(es->s_mmp_update_interval); in ext4_multi_mount_protect()
288 if (mmp_block < le32_to_cpu(es->s_first_data_block) || in ext4_multi_mount_protect()
298 mmp = (struct mmp_struct *)(bh->b_data); in ext4_multi_mount_protect()
307 if (le16_to_cpu(mmp->mmp_check_interval) > mmp_check_interval) in ext4_multi_mount_protect()
308 mmp_check_interval = le16_to_cpu(mmp->mmp_check_interval); in ext4_multi_mount_protect()
310 seq = le32_to_cpu(mmp->mmp_seq); in ext4_multi_mount_protect()
322 /* Print MMP interval if more than 20 secs. */ in ext4_multi_mount_protect()
324 ext4_warning(sb, "MMP interval %u higher than expected, please" in ext4_multi_mount_protect()
335 mmp = (struct mmp_struct *)(bh->b_data); in ext4_multi_mount_protect()
336 if (seq != le32_to_cpu(mmp->mmp_seq)) { in ext4_multi_mount_protect()
347 mmp->mmp_seq = cpu_to_le32(seq); in ext4_multi_mount_protect()
354 * wait for MMP interval and check mmp_seq. in ext4_multi_mount_protect()
364 mmp = (struct mmp_struct *)(bh->b_data); in ext4_multi_mount_protect()
365 if (seq != le32_to_cpu(mmp->mmp_seq)) { in ext4_multi_mount_protect()
371 EXT4_SB(sb)->s_mmp_bh = bh; in ext4_multi_mount_protect()
373 BUILD_BUG_ON(sizeof(mmp->mmp_bdevname) < BDEVNAME_SIZE); in ext4_multi_mount_protect()
374 snprintf(mmp->mmp_bdevname, sizeof(mmp->mmp_bdevname), in ext4_multi_mount_protect()
375 "%pg", bh->b_bdev); in ext4_multi_mount_protect()
378 * Start a kernel thread to update the MMP block periodically. in ext4_multi_mount_protect()
380 EXT4_SB(sb)->s_mmp_tsk = kthread_run(kmmpd, sb, "kmmpd-%.*s", in ext4_multi_mount_protect()
381 (int)sizeof(mmp->mmp_bdevname), in ext4_multi_mount_protect()
382 mmp->mmp_bdevname); in ext4_multi_mount_protect()
383 if (IS_ERR(EXT4_SB(sb)->s_mmp_tsk)) { in ext4_multi_mount_protect()
384 EXT4_SB(sb)->s_mmp_tsk = NULL; in ext4_multi_mount_protect()
386 sb->s_id); in ext4_multi_mount_protect()