mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Yunlong Song <yunlong.song@huawei.com>,
	chao@kernel.org, yuchao0@huawei.com, yunlong.song@icloud.com,
	miaoxie@huawei.com, bintian.wang@huawei.com,
	linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: fix out-of-free problem caused by atomic write
Date: Fri, 27 Oct 2017 13:23:26 +0200	[thread overview]
Message-ID: <20171027112326.GC96994@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <20171027063854.GA25279@infradead.org>

On 10/26, Christoph Hellwig wrote:
> On Thu, Oct 26, 2017 at 04:30:19PM +0200, Jaegeuk Kim wrote:
> > On 10/26, Yunlong Song wrote:
> > > f2fs_balance_fs only actives once in the commit_inmem_pages, but there
> > > are more than one page to commit, so all the other pages will miss the
> > > check. This will lead to out-of-free problem when commit a very large
> > > file. To fix it, we should do f2fs_balance_fs for each inmem page.
> > 
> > NAK, this breaks atomicity.
> 
> Can someone please explain (and write down in e.g. manpages) these
> atomicy rules?

The basic idea is to provide atomicity of blocks written by write(2) given
period managed by user. For example, user can do 1) ioctl to start a period,
2) write(2) calls, 3) ioctl to commit all the blocks. Then, filesystem will
guarantee committed blocks should be recovered all or nothing after power-cut.

Scenario #1:
 - ioctl(fd, F2FS_IOC_START_ATOMIC_WRITE)
 - 0 = write(2)
 - ...
 - 0 = write(2)
 - ioctl(fd, F2FS_IOC_COMMIT_ATOMIC_WRITE)

Scenario #2:
 - ioctl(fd, F2FS_IOC_START_ATOMIC_WRITE)
 - 0 = write(2)
 - ...
 - err = write(2)
 - ioctl(fd, F2FS_IOC_ABORT_ATOMIC_WRITE)

Scenario #3:
 - ioctl(fd, F2FS_IOC_START_ATOMIC_WRITE)
 - 0 = write(2)
 - ...
 - process crashed or close(fd)

Thanks,

  reply	other threads:[~2017-10-27 11:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26 14:21 Yunlong Song
2017-10-26 14:30 ` Jaegeuk Kim
2017-10-27  6:38   ` Christoph Hellwig
2017-10-27 11:23     ` Jaegeuk Kim [this message]
2017-10-30 13:04 ` [PATCH v2] " Yunlong Song
2017-11-03  3:27   ` Yunlong Song
2017-11-03  3:46   ` Jaegeuk Kim
2017-11-03  4:48     ` Yunlong Song
2017-11-03 14:40       ` Yunlong Song
2017-11-03 15:23         ` Chao Yu
2017-11-06  1:34           ` Yunlong Song

Reply instructions:

You may reply publicly 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=20171027112326.GC96994@jaegeuk-macbookpro.roam.corp.google.com \
    --to=jaegeuk@kernel.org \
    --cc=bintian.wang@huawei.com \
    --cc=chao@kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=yuchao0@huawei.com \
    --cc=yunlong.song@huawei.com \
    --cc=yunlong.song@icloud.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®