From: Amir Goldstein <amir73il@gmail.com>
To: Ding Dinghua <dingdinghua85@gmail.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: Is this a bug?
Date: Sat, 2 Apr 2011 09:32:49 -0700 [thread overview]
Message-ID: <BANLkTimc3LC19vzjuvL4QyXcjrGAQgnqJA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTinPYj7_qpKcZgp3Oya1LXzcbfBczQ@mail.gmail.com>
On Sat, Apr 2, 2011 at 1:05 AM, Ding Dinghua <dingdinghua85@gmail.com> wrote:
> When truncate files and free blocks, the following codes make me puzzled:
>
> void ext4_free_blocks(handle_t *handle, struct inode *inode,
> struct buffer_head *bh, ext4_fsblk_t block,
> unsigned long count, int flags)
> {
> if (flags & EXT4_FREE_BLOCKS_FORGET) {
> struct buffer_head *tbh = bh;
> int i;
>
> BUG_ON(bh && (count > 1));
>
> for (i = 0; i < count; i++) {
> if (!bh)
> tbh = sb_find_get_block(inode->i_sb,
> block + i);
> if (unlikely(!tbh))
> continue;
> ext4_forget(handle, flags & EXT4_FREE_BLOCKS_METADATA,
> inode, tbh, block + i);
> }
> }
> }
>
> I notice that ext4_forget mainly do two things:
> a) call jbd2_journa_forget to forget the modification of some buffer head
> b) or deal with the revoke issue
> however, if we are freeing data blocks && ext4_forget get into branch a),
Simple. we don't pass the FORGET flag when freeing data blocks,
only when freeing metadata blocks, which may have been journalled
already.
I am not sure about the journal=data case through.
> tbh is not the buffer_head which journal took care of in ext4_write_begin,
> so i'm puzzled with this.
>
> Could anyone explain it to me? Thanks.
>
> --
> Ding Dinghua
> --
> 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
>
--
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
next prev parent reply other threads:[~2011-04-02 16:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-02 8:05 Is this a bug? Ding Dinghua
2011-04-02 16:32 ` Amir Goldstein [this message]
2011-04-03 9:24 ` Ding Dinghua
2011-04-03 14:51 ` Yongqiang Yang
2011-04-03 15:44 ` Amir Goldstein
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=BANLkTimc3LC19vzjuvL4QyXcjrGAQgnqJA@mail.gmail.com \
--to=amir73il@gmail.com \
--cc=dingdinghua85@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox