Skip to contentSkip to conversation

fs/f2fs: avoid redundant convert of inline inode

PATCH In review Zhang Zhen 2 participants 2 messages Sep 15, 2015 1 message not in the archive F2FS file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Zhang Zhen

author
#1 lore raw

PATCH 1/1 fs/f2fs: avoid redundant convert of inline inode

Encrypted inode for regular file should not have inline_data. Here we check encrypted inode before convert of inline inode to avoid redundant convert.

---
 fs/f2fs/data.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/f2fs/data.c +3 -3
index a82abe9..ec2270a 100644
@@ -1535,6 +1535,9 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
 	size_t count = iov_iter_count(iter);
 	int err;
 
+	if (f2fs_encrypted_inode(inode) && S_ISREG(inode->i_mode))
+		return 0;
+
 	/* we don't need to use inline_data strictly */
 	if (f2fs_has_inline_data(inode)) {
 		err = f2fs_convert_inline_inode(inode);
@@ -1542,9 +1545,6 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
 			return err;
 	}
 
-	if (f2fs_encrypted_inode(inode) && S_ISREG(inode->i_mode))
-		return 0;
-
 	err = check_direct_IO(inode, iter, offset);
 	if (err)
 		return err;
Signature · 10 lines
1.9.1


.





------------------------------------------------------------------------------
maintainer
#2 lore raw

Hi Zhang,

Quoted 3 lines · Zhang Zhen

Encrypted inode for regular file should not have inline_data. Here we check encrypted inode before convert of inline inode to avoid redundant convert.

When a new file is created in an encrypted dir, it does not set inline_data, which returns false for the below f2fs_has_inline_data() all the time. So, I don't think there happens any redundant conversion.

Thanks,

Quoted 45 lines
---
 fs/f2fs/data.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/f2fs/data.c +3 -3
index a82abe9..ec2270a 100644
@@ -1535,6 +1535,9 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
 	size_t count = iov_iter_count(iter);
 	int err;
 
+	if (f2fs_encrypted_inode(inode) && S_ISREG(inode->i_mode))
+		return 0;
+
 	/* we don't need to use inline_data strictly */
 	if (f2fs_has_inline_data(inode)) {
 		err = f2fs_convert_inline_inode(inode);
@@ -1542,9 +1545,6 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
 			return err;
 	}
 
-	if (f2fs_encrypted_inode(inode) && S_ISREG(inode->i_mode))
-		return 0;
-
 	err = check_direct_IO(inode, iter, offset);
 	if (err)
 		return err;
Signature · 14 lines
1.9.1


.





------------------------------------------------------------------------------
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------