Is this a bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux