Commit eb8ab444 authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o
Browse files

ext4: make ext4_forced_shutdown() take struct super_block



Currently ext4_forced_shutdown() takes struct ext4_sb_info but most
callers need to get it from struct super_block anyway. So just pass in
struct super_block to save all callers from some boilerplate code. No
functional changes.

Signed-off-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230616165109.21695-3-jack@suse.cz


Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent d5d020b3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2222,9 +2222,9 @@ extern int ext4_feature_set_ok(struct super_block *sb, int readonly);
#define EXT4_FLAGS_SHUTDOWN	1
#define EXT4_FLAGS_BDEV_IS_DAX	2

static inline int ext4_forced_shutdown(struct ext4_sb_info *sbi)
static inline int ext4_forced_shutdown(struct super_block *sb)
{
	return test_bit(EXT4_FLAGS_SHUTDOWN, &sbi->s_ext4_flags);
	return test_bit(EXT4_FLAGS_SHUTDOWN, &EXT4_SB(sb)->s_ext4_flags);
}

/*
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ static int ext4_journal_check_start(struct super_block *sb)

	might_sleep();

	if (unlikely(ext4_forced_shutdown(EXT4_SB(sb))))
	if (unlikely(ext4_forced_shutdown(sb)))
		return -EIO;

	if (sb_rdonly(sb))
+6 −7
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ static ssize_t ext4_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
{
	struct inode *inode = file_inode(iocb->ki_filp);

	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
	if (unlikely(ext4_forced_shutdown(inode->i_sb)))
		return -EIO;

	if (!iov_iter_count(to))
@@ -153,7 +153,7 @@ static ssize_t ext4_file_splice_read(struct file *in, loff_t *ppos,
{
	struct inode *inode = file_inode(in);

	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
	if (unlikely(ext4_forced_shutdown(inode->i_sb)))
		return -EIO;
	return filemap_splice_read(in, ppos, pipe, len, flags);
}
@@ -709,7 +709,7 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
{
	struct inode *inode = file_inode(iocb->ki_filp);

	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
	if (unlikely(ext4_forced_shutdown(inode->i_sb)))
		return -EIO;

#ifdef CONFIG_FS_DAX
@@ -807,10 +807,9 @@ static const struct vm_operations_struct ext4_file_vm_ops = {
static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
{
	struct inode *inode = file->f_mapping->host;
	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
	struct dax_device *dax_dev = sbi->s_daxdev;
	struct dax_device *dax_dev = EXT4_SB(inode->i_sb)->s_daxdev;

	if (unlikely(ext4_forced_shutdown(sbi)))
	if (unlikely(ext4_forced_shutdown(inode->i_sb)))
		return -EIO;

	/*
@@ -886,7 +885,7 @@ static int ext4_file_open(struct inode *inode, struct file *filp)
{
	int ret;

	if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
	if (unlikely(ext4_forced_shutdown(inode->i_sb)))
		return -EIO;

	ret = ext4_sample_last_mounted(inode->i_sb, filp->f_path.mnt);
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
	struct inode *inode = file->f_mapping->host;
	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);

	if (unlikely(ext4_forced_shutdown(sbi)))
	if (unlikely(ext4_forced_shutdown(inode->i_sb)))
		return -EIO;

	ASSERT(ext4_journal_current_handle() == NULL);
+1 −1
Original line number Diff line number Diff line
@@ -950,7 +950,7 @@ struct inode *__ext4_new_inode(struct mnt_idmap *idmap,
	sb = dir->i_sb;
	sbi = EXT4_SB(sb);

	if (unlikely(ext4_forced_shutdown(sbi)))
	if (unlikely(ext4_forced_shutdown(sb)))
		return ERR_PTR(-EIO);

	ngroups = ext4_get_groups_count(sb);
Loading