Skip to contentSkip to conversation

f2fs: don't grab super block buffer header all the time

PATCH In review Chao Yu 1 participant 1 message Dec 15, 2015 F2FS file system

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 2/3 f2fs: don't grab super block buffer header all the time

We have already got one copy of valid super block in memory, do not grab buffer header of super block all the time.

---
 fs/f2fs/f2fs.h  |  2 +-
 fs/f2fs/file.c  |  8 ++----
 fs/f2fs/super.c | 81 +++++++++++++++++++++++++--------------------------------
 3 files changed, 38 insertions(+), 53 deletions(-)
fs/f2fs/f2fs.h +1 -1
index ee1f0a8..c5d130a 100644
@@ -723,8 +723,8 @@ enum {
 struct f2fs_sb_info {
 	struct super_block *sb;			/* pointer to VFS super block */
 	struct proc_dir_entry *s_proc;		/* proc entry */
-	struct buffer_head *raw_super_buf;	/* buffer head of raw sb */
 	struct f2fs_super_block *raw_super;	/* raw super block pointer */
+	int valid_super_block;			/* valid super block no */
 	int s_flag;				/* flags for sbi */
 
 	/* for node-related operations */
fs/f2fs/file.c +2 -6
index c6d909e..0301551 100644
@@ -1591,20 +1591,16 @@ static int f2fs_ioc_get_encryption_pwsalt(struct file *filp, unsigned long arg)
 		return err;
 
 	/* update superblock with uuid */
-	lock_buffer(sbi->raw_super_buf);
 	generate_random_uuid(sbi->raw_super->encrypt_pw_salt);
-	unlock_buffer(sbi->raw_super_buf);
 
 	err = f2fs_commit_super(sbi, false);
-
-	mnt_drop_write_file(filp);
 	if (err) {
 		/* undo new data */
-		lock_buffer(sbi->raw_super_buf);
 		memset(sbi->raw_super->encrypt_pw_salt, 0, 16);
-		unlock_buffer(sbi->raw_super_buf);
+		mnt_drop_write_file(filp);
 		return err;
 	}
+	mnt_drop_write_file(filp);
 got_it:
 	if (copy_to_user((__u8 __user *)arg, sbi->raw_super->encrypt_pw_salt,
 									16))
fs/f2fs/super.c +35 -46

179 lines not on this page · raw message

Signature · 1 line
2.6.3