[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080729062427.GC4545@skywalker>
Date: Tue, 29 Jul 2008 11:54:27 +0530
From: "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
To: Mingming Cao <cmm@...ibm.com>
Cc: tytso <tytso@....edu>, Shehjar Tikoo <shehjart@....unsw.edu.au>,
linux-ext4@...r.kernel.org
Subject: Re: [RFC]Ext4: journal credits reservation fixes for DIO,
fallocate and delalloc writepages
On Mon, Jul 28, 2008 at 12:07:33PM -0700, Mingming Cao wrote:
.....
> > > > > *
> > > > > @@ -1142,13 +1133,13 @@ int ext4_get_block(struct inode *inode,
> > > > > handle_t *handle = ext4_journal_current_handle();
> > > > > int ret = 0, started = 0;
> > > > > unsigned max_blocks = bh_result->b_size >> inode->i_blkbits;
> > > > > + int dio_credits = EXT4_DATA_TRANS_BLOCKS(inode->i_sb);
> > > >
> > > > Again this should be
> > > > int dio_credits = ext4_writeblocks_trans(inode, DIO_MAX_BLOCKS);
> > > >
> > > No. DIO case is different than writepages(). When get_block() is called
> > > from DIO path, the get_block() is called in a loop, and the credit is
> > > reserved inside the loop. Each time get_block(),will return a single
> > > extent, so we should use EXT4_DATA_TRANS_BLOCKS(inode->i_sb) which is
> > > calculate a single chunk of allocation credits.
> >
> >
> > That is true only for extent format. With noextents we need something
> > like below
> >
>
> Not really, even with non extent format block allocation, ext4_get_block() will only allocate/map a chunk of contiguous blocks (i.e. an extent), so it will not hit the worse case.
>
> > if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
> > dio_credits = ext4_writeblocks_trans_credits_old(inode, max_blocks);
> > else {
> > /*
> > * For extent format get_block return only one extent
> > */
> > dio_credits = EXT4_DATA_TRANS_BLOCKS(inode->i_sb);
> > }
> >
> >
>
but dio_credits = EXT4_DATA_TRANS_BLOCKS(inode->i_sb); doesn't account
for updating the bitmap and group descriptor related to all indirect and
dindirect and tindirect blocks allocated.
We actually need
a) 1 bitmap for the blocks allocatted
b) 1 group desc for the blocks allocatted
c) 2 indirect
d) 2 dindirect
e) 1 tindirect
f) 5 bitmap for the indirect blocks allocated (2 + 2 + 1)
g) 5 group desc for the indirect blocks allocated
h) 1 inode
i) 1 super blocks
j) 2 * EXT4_QUOTA_TRANS_BLOCKS for quota
-aneesh
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists