Linux-f2fs-devel Archive on lore.kernel.org
 help / color / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [RFC PATCH v5] f2fs: support data compression
Date: Wed, 15 Jan 2020 13:38:28 -0800
Message-ID: <20200115213828.GA57854@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <d68d27d3-2501-2641-d929-6293dfe683b0@huawei.com>

On 01/15, Chao Yu wrote:
> On 2020/1/15 6:48, Jaegeuk Kim wrote:
> > On 01/14, Chao Yu wrote:
> >> On 2020/1/14 0:11, Jaegeuk Kim wrote:
> >>> On 01/13, Chao Yu wrote:
> >>>> On 2020/1/12 2:02, Jaegeuk Kim wrote:
> >>>>> On 01/11, Chao Yu wrote:
> >>>>>> On 2020/1/11 7:52, Jaegeuk Kim wrote:
> >>>>>>> On 01/06, Jaegeuk Kim wrote:
> >>>>>>>> On 01/06, Chao Yu wrote:
> >>>>>>>>> On 2020/1/3 14:50, Chao Yu wrote:
> >>>>>>>>>> This works to me. Could you run fsstress tests on compressed root directory?
> >>>>>>>>>> It seems still there are some bugs.
> >>>>>>>>>
> >>>>>>>>> Jaegeuk,
> >>>>>>>>>
> >>>>>>>>> Did you mean running por_fsstress testcase?
> >>>>>>>>>
> >>>>>>>>> Now, at least I didn't hit any problem for normal fsstress case.
> >>>>>>>>
> >>>>>>>> Yup. por_fsstress
> >>>>>>>
> >>>>>>> Please check https://github.com/jaegeuk/f2fs/commits/g-dev-test.
> >>>>>>> I've fixed
> >>>>>>> - truncation offset
> >>>>>>> - i_compressed_blocks and its lock coverage
> >>>>>>> - error handling
> >>>>>>> - etc
> >>>>>>
> >>>>>> I changed as below, and por_fsstress stops panic the system.
> >>>>>>
> >>>>>> Could you merge all these fixes into original patch?
> >>>>>
> >>>>> Yup, let m roll up some early patches first once test results become good.
> >>>>
> >>>> I didn't encounter issue any more, how about por_fsstress test result in your
> >>>> enviornment? If there is, please share the call stack with me.
> >>>
> >>> Sure, will do, once I hit an issue. BTW, I'm hitting another unreacheable nat
> >>> entry issue during por_stress without compression. :(
> >>
> >> Did you enable any features during por_fsstress test?
> >>
> >> I only hit below warning during por_fsstress test on image w/o compression.
> >>
> >> ------------[ cut here ]------------
> >> WARNING: CPU: 10 PID: 33483 at fs/fs-writeback.c:1448 __writeback_single_inode+0x28c/0x340
> >> Call Trace:
> >>  writeback_single_inode+0xad/0x120
> >>  sync_inode_metadata+0x3d/0x60
> >>  f2fs_sync_inode_meta+0x90/0xe0 [f2fs]
> >>  block_operations+0x17c/0x360 [f2fs]
> >>  f2fs_write_checkpoint+0x101/0xff0 [f2fs]
> >>  f2fs_sync_fs+0xa8/0x130 [f2fs]
> >>  f2fs_do_sync_file+0x19c/0x880 [f2fs]
> >>  do_fsync+0x38/0x60
> >>  __x64_sys_fsync+0x10/0x20
> >>  do_syscall_64+0x5f/0x220
> >>  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> > 
> > Does gc_mutex patch fix this?
> 
> No, gc_mutex patch fixes another problem.
> 
> BTW, it looks like a bug of VFS.

One fix below and rerun tests now.

---
 fs/f2fs/compress.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 2480bff1e115..45a6f20ceb3e 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -556,10 +556,8 @@ static int f2fs_compressed_blocks(struct compress_ctx *cc)
 
 			blkaddr = datablock_addr(dn.inode,
 					dn.node_page, dn.ofs_in_node + i);
-			if (blkaddr != NULL_ADDR) {
+			if (blkaddr != NULL_ADDR)
 				ret++;
-				break;
-			}
 		}
 	}
 fail:
@@ -955,10 +953,14 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc,
 					enum iostat_type io_type)
 {
 	struct address_space *mapping = cc->inode->i_mapping;
-	int i, _submitted, compr_blocks, ret;
-	int err = 0;
+	int _submitted, compr_blocks, ret;
+	int i = -1, err = 0;
 
 	compr_blocks = f2fs_compressed_blocks(cc);
+	if (compr_blocks < 0) {
+		err = compr_blocks;
+		goto out_err;
+	}
 
 	for (i = 0; i < cc->cluster_size; i++) {
 		if (!cc->rpages[i])
@@ -997,7 +999,7 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc,
 out_fail:
 	/* TODO: revoke partially updated block addresses */
 	BUG_ON(compr_blocks);
-
+out_err:
 	for (++i; i < cc->cluster_size; i++) {
 		if (!cc->rpages[i])
 			continue;
@@ -1020,9 +1022,9 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
 	*submitted = 0;
 	if (cluster_may_compress(cc)) {
 		err = f2fs_compress_pages(cc);
-		if (err == -EAGAIN)
+		if (err == -EAGAIN) {
 			goto write;
-		else if (err) {
+		} else if (err) {
 			f2fs_put_rpages_wbc(cc, wbc, true, 1);
 			goto destroy_out;
 		}
-- 
2.24.0.525.g8f36a354ae-goog



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

  reply index

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16  6:28 Chao Yu
2019-12-16 11:08 ` Markus Elfring
2019-12-16 13:12   ` Chao Yu
2019-12-16 11:32 ` Markus Elfring
2019-12-16 13:24   ` Chao Yu
2019-12-16 11:51 ` Markus Elfring
2019-12-16 13:28   ` Chao Yu
2019-12-16 13:38     ` [f2fs-dev] [v5] " Markus Elfring
2019-12-18 21:46 ` [f2fs-dev] [RFC PATCH v5] " Jaegeuk Kim
2019-12-23  3:32   ` Chao Yu
2019-12-23  3:58     ` Chao Yu
2019-12-23 19:29     ` Jaegeuk Kim
2019-12-31  0:46     ` Jaegeuk Kim
2019-12-31  1:45       ` Chao Yu
2020-01-02 18:18         ` Jaegeuk Kim
2020-01-02 19:00           ` Jaegeuk Kim
2020-01-03  6:50             ` Chao Yu
2020-01-06  9:01               ` Chao Yu
2020-01-06 18:16                 ` Jaegeuk Kim
2020-01-10 23:52                   ` Jaegeuk Kim
2020-01-11  9:08                     ` Chao Yu
2020-01-11 18:02                       ` Jaegeuk Kim
2020-01-13  8:56                         ` Chao Yu
2020-01-13 16:11                           ` Jaegeuk Kim
2020-01-14  1:52                             ` Chao Yu
2020-01-14 22:48                               ` Jaegeuk Kim
2020-01-15 10:12                                 ` Chao Yu
2020-01-15 21:38                                   ` Jaegeuk Kim [this message]
2020-01-03  1:19           ` Chao Yu
2019-12-19  9:53 ` Geert Uytterhoeven
2019-12-23  3:36   ` Chao Yu
2019-12-19 10:18 ` Geert Uytterhoeven
2019-12-19 10:25 ` Geert Uytterhoeven
2019-12-20 21:26   ` Jaegeuk Kim

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200115213828.GA57854@jaegeuk-macbookpro.roam.corp.google.com \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-f2fs-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-f2fs-devel/0 linux-f2fs-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-f2fs-devel linux-f2fs-devel/ https://lore.kernel.org/linux-f2fs-devel \
		linux-f2fs-devel@lists.sourceforge.net
	public-inbox-index linux-f2fs-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/net.sourceforge.lists.linux-f2fs-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git