From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Zheng Liu <gnehzuil.liu@gmail.com>
Cc: linux-ext4@vger.kernel.org, "Theodore Ts'o" <tytso@mit.edu>,
Zheng Liu <wenqing.lz@taobao.com>
Subject: Re: [PATCH v3 22/30] tune2fs: add inline_data feature in tune2fs
Date: Tue, 10 Dec 2013 13:06:31 -0800 [thread overview]
Message-ID: <20131210210631.GD10143@birch.djwong.org> (raw)
In-Reply-To: <1386323897-2354-23-git-send-email-wenqing.lz@taobao.com>
On Fri, Dec 06, 2013 at 05:58:09PM +0800, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
>
> This commit make us switch on/off inline_data feature in tune2fs. Now
> inline_data can be enabled without ext_attr. Hence we don't check it.
> As doing in mke2fs we need to check inode size when we want to enable
> it.
>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> ---
> misc/tune2fs.8.in | 3 ++
> misc/tune2fs.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 97 insertions(+), 2 deletions(-)
>
> diff --git a/misc/tune2fs.8.in b/misc/tune2fs.8.in
> index 55c6dd9..8d56cdd 100644
> --- a/misc/tune2fs.8.in
> +++ b/misc/tune2fs.8.in
> @@ -531,6 +531,9 @@ Setting the filesystem feature is equivalent to using the
> .B \-j
> option.
> .TP
> +.B inline_data
> +Allow data to be stored in the inode and extended attribute area.
> +.TP
> .B large_file
> Filesystem can contain files that are greater than 2GB. (Modern kernels
> set this feature automatically when a file > 2GB is created.)
> diff --git a/misc/tune2fs.c b/misc/tune2fs.c
> index 95c1886..d205df5 100644
> --- a/misc/tune2fs.c
> +++ b/misc/tune2fs.c
> @@ -92,6 +92,7 @@ static unsigned long new_inode_size;
> static char *ext_mount_opts;
> static int usrquota, grpquota;
> static int rewrite_checksums;
> +static int disable_inline_data;
>
> int journal_size, journal_flags;
> char *journal_device;
> @@ -140,7 +141,8 @@ static __u32 ok_features[3] = {
> EXT2_FEATURE_INCOMPAT_FILETYPE |
> EXT3_FEATURE_INCOMPAT_EXTENTS |
> EXT4_FEATURE_INCOMPAT_FLEX_BG |
> - EXT4_FEATURE_INCOMPAT_MMP,
> + EXT4_FEATURE_INCOMPAT_MMP |
> + EXT4_FEATURE_INCOMPAT_INLINE_DATA,
> /* R/O compat */
> EXT2_FEATURE_RO_COMPAT_LARGE_FILE |
> EXT4_FEATURE_RO_COMPAT_HUGE_FILE|
> @@ -162,7 +164,8 @@ static __u32 clear_ok_features[3] = {
> /* Incompat */
> EXT2_FEATURE_INCOMPAT_FILETYPE |
> EXT4_FEATURE_INCOMPAT_FLEX_BG |
> - EXT4_FEATURE_INCOMPAT_MMP,
> + EXT4_FEATURE_INCOMPAT_MMP |
> + EXT4_FEATURE_INCOMPAT_INLINE_DATA,
> /* R/O compat */
> EXT2_FEATURE_RO_COMPAT_LARGE_FILE |
> EXT4_FEATURE_RO_COMPAT_HUGE_FILE|
> @@ -745,6 +748,68 @@ static void rewrite_metadata_checksums(ext2_filsys fs)
> ext2fs_mark_super_dirty(fs);
> }
>
> +/*
> + * Allocate a block for all inodes with inline data.
> + */
> +static void expand_inodes(ext2_filsys fs)
> +{
> + int inode_size = EXT2_INODE_SIZE(fs->super);
> + struct ext2_inode *inode;
> + ext2_inode_scan scan;
> + errcode_t retval;
> + ext2_ino_t ino;
> +
> + retval = ext2fs_open_inode_scan(fs, 0, &scan);
> + if (retval) {
> + com_err("expand_inline_data", retval,
> + "while opening inode scan");
> + exit(1);
> + }
> +
> + retval = ext2fs_get_mem(inode_size, &inode);
> + if (retval) {
> + com_err("expand_inline_data", retval,
> + "while allocating memory");
> + exit(1);
> + }
> +
> + do {
> + retval = ext2fs_get_next_inode_full(scan, &ino, inode,
> + inode_size);
> + if (retval) {
> + com_err("expand_inline_data", retval,
> + "while getting next inode");
> + exit(1);
> + }
> + if (!ino)
> + break;
> + if (!ext2fs_test_inode_bitmap2(fs->inode_map, ino))
> + continue;
> + if (!(inode->i_flags & EXT4_INLINE_DATA_FL))
> + continue;
> + retval = ext2fs_inline_data_expand(fs, ino);
> + if (retval) {
> + com_err("expand_inline_data", retval,
> + "while expanding inode %lu", ino);
> + exit(1);
> + }
> + } while (ino);
> +
> + ext2fs_free_mem(&inode);
> + ext2fs_close_inode_scan(scan);
> +}
> +
> +static void expand_inline_data(ext2_filsys fs)
> +{
> + ext2fs_read_bitmaps(fs);
> + expand_inodes(fs);
> + ext2fs_mark_ib_dirty(fs);
> + ext2fs_mark_bb_dirty(fs);
> + ext2fs_mmp_update2(fs, 1);
> + fs->flags &= ~EXT2_FLAG_SUPER_ONLY;
> + ext2fs_mark_super_dirty(fs);
> +}
> +
> static void enable_uninit_bg(ext2_filsys fs)
> {
> struct ext2_group_desc *gd;
> @@ -1083,6 +1148,31 @@ mmp_error:
> disable_uninit_bg(fs,
> EXT4_FEATURE_RO_COMPAT_GDT_CSUM);
>
> + if (FEATURE_ON(E2P_FEATURE_INCOMPAT,
> + EXT4_FEATURE_INCOMPAT_INLINE_DATA)) {
> + /*
> + * Check inode size. If inode size is 128, tell user that
> + * inline data is useless.
> + */
> + if (EXT2_INODE_SIZE(fs->super) == EXT2_GOOD_OLD_INODE_SIZE) {
> + fputs(_("The inode size is too small to "
> + "store inline data.\n"), stderr);
> + return 1;
> + }
> + }
> +
> + if (FEATURE_OFF(E2P_FEATURE_INCOMPAT,
> + EXT4_FEATURE_INCOMPAT_INLINE_DATA)) {
> + if (mount_flags & EXT2_MF_MOUNTED) {
> + fputs(_("The inline data feature can't be clear if "
"can't be cleared"
--D
> + "the filesystem is mounted\n"), stderr);
> + return 1;
> + }
> + if (check_fsck_needed(fs))
> + return 1;
> + disable_inline_data = 1;
> + }
> +
> if (FEATURE_ON(E2P_FEATURE_RO_INCOMPAT,
> EXT4_FEATURE_RO_COMPAT_QUOTA)) {
> /*
> @@ -2708,6 +2798,8 @@ retry_open:
> }
> if (rewrite_checksums)
> rewrite_metadata_checksums(fs);
> + if (disable_inline_data)
> + expand_inline_data(fs);
> if (I_flag) {
> if (mount_flags & EXT2_MF_MOUNTED) {
> fputs(_("The inode size may only be "
> --
> 1.7.9.7
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-12-10 21:06 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-06 9:57 [PATCH v3 00/30] e2fsprogs: inline data refinement patch set Zheng Liu
2013-12-06 9:57 ` [PATCH v3 01/30] libext2fs: support modifying arbitrary extended attributes Zheng Liu
2013-12-06 9:57 ` [PATCH v3 02/30] libext2fs: various tweaks to the xattr editor APIs Zheng Liu
2013-12-06 9:57 ` [PATCH v3 03/30] libext2fs: extend xattr api to query number of attrs Zheng Liu
2013-12-06 9:57 ` [PATCH v3 04/30] libext2fs: fix memory leaks in extended attribute code Zheng Liu
2013-12-06 9:57 ` [PATCH v3 05/30] libext2fs: fix block leak when releasing xattr block Zheng Liu
2013-12-06 9:57 ` [PATCH v3 06/30] libext2fs: remove redundant code Zheng Liu
2013-12-06 9:57 ` [PATCH v3 07/30] libext2fs: free key/value pairs before reading Zheng Liu
2013-12-06 9:57 ` [PATCH v3 08/30] debugfs: dump all extended attributes Zheng Liu
2013-12-06 9:57 ` [PATCH v3 09/30] libext2fs: check inline_data in ext2fs_xattrs_read/write Zheng Liu
2013-12-06 21:38 ` Darrick J. Wong
2013-12-07 3:45 ` Zheng Liu
2014-03-03 23:33 ` Darrick J. Wong
2013-12-06 9:57 ` [PATCH v3 10/30] libext2fs: define new dirent_swab interfaces for inline data Zheng Liu
2014-03-03 15:49 ` Theodore Ts'o
2014-03-13 16:32 ` jon ernst
2014-03-14 2:44 ` Theodore Ts'o
2013-12-06 9:57 ` [PATCH v3 11/30] libext2fs: handle inline data in dir iterator function Zheng Liu
2014-03-03 22:16 ` Theodore Ts'o
2014-03-03 23:31 ` Darrick J. Wong
2014-03-04 13:56 ` Theodore Ts'o
2014-03-04 4:48 ` Zheng Liu
2013-12-06 9:57 ` [PATCH v3 12/30] libext2fs: handle inline_data in block " Zheng Liu
2013-12-06 9:58 ` [PATCH v3 13/30] debugfs: make stat command support inline data Zheng Liu
2013-12-06 9:58 ` [PATCH v3 14/30] debugfs: make expand " Zheng Liu
2013-12-06 9:58 ` [PATCH v3 15/30] debugfs: make mkdir " Zheng Liu
2013-12-06 9:58 ` [PATCH v3 16/30] debugfs: make lsdel " Zheng Liu
2013-12-06 9:58 ` [PATCH v3 17/30] debugfs: handle inline_data feature in bmap command Zheng Liu
2013-12-06 9:58 ` [PATCH v3 18/30] debugfs: handle inline data feature in punch command Zheng Liu
2013-12-06 9:58 ` [PATCH v3 19/30] libext2fs: handle inline data in read/write function Zheng Liu
2014-03-03 23:57 ` Darrick J. Wong
2013-12-06 9:58 ` [PATCH v3 20/30] libext2fs: add inline_data feature into EXT2_LIB_FEATURE_INCOMPAT_SUPP Zheng Liu
2013-12-06 9:58 ` [PATCH v3 21/30] mke2fs: add inline_data support in mke2fs Zheng Liu
2013-12-06 9:58 ` [PATCH v3 22/30] tune2fs: add inline_data feature in tune2fs Zheng Liu
2013-12-10 21:06 ` Darrick J. Wong [this message]
2013-12-06 9:58 ` [PATCH v3 23/30] e2fsck: add problem descriptions and check inline data feature Zheng Liu
2013-12-06 9:58 ` [PATCH v3 24/30] e2fsck: check inline_data in pass1 Zheng Liu
2014-03-03 22:18 ` Theodore Ts'o
2014-03-04 4:51 ` Zheng Liu
2013-12-06 9:58 ` [PATCH v3 25/30] e2fsck: check inline_data in pass2 Zheng Liu
2013-12-06 9:58 ` [PATCH v3 26/30] e2fsck: check inline_data in pass3 Zheng Liu
2013-12-06 9:58 ` [PATCH v3 27/30] tests: change result in f_bad_disconnected_inode Zheng Liu
2013-12-06 9:58 ` [PATCH v3 28/30] mke2fs: enable inline_data feature on ext4dev filesystem Zheng Liu
2013-12-06 9:58 ` [PATCH v3 29/30] libext2fs: export inode cahce creation function Zheng Liu
2013-12-06 9:58 ` [PATCH v3 30/30] libext2fs: add a unit test for inline data Zheng Liu
2013-12-07 1:53 ` [PATCH v3 00/30] e2fsprogs: inline data refinement patch set Darrick J. Wong
2013-12-07 3:43 ` Zheng Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131210210631.GD10143@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=gnehzuil.liu@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=wenqing.lz@taobao.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).