Whamcloud - gitweb
libext2fs: handle inline data in read/write function
authorZheng Liu <wenqing.lz@taobao.com>
Mon, 3 Mar 2014 05:35:51 +0000 (00:35 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 4 Mar 2014 13:46:14 +0000 (08:46 -0500)
commit54e880b870f7fe98a6ea23013c18e2a71e28c01c
tree12ab16759f5223e44d62d72f6e98f844ddb3f3f2
parent97581d448127f95dcc968c0785f7ab3413bf0222
libext2fs: handle inline data in read/write function

Currently ext2fs_file_read/write are used to copy data from/to a file.
But they manipulate data by blocksize.  For supporting inline data, we
handle it in two new fucntions called ext2fs_file_read/write_inline_data.

In read path the implementation is straightforward.  But in write path
things get more complicated because if the size of data is greater than
the maximum size of inline data we will expand this file.  So now we
will check this in ext2fs_inline_data_set.  If this inode doesn't have
enough space, it will return EXT2_ET_INLINE_DATA_NO_SPACE error.  Then
the caller will check this error and tries to expand the file.

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

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/debugfs.c
lib/ext2fs/ext2_err.et.in
lib/ext2fs/ext2fs.h
lib/ext2fs/ext2fsP.h
lib/ext2fs/ext_attr.c
lib/ext2fs/fileio.c
lib/ext2fs/inline_data.c