]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: journal credits calulation cleanup and fix for non-extent writepage
authorMingming Cao <cmm@us.ibm.com>
Wed, 20 Aug 2008 02:16:07 +0000 (22:16 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 20 Aug 2008 02:16:07 +0000 (22:16 -0400)
commit90de36b9f2fd4fde86ffb909804b95e3de3c4ff9
tree78764672019b22a5a8925abc702d7c54244138e8
parentb461766b40dd1b3994ad0b9d396b1cd9473de968
ext4: journal credits calulation cleanup and fix for non-extent writepage

When considering how many journal credits are needed for modifying a
chunk of data, we need to account for the super block, inode block,
quota blocks and xattr block, indirect/index blocks, also, group bitmap
and group descriptor blocks for new allocation (including data and
indirect/index blocks). There are many places in ext4 do the calculation
on their own and often missed one or two meta blocks, and often they
assume single block allocation, and did not considering the multile
chunk of allocation case.

This patch is trying to cleanup current journal credit code, provides
some common helper funtion to calculate the journal credits, to be used
for writepage, writepages, DIO, fallocate, migration, defrag, and for
both nonextent and extent files.

This patch modified the writepage/write_begin credit caculation for
nonextent files, to use the new helper function. It also fixed the
problem that writepage on nonextent files did not consider the case
blocksize <pagesize, thus could possibelly need multiple block
allocation in a single transaction.

Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/ext4_jbd2.h
fs/ext4/inode.c