Skip to contentSkip to conversation

f2fs: preallocate blocks for encrypted file

RFC PATCH In review Yunlei He 3 participants 3 messages Sep 18, 2016 – Sep 21, 2016 F2FS file system

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

RFC PATCH v2 1/1 f2fs: preallocate blocks for encrypted file

This patch allow preallocates data blocks for buffered aio writes in encrypted file.

---
 fs/f2fs/data.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
fs/f2fs/data.c +1 -5
index 3e0ef2d..932166e 100644
@@ -639,9 +639,6 @@ ssize_t f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from)
 
 	map.m_next_pgofs = NULL;
 
-	if (f2fs_encrypted_inode(inode))
-		return 0;
-
 	if (iocb->ki_flags & IOCB_DIRECT) {
 		ret = f2fs_convert_inline_inode(inode);
 		if (ret)
@@ -1532,8 +1529,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
 	 * we already allocated all the blocks, so we don't need to get
 	 * the block addresses when there is no need to fill the page.
 	 */
-	if (!f2fs_has_inline_data(inode) && !f2fs_encrypted_inode(inode) &&
-					len == PAGE_SIZE)
+	if (!f2fs_has_inline_data(inode) && len == PAGE_SIZE)
 		return 0;
 
 	if (f2fs_has_inline_data(inode) ||
Signature · 4 lines
1.9.1


------------------------------------------------------------------------------
Reviewed-by on v2 1/1
#1 lore raw
Quoted 4 lines · Yunlei He

This patch allow preallocates data blocks for buffered aio writes in encrypted file.

Quoted 20 lines
---
 fs/f2fs/data.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
fs/f2fs/data.c +0 -3
index 3e0ef2d..932166e 100644
@@ -639,9 +639,6 @@ ssize_t f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from)
 
 	map.m_next_pgofs = NULL;
 
-	if (f2fs_encrypted_inode(inode))
-		return 0;
-
 	if (iocb->ki_flags & IOCB_DIRECT) {
 		ret = f2fs_convert_inline_inode(inode);
 		if (ret)

fs/f2fs/data.c static int prepare_write_begin(struct f2fs_sb_info *sbi, · line 1535

Quoted 9 lines
fs/f2fs/data.c +1 -2
@@ -1532,8 +1529,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
 	 * we already allocated all the blocks, so we don't need to get
 	 * the block addresses when there is no need to fill the page.
 	 */
-	if (!f2fs_has_inline_data(inode) && !f2fs_encrypted_inode(inode) &&
-					len == PAGE_SIZE)
+	if (!f2fs_has_inline_data(inode) && len == PAGE_SIZE)
 		return 0;
 
 	if (f2fs_has_inline_data(inode) ||

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

maintainer
#2 lore raw
In reply to Yunlei He

Hi Yunlei,

I'll add the below bug fix into your patch.

---
 fs/f2fs/segment.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/f2fs/segment.c +1 -3
index abf1c3d..e78501c 100644
@@ -1653,11 +1653,9 @@ void f2fs_wait_on_encrypted_page_writeback(struct f2fs_sb_info *sbi,
 {
 	struct page *cpage;
 
-	if (blkaddr == NEW_ADDR)
+	if (blkaddr == NEW_ADDR || blkaddr == NULL_ADDR)
 		return;
 
-	f2fs_bug_on(sbi, blkaddr == NULL_ADDR);
-
 	cpage = find_lock_page(META_MAPPING(sbi), blkaddr);
 	if (cpage) {
 		f2fs_wait_on_page_writeback(cpage, DATA, true);
Signature · 3 lines
2.8.3

Thanks,
Quoted 41 lines · Yunlei He

This patch allow preallocates data blocks for buffered aio writes in encrypted file.

---
 fs/f2fs/data.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
fs/f2fs/data.c +1 -5
index 3e0ef2d..932166e 100644
@@ -639,9 +639,6 @@ ssize_t f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from)
 
 	map.m_next_pgofs = NULL;
 
-	if (f2fs_encrypted_inode(inode))
-		return 0;
-
 	if (iocb->ki_flags & IOCB_DIRECT) {
 		ret = f2fs_convert_inline_inode(inode);
 		if (ret)
@@ -1532,8 +1529,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
 	 * we already allocated all the blocks, so we don't need to get
 	 * the block addresses when there is no need to fill the page.
 	 */
-	if (!f2fs_has_inline_data(inode) && !f2fs_encrypted_inode(inode) &&
-					len == PAGE_SIZE)
+	if (!f2fs_has_inline_data(inode) && len == PAGE_SIZE)
 		return 0;
 
 	if (f2fs_has_inline_data(inode) ||
Signature · 8 lines
1.9.1


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

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