libext2fs: add INLINE_DATA into EXT2_LIB_SOFTSUPP_INCOMPAT

EXT4_FEATURE_INCOMPAT_INLINE_DATA flag is added into
EXT2_LIB_SOFTSUPP_INCOMPAT due to we still need to take a long time to
test inline_data feature.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
libext2fs: add function to check inline_data flag for an inode

A new file called `inline_data.c' is created, and a function called
`ext2fs_inode_has_inline_data' is defined to check whether an inode
has inline data or not.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
libext2fs: add functions to operate on extended attribute

We need to define some functions to operate extend attribute in order
to support inline data.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
libext2fs: handle inline data in dir iterator function

Inline_data is handled in dir iterator because a lot of commands use
this function to traverse directory entries debugfs.  We need to
handle inline_data individually because inline_data is saved in two
places.  One is in i_block, and another is in ibody extend attribute.

After adding this commit, the following commands in debugfs can
support the inline_data feature:
	- ncheck
	- chroot
	- cd
	- ls
	- pwd
	- link*
	- unlink

* If inline_data doesn't expand to ibody extend attribute, link command will
  allocate a new block for this inode instead of using extend attribute when we
  exhaust all space of i_block.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
libext2fs: handle inline_data in block iterator function

We needn't traverse blocks for an inode which has inline data because no block
belongs to it.  After appling this patch, the following commands in debugfs can
handle inline_data feature:
	- icheck
	- blocks
	- filefrag

In some places, block iterator functions are used to traverse blocks of
directory.  In this case, we need to check whether inode has inline_data flag or
not, and handle it manually.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs: make stat command support inline data

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs: make lsdel command support inline data

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
libext2fs: handle inline data in read/write function

Ext2fs_read/write_inline_data functions copy inline_data from/to
user's buffer directly.  When we want to write some data to a file
with inline_data, ext2fs_try_to_write_inline_data is called.  In this
function, it firstly check the length of data.  If the data can be
saved in innode, this function will create a new extend attribute to
record information of inline_data, and copy all data into this inode.

The following commands in debugfs can handle inline_data feature after
applying this patch:
	- dump
	- cat
	- rdump
	- write

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs: handle inline_data feature in dirsearch command

Inodes with inline_data don't have any blocks.  So we need to handle
them via a new function.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs: handle inline_data feature in bmap command

If an inode has inline data, bmap command will return the physical block of this
inode.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs: handle inline_data in punch command

Now punch command only can truncate an inode with inline_data.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
libext2fs: add inline_data feature into EXT2_LIB_FEATURE_INCOMPAT_SUPP

Let e2fsprogs support inline_data feature.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
mke2fs: add inline_data support in mke2fs

Ext_attr feature not enabled, inline_data feature doesn't be specified.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
tune2fs: add inline_data feature in tune2fs

Inline_data feature can be set when ext_attr feature is enabled.  Now this
feature only can be enabled because we may be out of space when disabling
it.  If this feature is disabled, we need to allocate a block for every
file and directory, and it might exhaust all space.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck: add problem descriptions and check inline data feature

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck: check inline_data in pass1

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck: check inline_data in pass2

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck: check inline_data in pass3

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
tests: change result in f_bad_disconnected_inode

In this test, inode flag is some random data, and when we apply inline data
patch set we should need to handle it.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
mke2fs: enable inline_data feature on ext4dev filesystem

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>