Skip to contentSkip to conversation

quota: mark dquot_load_quota_sb static

PATCH In review Christoph Hellwig 2 participants 4 messages Aug 2, 2023 – Aug 3, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 quota: mark dquot_load_quota_sb static

dquot_load_quota_sb is only used in dquot.c, so mark it static.

---
 fs/quota/dquot.c         | 5 ++---
 include/linux/quotaops.h | 2 --
 2 files changed, 2 insertions(+), 5 deletions(-)
fs/quota/dquot.c +2 -3
index e3e4f40476579c..a0c577ab2b7b26 100644
@@ -2352,8 +2352,8 @@ static int vfs_setup_quota_inode(struct inode *inode, int type)
 	return 0;
 }
 
-int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
-	unsigned int flags)
+static int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
+		unsigned int flags)
 {
 	struct quota_format_type *fmt = find_quota_format(format_id);
 	struct quota_info *dqopt = sb_dqopt(sb);
@@ -2429,7 +2429,6 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
 
 	return error;
 }
-EXPORT_SYMBOL(dquot_load_quota_sb);
 
 /*
  * More powerful function for turning on quotas on given quota inode allowing
include/linux/quotaops.h +0 -2
index 11a4becff3a983..671fd306ccf01c 100644
@@ -95,8 +95,6 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
 
 int dquot_file_open(struct inode *inode, struct file *file);
 
-int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
-	unsigned int flags);
 int dquot_load_quota_inode(struct inode *inode, int type, int format_id,
 	unsigned int flags);
 int dquot_quota_on(struct super_block *sb, int type, int format_id,
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 quota: use lockdep_assert_held_write in dquot_load_quota_sb

Use lockdep_assert_held_write to assert and self-document the locking state in dquot_load_quota_sb instead of hand-crafting it with a trylock.

---
 fs/quota/dquot.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/quota/dquot.c +2 -3
index a0c577ab2b7b26..2eb59646d3a1a3 100644
@@ -2359,11 +2359,10 @@ static int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
 	struct quota_info *dqopt = sb_dqopt(sb);
 	int error;
 
+	lockdep_assert_held_write(&sb->s_umount);
+
 	/* Just unsuspend quotas? */
 	BUG_ON(flags & DQUOT_SUSPENDED);
-	/* s_umount should be held in exclusive mode */
-	if (WARN_ON_ONCE(down_read_trylock(&sb->s_umount)))
-		up_read(&sb->s_umount);
 
 	if (!fmt)
 		return -ESRCH;
Signature · 1 line
2.39.2
reviewer
#2 lore raw
In reply to Christoph Hellwig
Quoted 3 lines · Christoph Hellwig

dquot_load_quota_sb is only used in dquot.c, so mark it static.

Thanks for the cleanups! I've merged both into my tree.

Honza

Quoted 44 lines
---
 fs/quota/dquot.c         | 5 ++---
 include/linux/quotaops.h | 2 --
 2 files changed, 2 insertions(+), 5 deletions(-)
fs/quota/dquot.c +2 -3
index e3e4f40476579c..a0c577ab2b7b26 100644
@@ -2352,8 +2352,8 @@ static int vfs_setup_quota_inode(struct inode *inode, int type)
 	return 0;
 }
 
-int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
-	unsigned int flags)
+static int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
+		unsigned int flags)
 {
 	struct quota_format_type *fmt = find_quota_format(format_id);
 	struct quota_info *dqopt = sb_dqopt(sb);
@@ -2429,7 +2429,6 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
 
 	return error;
 }
-EXPORT_SYMBOL(dquot_load_quota_sb);
 
 /*
  * More powerful function for turning on quotas on given quota inode allowing
include/linux/quotaops.h +0 -2
index 11a4becff3a983..671fd306ccf01c 100644
@@ -95,8 +95,6 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
 
 int dquot_file_open(struct inode *inode, struct file *file);
 
-int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
-	unsigned int flags);
 int dquot_load_quota_inode(struct inode *inode, int type, int format_id,
 	unsigned int flags);
 int dquot_quota_on(struct super_block *sb, int type, int format_id,
Signature · 1 line
2.39.2
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
reviewer
#3 lore raw
Quoted 6 lines · Jan Kara
Quoted 3 lines · Christoph Hellwig

dquot_load_quota_sb is only used in dquot.c, so mark it static.

Thanks for the cleanups! I've merged both into my tree.

Actually, the new tmpfs quota support uses dquot_load_quota_sb() call as linux-next testing revealed so I've removed the first patch from my tree.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR