a question regarding Ext3 file truncate

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

 



Hi,

Please forgive me if the question is dumb.

I am modifying ext3 to add some new features, but was confused by the
implementation of ext3_truncate().

In ext3_truncate():

we first use
	n = ext3_block_to_path(inode, last_block, offsets, NULL);
to get the path of the last block.

If the number of blocks is smaller than 12,  all blocks are then
direct blocks. We then need to clear them.

But the interesting thing happens:
	if (n == 1)									  /* direct blocks */
	{
		ext3_free_data(handle, inode, NULL, i_data+offsets[0],
			i_data + EXT3_NDIR_BLOCKS);
		goto do_indirects;
	}
This code seems to free data blocks right after the blocks used by the
file. I think it should be
ext3_free_data(handle, inode, NULL, i_data, i_data+offsets[0]);

Right? can some one explain this a little bit?

Thanks,
-x
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux