linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2] f2fs: preallocate blocks for encrypted file
@ 2016-09-18  0:16 Yunlei He
  2016-09-19  0:36 ` Chao Yu
  2016-09-21  0:42 ` Jaegeuk Kim
  0 siblings, 2 replies; 3+ messages in thread
From: Yunlei He @ 2016-09-18  0:16 UTC (permalink / raw)
  To: linux-f2fs-devel, jaegeuk, yuchao0; +Cc: heyunlei

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

Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
 fs/f2fs/data.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 3e0ef2d..932166e 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -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) ||
-- 
1.9.1


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH v2] f2fs: preallocate blocks for encrypted file
  2016-09-18  0:16 [RFC PATCH v2] f2fs: preallocate blocks for encrypted file Yunlei He
@ 2016-09-19  0:36 ` Chao Yu
  2016-09-21  0:42 ` Jaegeuk Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2016-09-19  0:36 UTC (permalink / raw)
  To: Yunlei He, linux-f2fs-devel, jaegeuk; +Cc: heyunlei

On 2016/9/18 8:16, Yunlei He wrote:
> This patch allow preallocates data blocks for buffered aio writes
> in encrypted file.
> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

> ---
>  fs/f2fs/data.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 3e0ef2d..932166e 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -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) ||
> 


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH v2] f2fs: preallocate blocks for encrypted file
  2016-09-18  0:16 [RFC PATCH v2] f2fs: preallocate blocks for encrypted file Yunlei He
  2016-09-19  0:36 ` Chao Yu
@ 2016-09-21  0:42 ` Jaegeuk Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2016-09-21  0:42 UTC (permalink / raw)
  To: Yunlei He; +Cc: heyunlei, linux-f2fs-devel

Hi Yunlei,

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

---
 fs/f2fs/segment.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index abf1c3d..e78501c 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -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);
-- 
2.8.3

Thanks,

On Sun, Sep 18, 2016 at 08:16:56AM +0800, Yunlei He wrote:
> This patch allow preallocates data blocks for buffered aio writes
> in encrypted file.
> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
>  fs/f2fs/data.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 3e0ef2d..932166e 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -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) ||
> -- 
> 1.9.1
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-21  0:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-18  0:16 [RFC PATCH v2] f2fs: preallocate blocks for encrypted file Yunlei He
2016-09-19  0:36 ` Chao Yu
2016-09-21  0:42 ` Jaegeuk Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).