[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171027112326.GC96994@jaegeuk-macbookpro.roam.corp.google.com>
Date: Fri, 27 Oct 2017 13:23:26 +0200
From: Jaegeuk Kim <jaegeuk@...nel.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: Yunlong Song <yunlong.song@...wei.com>, chao@...nel.org,
yuchao0@...wei.com, yunlong.song@...oud.com, miaoxie@...wei.com,
bintian.wang@...wei.com, linux-fsdevel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] f2fs: fix out-of-free problem caused by atomic write
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,
Powered by blists - more mailing lists