All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: linux-ext4@vger.kernel.org
Subject: [Bug 103111] auto_da_alloc mount option not working
Date: Tue, 25 Aug 2015 17:49:33 +0000	[thread overview]
Message-ID: <bug-103111-13602-8MQRLFu2PJ@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-103111-13602@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=103111

--- Comment #10 from Eric Sandeen <sandeen@redhat.com> ---
Ok, so there are 2 basic heuristics here.

One is that if we call ext4_truncate to size 0, we set the AUTO_DA_ALLOC flag
so that it'll call ext4_alloc_da_blocks in ext4_release_file (essentially on
close).

The other is that if we call rename, and we're overwriting an existing file, we
call ext4_alloc_da_blocks.

ext4_alloc_da_blocks will start writeback on the file (i.e. the file which was
truncated, or the new file overwriting the old file) if there are any delayed
allocations still pending; if not, it does nothing.

Note, we don't get to ext4_truncate if the file is already zero length when you
open it O_TRUNC.

Also, notice that if we strace your c++ program (with the rename call
included), we see:

open("example.txt", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
rename("example.txt", "example.txt1")   = 0
write(3, "Writing this to a file.\n", 24) = 24
close(3)                                = 0

so the rename happens before the write; even if that is overwriting an existing
file, there are no delalloc blocks on the new file yet, so the rename heuristic
does nothing in this case.

So there are a few prerequisites to make your c++ test work

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

  parent reply	other threads:[~2015-08-25 17:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19 13:34 [Bug 103111] New: auto_da_alloc mount option not working bugzilla-daemon
2015-08-19 16:13 ` [Bug 103111] " bugzilla-daemon
2015-08-20  5:48 ` bugzilla-daemon
2015-08-20  5:53 ` bugzilla-daemon
2015-08-20  5:54 ` bugzilla-daemon
2015-08-21 14:56 ` bugzilla-daemon
2015-08-21 14:59 ` bugzilla-daemon
2015-08-21 15:13 ` bugzilla-daemon
2015-08-21 15:16 ` bugzilla-daemon
2015-08-21 18:36 ` bugzilla-daemon
2015-08-25 17:49 ` bugzilla-daemon [this message]
2015-08-25 18:05 ` bugzilla-daemon
2015-08-28 16:49 ` bugzilla-daemon
2015-08-28 16:51 ` bugzilla-daemon
2015-08-29  3:25 ` bugzilla-daemon
2015-08-29  3:28 ` bugzilla-daemon
2015-08-29 19:33 ` bugzilla-daemon

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=bug-103111-13602-8MQRLFu2PJ@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.