From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Theodore Tso <tytso@mit.edu>
Cc: David Woodhouse <dwmw2@infradead.org>, linux-ext4@vger.kernel.org
Subject: Re: [EXT2] Discard unused sectors
Date: Fri, 15 Aug 2008 23:48:47 +0530 [thread overview]
Message-ID: <20080815181847.GF6511@skywalker> (raw)
In-Reply-To: <20080815120235.GJ13048@mit.edu>
On Fri, Aug 15, 2008 at 08:02:35AM -0400, Theodore Tso wrote:
> On Thu, Aug 14, 2008 at 10:05:48AM +0100, David Woodhouse wrote:
> > I'm not sure how to do this for ext[34]. The sb_issue_discard() function
> > issues its requests as a soft barrier, because for naïve callers it
> > needs to ensure that the discard happens _before_ any subsequent writes
> > to the same sectors (if they get reallocated immediately).
> >
> > But ext[34] can probably do better than that, and submit the discard
> > requests _without_ barriers of their own. If someone with a bit more
> > clue does it, that is.
>
> It's worse than this. We can't call sb_issue_discard() until the
> transaction commits, since if we crash before the commit, the undelete
> will not have happened. (The block/inode bitmaps, inode table,
> et. al., aren't allowed to go out to disk until the transaction
> commit, and similarly, those sectors aren't allowed to get reused
> until the commit happens, as well.)
>
> This is going to be true of any filesystem which is doing journaling.
> What makes life a bit more difficult for ext4 is that we are doing
> physical block journaling, so we're not keeping track which blocks are
> getting discarded. (In contrast, systems that do logical journaling
> are keeping track of specific lists of blocks that are getting freed,
> since that's what they write to the journal.) This means we'll have
> to keep our own in-memory list of extents for which we should call
> sb_issue_discard() when the transaction finally commits. So this is
> something that we would have to track in the jbd/jbd2 layer, hanging
> off of the transaction structure. If we do this right, it will also
> be what OCFS2 can use too (since it uses the jbd layer as well.)
Doesn't both ext3 and ext4 do this via
ext4_journal_get_undo_access and ext4_mb_free_metadata ?. We actually
wait for the transaction to commit to free the meta-data blocks used by the
transaction
-aneesh
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2008-08-15 18:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-14 8:59 [EXT2] Discard unused sectors David Woodhouse
2008-08-14 9:05 ` David Woodhouse
2008-08-15 12:02 ` Theodore Tso
2008-08-15 18:18 ` Aneesh Kumar K.V [this message]
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=20080815181847.GF6511@skywalker \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=dwmw2@infradead.org \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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