Whamcloud - gitweb
libext2fs: Improve flex_bg inode table placement algorithm
authorTheodore Ts'o <tytso@mit.edu>
Mon, 30 Nov 2009 17:24:59 +0000 (12:24 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 30 Nov 2009 17:24:59 +0000 (12:24 -0500)
commitbbb60e4fefdd404d8d696369804b556b404bb0c1
tree8421d02184e621b2a9bff9621d00ce802af679ec
parent7bb82079a5d2b4e39d2f3e3655210808560a9233
libext2fs: Improve flex_bg inode table placement algorithm

When trying to find the best place for the inode table in the last
flex block group, use the true size for the flex_bg's portion of the
inode table instead of the worst case required size of the inode table
fragment if the file system is resized.  This fixes a corner case
where if the size of the filesystem is just big enough that there is
only room for a single block group in the last flex_bg, and that
partial block group is too small for the full portion of the inode
table, the inode table is placed in the very first block group:

Group 64: (Blocks 2097152-2099199) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0xd305, unused inodes 8080
  Block bitmap at 2097152 (+0), Inode bitmap at 2097168 (+16)
  Inode table at 8626-9130 (+4292878770)
                 ^^^^^^^^^

Thanks to Vyacheslav Dubeyko for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/alloc_tables.c