public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* Is this a bug?
@ 2011-04-02  8:05 Ding Dinghua
  2011-04-02 16:32 ` Amir Goldstein
  0 siblings, 1 reply; 5+ messages in thread
From: Ding Dinghua @ 2011-04-02  8:05 UTC (permalink / raw)
  To: linux-ext4

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),
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-04-03 15:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-02  8:05 Is this a bug? Ding Dinghua
2011-04-02 16:32 ` Amir Goldstein
2011-04-03  9:24   ` Ding Dinghua
2011-04-03 14:51     ` Yongqiang Yang
2011-04-03 15:44       ` Amir Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox