Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp25153pxk; Tue, 8 Sep 2020 20:29:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3weSwCFDoWx2P+c6HwAgyMIaswitI/ycE3lnPIEX/J2sifQW9GuKujQ7JXRHN8kMj8BKq X-Received: by 2002:a50:99d6:: with SMTP id n22mr2086417edb.265.1599622160374; Tue, 08 Sep 2020 20:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599622160; cv=none; d=google.com; s=arc-20160816; b=gP/1RK8KWmnRD1VVt+Mm0yo18n985BpiRzNGLjo0HVfw+V8kR/XtZSxA5BylCJrOp1 QSZcsZA//1xymZBbIo0eE/r4iEkt38RjhcGI7hURkLTBhVOlr6T6IXgIWPbiROFYrkba 9FVs4rbShY3DdziB0dEa2F4GtQUb3BNZO83syNjHimFkbmhUdtRGp+gz2qetqlt5Naq9 VVHh8MN0Bj/A/9O+U79Ot/M0o69cslOzAK9KMl4pwbn1HEyTeuHidNYiwYU68vewIVg9 LamQnPDwKXKKIUlio3MkyIA9SoYiOE+WFYVTcLgiVibgp/0Vzv1kIeIUxkUYnIEmRf7x vHAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SRIkwEe7tptXGqLwLrEsMyoJ+ejU2wr6C8a3mvmjUGw=; b=bO+oLHQoqTDfGmXVLXk4tB3i1aGsYglrC8VAwXulzIiiQgpMRLlzdlD7evvnxMORUu U+yG7NR0+TLYJ82zCUuyicqzo2jYBK8o9+UfeDf/Z0ko9EMvjuhRQ2/iK/1D2HktnQRM ZsCX5w1ok6CCDjtSD1nuAeZD2zubHEHwUpO3uWYqYkMOXVNTSO3vVEVAnLB885ZyB+b1 ofMnR7JYKtopt5YcSXX2PdPRUCktur74N9AChzthGBbw2btMtI3BEFh5cGRUaBAF297+ lknSLsF47MCf9IWjSeM7irlq6LLBdLU10j2EfEZWngHhkL7B2rnRszRqT3oq2+34lXVt uSiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OJAKmp49; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si683532edz.97.2020.09.08.20.28.56; Tue, 08 Sep 2020 20:29:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OJAKmp49; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726738AbgIID2F (ORCPT + 99 others); Tue, 8 Sep 2020 23:28:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:36164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726489AbgIID2E (ORCPT ); Tue, 8 Sep 2020 23:28:04 -0400 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 37DCB20EDD; Wed, 9 Sep 2020 03:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599622083; bh=yzC3pCeyfI5uFIun3bqi6B7dO5+teVjviJKxlHi7g9g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OJAKmp492OjH2PaDukesr862GMPGdJqtGH/Cb2DCicdFsGLJcT40D/dj58DQL46+v CFAKWJBacg906/jo17EUZ4aoCdu3CinvlsJeH023JxrsjUKtLcjWaLnBqKnjEu81Fo rDfThrbofVVxfxadvUNtGItHW2Mt1+lfK+yCCEQs= Date: Tue, 8 Sep 2020 20:28:02 -0700 From: Jaegeuk Kim To: Chao Yu Cc: Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Subject: Re: [f2fs-dev] [PATCH] f2fs: clean up vm_map_ram() call Message-ID: <20200909032802.GA3377963@google.com> References: <20200909023634.3821423-1-daeho43@gmail.com> <4c8971ce-98b5-4675-8310-5e9af0a14bb6@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4c8971ce-98b5-4675-8310-5e9af0a14bb6@huawei.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/09, Chao Yu wrote: > On 2020/9/9 10:36, Daeho Jeong wrote: > > From: Daeho Jeong > > > > Made f2fs_vmap() wrapper to handle vm_map_ram() stuff. > > > > Signed-off-by: Daeho Jeong > > 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