Skip to content

Commit

Permalink
Merge tag 'fs_for_v6.4-rc1' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/jack/linux-fs

Pull ext2, reiserfs, udf, and quota updates from Jan Kara:
 "A couple of small fixes and cleanups for ext2, udf, reiserfs, and
  quota.

  The biggest change is making CONFIG_PRINT_QUOTA_WARNING depend on
  BROKEN with an outlook for removing it completely in an year or so"

* tag 'fs_for_v6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  quota: mark PRINT_QUOTA_WARNING as BROKEN
  quota: update Kconfig comment
  reiserfs: remove unused iter variable
  quota: Use register_sysctl_init() for registering fs_dqstats_table
  reiserfs: remove unused sched_count variable
  ext2: remove redundant assignment to pointer end
  quota: make dquot_set_dqinfo return errors from ->write_info
  quota: fixup *_write_file_info() to return proper error code
  quota: simplify two-level sysctl registration for fs_dqstats_table
  udf: use wrapper i_blocksize() in udf_discard_prealloc()
  udf: Use folios in udf_adinicb_writepage()
  ext2: Check block size validity during mount
  ext2: Correct maximum ext2 filesystem block size
  • Loading branch information
Linus Torvalds committed Apr 26, 2023
2 parents 0cfcde1 + 36d532d commit 94fc079
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 39 deletions.
3 changes: 2 additions & 1 deletion fs/ext2/ext2.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
* Macro-instructions used to manage several block sizes
*/
#define EXT2_MIN_BLOCK_SIZE 1024
#define EXT2_MAX_BLOCK_SIZE 4096
#define EXT2_MAX_BLOCK_SIZE 65536
#define EXT2_MIN_BLOCK_LOG_SIZE 10
#define EXT2_MAX_BLOCK_LOG_SIZE 16
#define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
Expand Down
7 changes: 7 additions & 0 deletions fs/ext2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
goto failed_mount;
}

if (le32_to_cpu(es->s_log_block_size) >
(EXT2_MAX_BLOCK_LOG_SIZE - BLOCK_SIZE_BITS)) {
ext2_msg(sb, KERN_ERR,
"Invalid log block size: %u",
le32_to_cpu(es->s_log_block_size));
goto failed_mount;
}
blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);

if (test_opt(sb, DAX)) {
Expand Down
1 change: 0 additions & 1 deletion fs/ext2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
error = -ENOMEM;
if (header == NULL)
goto cleanup;
end = (char *)header + sb->s_blocksize;
header->h_magic = cpu_to_le32(EXT2_XATTR_MAGIC);
header->h_blocks = header->h_refcount = cpu_to_le32(1);
last = here = ENTRY(header+1);
Expand Down
4 changes: 2 additions & 2 deletions fs/quota/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ config QUOTA
help
If you say Y here, you will be able to set per user limits for disk
usage (also called disk quotas). Currently, it works for the
ext2, ext3, ext4, jfs, ocfs2 and reiserfs file systems.
ext2, ext3, ext4, f2fs, jfs, ocfs2 and reiserfs file systems.
Note that gfs2 and xfs use their own quota system.
Ext3, ext4 and reiserfs also support journaled quotas for which
you don't need to run quotacheck(8) after an unclean shutdown.
Expand All @@ -28,7 +28,7 @@ config QUOTA_NETLINK_INTERFACE

config PRINT_QUOTA_WARNING
bool "Print quota warnings to console (OBSOLETE)"
depends on QUOTA
depends on QUOTA && BROKEN
default y
help
If you say Y here, quota warnings (about exceeding softlimit, reaching
Expand Down
24 changes: 2 additions & 22 deletions fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2819,7 +2819,6 @@ EXPORT_SYMBOL(dquot_get_state);
int dquot_set_dqinfo(struct super_block *sb, int type, struct qc_info *ii)
{
struct mem_dqinfo *mi;
int err = 0;

if ((ii->i_fieldmask & QC_WARNS_MASK) ||
(ii->i_fieldmask & QC_RT_SPC_TIMER))
Expand All @@ -2846,8 +2845,7 @@ int dquot_set_dqinfo(struct super_block *sb, int type, struct qc_info *ii)
spin_unlock(&dq_data_lock);
mark_info_dirty(sb, type);
/* Force write to disk */
sb->dq_op->write_info(sb, type);
return err;
return sb->dq_op->write_info(sb, type);
}
EXPORT_SYMBOL(dquot_set_dqinfo);

Expand Down Expand Up @@ -2948,32 +2946,14 @@ static struct ctl_table fs_dqstats_table[] = {
{ },
};

static struct ctl_table fs_table[] = {
{
.procname = "quota",
.mode = 0555,
.child = fs_dqstats_table,
},
{ },
};

static struct ctl_table sys_table[] = {
{
.procname = "fs",
.mode = 0555,
.child = fs_table,
},
{ },
};

static int __init dquot_init(void)
{
int i, ret;
unsigned long nr_hash, order;

printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__);

register_sysctl_table(sys_table);
register_sysctl_init("fs/quota", fs_dqstats_table);

dquot_cachep = kmem_cache_create("dquot",
sizeof(struct dquot), sizeof(unsigned long) * 4,
Expand Down
2 changes: 1 addition & 1 deletion fs/quota/quota_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static int v1_write_file_info(struct super_block *sb, int type)
sizeof(struct v1_disk_dqblk), v1_dqoff(0));
if (ret == sizeof(struct v1_disk_dqblk))
ret = 0;
else if (ret > 0)
else if (ret >= 0)
ret = -EIO;
out:
up_write(&dqopt->dqio_sem);
Expand Down
2 changes: 1 addition & 1 deletion fs/quota/quota_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static int v2_write_file_info(struct super_block *sb, int type)
up_write(&dqopt->dqio_sem);
if (size != sizeof(struct v2_disk_dqinfo)) {
quota_error(sb, "Can't write info structure");
return -1;
return size < 0 ? size : -EIO;
}
return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions fs/reiserfs/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3031,7 +3031,6 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th,
unsigned int old_trans_id;
struct reiserfs_journal *journal = SB_JOURNAL(sb);
struct reiserfs_transaction_handle myth;
int sched_count = 0;
int retval;
int depth;

Expand Down Expand Up @@ -3088,7 +3087,6 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th,
((journal->j_len + nblocks + 2) * 100) <
(journal->j_len_alloc * 75)) {
if (atomic_read(&journal->j_wcount) > 10) {
sched_count++;
queue_log_writer(sb);
goto relock;
}
Expand Down
2 changes: 0 additions & 2 deletions fs/reiserfs/stree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,6 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th,

#ifdef CONFIG_REISERFS_CHECK
char mode;
int iter = 0;
#endif

BUG_ON(!th->t_trans_id);
Expand All @@ -1274,7 +1273,6 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
removed = 0;

#ifdef CONFIG_REISERFS_CHECK
iter++;
mode =
#endif
prepare_for_delete_or_cut(th, inode, path,
Expand Down
10 changes: 5 additions & 5 deletions fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ static void udf_write_failed(struct address_space *mapping, loff_t to)
static int udf_adinicb_writepage(struct folio *folio,
struct writeback_control *wbc, void *data)
{
struct page *page = &folio->page;
struct inode *inode = page->mapping->host;
struct inode *inode = folio->mapping->host;
struct udf_inode_info *iinfo = UDF_I(inode);

BUG_ON(!PageLocked(page));
memcpy_from_page(iinfo->i_data + iinfo->i_lenEAttr, page, 0,
BUG_ON(!folio_test_locked(folio));
BUG_ON(folio->index != 0);
memcpy_from_file_folio(iinfo->i_data + iinfo->i_lenEAttr, folio, 0,
i_size_read(inode));
unlock_page(page);
folio_unlock(folio);
mark_inode_dirty(inode);

return 0;
Expand Down
4 changes: 2 additions & 2 deletions fs/udf/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void udf_discard_prealloc(struct inode *inode)
uint64_t lbcount = 0;
int8_t etype = -1;
struct udf_inode_info *iinfo = UDF_I(inode);
int bsize = 1 << inode->i_blkbits;
int bsize = i_blocksize(inode);

if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB ||
ALIGN(inode->i_size, bsize) == ALIGN(iinfo->i_lenExtents, bsize))
Expand All @@ -149,7 +149,7 @@ void udf_discard_prealloc(struct inode *inode)
lbcount -= elen;
udf_delete_aext(inode, prev_epos);
udf_free_blocks(inode->i_sb, inode, &eloc, 0,
DIV_ROUND_UP(elen, 1 << inode->i_blkbits));
DIV_ROUND_UP(elen, bsize));
}
/* This inode entry is in-memory only and thus we don't have to mark
* the inode dirty */
Expand Down

0 comments on commit 94fc079

Please sign in to comment.