Thread (61 messages) 61 messages, 6 authors, 2008-08-16

Re: [PATCH 5/6 ]Ext4 journal credits reservation fixes

From: Aneesh Kumar K.V <hidden>
Date: 2008-08-14 08:41:57

On Wed, Aug 13, 2008 at 06:01:10PM -0700, Mingming Cao wrote:
....
....
quoted
quoted
+static int ext4_writepages_trans_blocks(struct inode *inode)
+{
+	int bpp = ext4_journal_blocks_per_page(inode);
+	int max_blocks = EXT4_MAX_WRITEPAGES_SIZE * bpp;
+
+	if (max_blocks > EXT4_I(inode)->i_reserved_data_blocks)
+		max_blocks =  EXT4_I(inode)->i_reserved_data_blocks;


Why are we limiting max_blocks to i_reserved_data_blocks ?
i_reserved_data_blocks is the total number of "delayed" blocks that need
block allocation. That's  a counter being adds up at each write_begin()
when the block allocation is defered. That's a accurate counter to
indicate the max number of allocation we need to flush all dirty pages
to disk for this inode,  fits well when we need to calculate the credits
for da_writepages.

Now that we don't have PAGEVEC limit,  we could use this to limit the
total number of blocks to allocate  when estimate the credit.   But if
this i_reserved_data_blocks gets too large, that can't fit into one
single transaction, later get_block() will overflow the journal, we need
someway to limit the number of pages to flush still:(

We should be requesting for credits needed for
EXT4_I(inode)->i_reserved_data_blocks with chunk = 1. If we don't have
that many credits we can limit max_blocks with  EXT4_BLOCKS_PER_GROUP

	if (EXT4_I(inode)->i_reserved_data_blocks > EXT4_BLOCKS_PER_GROUP)
		max_blocks = EXT4_BLOCKS_PER_GROUP;
	else
		max_blocks = EXT4_I(inode)->i_reserved_data_blocks;
quoted
quoted
+
-aneesh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help