linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: clean up vm_map_ram() call
@ 2020-09-09  2:36 Daeho Jeong
  2020-09-09  3:19 ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Daeho Jeong @ 2020-09-09  2:36 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong

From: Daeho Jeong <daehojeong@google.com>

Made f2fs_vmap() wrapper to handle vm_map_ram() stuff.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
 fs/f2fs/compress.c | 42 ++++++++++++++++++------------------------
 1 file changed, 18 insertions(+), 24 deletions(-)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 357303d8514b..7895186cc765 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -557,6 +557,20 @@ static void f2fs_compress_free_page(struct page *page)
 
 #define MAX_VMAP_RETRIES	3
 
+static void *f2fs_vmap(struct page **pages, unsigned int count)
+{
+	int i;
+	void *buf = NULL;
+
+	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
+		buf = vm_map_ram(pages, count, -1);
+		if (buf)
+			break;
+		vm_unmap_aliases();
+	}
+	return buf;
+}
+
 static int f2fs_compress_pages(struct compress_ctx *cc)
 {
 	struct f2fs_sb_info *sbi = F2FS_I_SB(cc->inode);
@@ -593,23 +607,13 @@ static int f2fs_compress_pages(struct compress_ctx *cc)
 		}
 	}
 
-	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
-		cc->rbuf = vm_map_ram(cc->rpages, cc->cluster_size, -1);
-		if (cc->rbuf)
-			break;
-		vm_unmap_aliases();
-	}
+	cc->rbuf = f2fs_vmap(cc->rpages, cc->cluster_size);
 	if (!cc->rbuf) {
 		ret = -ENOMEM;
 		goto out_free_cpages;
 	}
 
-	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
-		cc->cbuf = vm_map_ram(cc->cpages, cc->nr_cpages, -1);
-		if (cc->cbuf)
-			break;
-		vm_unmap_aliases();
-	}
+	cc->cbuf = f2fs_vmap(cc->cpages, cc->nr_cpages);
 	if (!cc->cbuf) {
 		ret = -ENOMEM;
 		goto out_vunmap_rbuf;
@@ -728,23 +732,13 @@ void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity)
 			goto out_free_dic;
 	}
 
-	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
-		dic->rbuf = vm_map_ram(dic->tpages, dic->cluster_size, -1);
-		if (dic->rbuf)
-			break;
-		vm_unmap_aliases();
-	}
+	dic->rbuf = f2fs_vmap(dic->tpages, dic->cluster_size);
 	if (!dic->rbuf) {
 		ret = -ENOMEM;
 		goto destroy_decompress_ctx;
 	}
 
-	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
-		dic->cbuf = vm_map_ram(dic->cpages, dic->nr_cpages, -1);
-		if (dic->cbuf)
-			break;
-		vm_unmap_aliases();
-	}
+	dic->cbuf = f2fs_vmap(dic->cpages, dic->nr_cpages);
 	if (!dic->cbuf) {
 		ret = -ENOMEM;
 		goto out_vunmap_rbuf;
-- 
2.28.0.526.ge36021eeef-goog



_______________________________________________
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

* Re: [f2fs-dev] [PATCH] f2fs: clean up vm_map_ram() call
  2020-09-09  2:36 [f2fs-dev] [PATCH] f2fs: clean up vm_map_ram() call Daeho Jeong
@ 2020-09-09  3:19 ` Chao Yu
  2020-09-09  3:28   ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2020-09-09  3:19 UTC (permalink / raw)
  To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong

On 2020/9/9 10:36, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
> 
> Made f2fs_vmap() wrapper to handle vm_map_ram() stuff.
> 
> Signed-off-by: Daeho Jeong <daehojeong@google.com>

LGTM,

I think it should be merged into original patch. :)

Maybe Jaeguek could help to do that.

Thanks,

> ---
>   fs/f2fs/compress.c | 42 ++++++++++++++++++------------------------
>   1 file changed, 18 insertions(+), 24 deletions(-)
> 
> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> index 357303d8514b..7895186cc765 100644
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -557,6 +557,20 @@ static void f2fs_compress_free_page(struct page *page)
>   
>   #define MAX_VMAP_RETRIES	3
>   
> +static void *f2fs_vmap(struct page **pages, unsigned int count)
> +{
> +	int i;
> +	void *buf = NULL;
> +
> +	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
> +		buf = vm_map_ram(pages, count, -1);
> +		if (buf)
> +			break;
> +		vm_unmap_aliases();
> +	}
> +	return buf;
> +}
> +
>   static int f2fs_compress_pages(struct compress_ctx *cc)
>   {
>   	struct f2fs_sb_info *sbi = F2FS_I_SB(cc->inode);
> @@ -593,23 +607,13 @@ static int f2fs_compress_pages(struct compress_ctx *cc)
>   		}
>   	}
>   
> -	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
> -		cc->rbuf = vm_map_ram(cc->rpages, cc->cluster_size, -1);
> -		if (cc->rbuf)
> -			break;
> -		vm_unmap_aliases();
> -	}
> +	cc->rbuf = f2fs_vmap(cc->rpages, cc->cluster_size);
>   	if (!cc->rbuf) {
>   		ret = -ENOMEM;
>   		goto out_free_cpages;
>   	}
>   
> -	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
> -		cc->cbuf = vm_map_ram(cc->cpages, cc->nr_cpages, -1);
> -		if (cc->cbuf)
> -			break;
> -		vm_unmap_aliases();
> -	}
> +	cc->cbuf = f2fs_vmap(cc->cpages, cc->nr_cpages);
>   	if (!cc->cbuf) {
>   		ret = -ENOMEM;
>   		goto out_vunmap_rbuf;
> @@ -728,23 +732,13 @@ void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity)
>   			goto out_free_dic;
>   	}
>   
> -	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
> -		dic->rbuf = vm_map_ram(dic->tpages, dic->cluster_size, -1);
> -		if (dic->rbuf)
> -			break;
> -		vm_unmap_aliases();
> -	}
> +	dic->rbuf = f2fs_vmap(dic->tpages, dic->cluster_size);
>   	if (!dic->rbuf) {
>   		ret = -ENOMEM;
>   		goto destroy_decompress_ctx;
>   	}
>   
> -	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
> -		dic->cbuf = vm_map_ram(dic->cpages, dic->nr_cpages, -1);
> -		if (dic->cbuf)
> -			break;
> -		vm_unmap_aliases();
> -	}
> +	dic->cbuf = f2fs_vmap(dic->cpages, dic->nr_cpages);
>   	if (!dic->cbuf) {
>   		ret = -ENOMEM;
>   		goto out_vunmap_rbuf;
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: clean up vm_map_ram() call
  2020-09-09  3:19 ` Chao Yu
@ 2020-09-09  3:28   ` Jaegeuk Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2020-09-09  3:28 UTC (permalink / raw)
  To: Chao Yu; +Cc: Daeho Jeong, kernel-team, linux-kernel, linux-f2fs-devel

On 09/09, Chao Yu wrote:
> On 2020/9/9 10:36, Daeho Jeong wrote:
> > From: Daeho Jeong <daehojeong@google.com>
> > 
> > Made f2fs_vmap() wrapper to handle vm_map_ram() stuff.
> > 
> > Signed-off-by: Daeho Jeong <daehojeong@google.com>
> 
> LGTM,
> 
> I think it should be merged into original patch. :)
> 
> Maybe Jaeguek could help to do that.

Yeah, no worries. :)

> 
> Thanks,
> 
> > ---
> >   fs/f2fs/compress.c | 42 ++++++++++++++++++------------------------
> >   1 file changed, 18 insertions(+), 24 deletions(-)
> > 
> > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> > index 357303d8514b..7895186cc765 100644
> > --- a/fs/f2fs/compress.c
> > +++ b/fs/f2fs/compress.c
> > @@ -557,6 +557,20 @@ static void f2fs_compress_free_page(struct page *page)
> >   #define MAX_VMAP_RETRIES	3
> > +static void *f2fs_vmap(struct page **pages, unsigned int count)
> > +{
> > +	int i;
> > +	void *buf = NULL;
> > +
> > +	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
> > +		buf = vm_map_ram(pages, count, -1);
> > +		if (buf)
> > +			break;
> > +		vm_unmap_aliases();
> > +	}
> > +	return buf;
> > +}
> > +
> >   static int f2fs_compress_pages(struct compress_ctx *cc)
> >   {
> >   	struct f2fs_sb_info *sbi = F2FS_I_SB(cc->inode);
> > @@ -593,23 +607,13 @@ static int f2fs_compress_pages(struct compress_ctx *cc)
> >   		}
> >   	}
> > -	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
> > -		cc->rbuf = vm_map_ram(cc->rpages, cc->cluster_size, -1);
> > -		if (cc->rbuf)
> > -			break;
> > -		vm_unmap_aliases();
> > -	}
> > +	cc->rbuf = f2fs_vmap(cc->rpages, cc->cluster_size);
> >   	if (!cc->rbuf) {
> >   		ret = -ENOMEM;
> >   		goto out_free_cpages;
> >   	}
> > -	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
> > -		cc->cbuf = vm_map_ram(cc->cpages, cc->nr_cpages, -1);
> > -		if (cc->cbuf)
> > -			break;
> > -		vm_unmap_aliases();
> > -	}
> > +	cc->cbuf = f2fs_vmap(cc->cpages, cc->nr_cpages);
> >   	if (!cc->cbuf) {
> >   		ret = -ENOMEM;
> >   		goto out_vunmap_rbuf;
> > @@ -728,23 +732,13 @@ void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity)
> >   			goto out_free_dic;
> >   	}
> > -	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
> > -		dic->rbuf = vm_map_ram(dic->tpages, dic->cluster_size, -1);
> > -		if (dic->rbuf)
> > -			break;
> > -		vm_unmap_aliases();
> > -	}
> > +	dic->rbuf = f2fs_vmap(dic->tpages, dic->cluster_size);
> >   	if (!dic->rbuf) {
> >   		ret = -ENOMEM;
> >   		goto destroy_decompress_ctx;
> >   	}
> > -	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
> > -		dic->cbuf = vm_map_ram(dic->cpages, dic->nr_cpages, -1);
> > -		if (dic->cbuf)
> > -			break;
> > -		vm_unmap_aliases();
> > -	}
> > +	dic->cbuf = f2fs_vmap(dic->cpages, dic->nr_cpages);
> >   	if (!dic->cbuf) {
> >   		ret = -ENOMEM;
> >   		goto out_vunmap_rbuf;
> > 
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2020-09-09  3:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09  2:36 [f2fs-dev] [PATCH] f2fs: clean up vm_map_ram() call Daeho Jeong
2020-09-09  3:19 ` Chao Yu
2020-09-09  3:28   ` 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).