All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Zheng Liu <gnehzuil.liu@gmail.com>
Cc: linux-ext4@vger.kernel.org, Zheng Liu <wenqing.lz@taobao.com>
Subject: Re: [PATCH 07/36 v4] libext2fs: add inline_data file
Date: Tue, 7 Aug 2012 14:40:02 -0400	[thread overview]
Message-ID: <20120807184002.GB29928@thunk.org> (raw)
In-Reply-To: <1343735309-30579-8-git-send-email-wenqing.lz@taobao.com>

One major comment about the library functions.  The reason why we have
functions of the form ext2fs_foo(), ext2fs_foo2(), ext2fs_foo3(),
etc. is to preserve backwards compatibility of the ABI.  In general,
ext2fs_foo2() will have an extra parameter which wasn't in
ext2fs_foo(), and ext2fs_foo2() will have a superset of the
functionality of ext2fs_foo().  If later we need to add to add another
parameter to further extend the functionality of the function, we
might have an ext2fs_foo3(), which again will be a supserset of the
functionality of ext2fs_foo2().   

So in general, we only need to implement ext2fs_fooN(), and then
ext2fs_fooX where 0 <= X <= N simply call ext2fs_fooN with the extra
parameters defaulted out (usually to 0 or NULL).

It also follows that when we create a new function, there's no need to
do this.  So the fact that you have an ext2fs_inlinedata_iterate()
which just calls ext2fs_inline_data_iterate2() is not something you
need to do.

More seriously, ext2fs_inline_data_iterate3() has an implementation
which is completely different from that of
ext2fs_inline_data_iterate2(), and that's an immediate red flag.  This
means that these two functions are semantically different, and so they
should have fundamentally different names --- or you need to make
ext2fs_inline_data_iterate3() a strict superset of the functionality
of ext2fs_inline_data_iterate2().

Also, I note that there are a number of patches which basically do
this:

-	retval = ext2fs_dir_iterate2(current_fs, inode_num, 0,
-				    0, rmdir_proc, &rds);
+	if (ext2fs_has_inline_data(current_fs, inode_num))
+		retval = ext2fs_inline_data_iterate2(current_fs, inode_num, 0,
+						     0, rmdir_proc, &rds);
+	else
+		retval = ext2fs_dir_iterate2(current_fs, inode_num, 0,
+					    0, rmdir_proc, &rds);

The much better thing to do is to make ext2fs_dir_iterate2() check to
see if the inode has inline data, and if so, to call
ext2fs_inline_data_iterate2() directly.   This has a couple of benefits.

The first is it will reduce the number of patches we need to apply.
More importantly, it means that existing programs that don't know
about inline data, but who happen to use ext2fs_dir_iterate(), will be
able to work automatically, without requiring code changes.  It's also
much cleaner from a conceptual point of view, since the
ext2fs_dir_iterate abstraction shouldn't need to expose to the user
whether the directory data is inline or in a separate data block.

Regards,

						- Ted

  reply	other threads:[~2012-08-07 18:40 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 11:47 [PATCH 00/36 v4] e2fsprogs: make e2fsprogs support inline data Zheng Liu
2012-07-31 11:47 ` [PATCH 01/36 v4] libext2fs: add EXT4_FEATURE_INCOMPAT_INLINE_DATA flag Zheng Liu
2012-07-31 11:47 ` [PATCH 02/36 v4] mke2fs: make it support inline data feature Zheng Liu
2012-07-31 11:47 ` [PATCH 03/36 v4] mke2fs: add inline_data feature in mke2fs's manpage Zheng Liu
2012-07-31 11:47 ` [PATCH 04/36 v4] libext2fs: add ext2fs_find_entry_ext_attr function Zheng Liu
2012-07-31 11:47 ` [PATCH 05/36 v4] libext2fs: add EXT4_INLINE_DATA_FL flag for inode Zheng Liu
2012-08-07 18:27   ` Theodore Ts'o
2012-07-31 11:47 ` [PATCH 06/36 v4] libext2fs: add data structures for inline data feature Zheng Liu
2012-08-07 18:50   ` Theodore Ts'o
2012-08-13  8:10     ` Zheng Liu
2012-07-31 11:48 ` [PATCH 07/36 v4] libext2fs: add inline_data file Zheng Liu
2012-08-07 18:40   ` Theodore Ts'o [this message]
2012-08-13  8:07     ` Zheng Liu
2012-07-31 11:48 ` [PATCH 08/36 v4] debugfs: make ncheck cmd support inline data Zheng Liu
2012-07-31 11:48 ` [PATCH 09/36 v4] debugfs: make icheck " Zheng Liu
2012-07-31 11:48 ` [PATCH 10/36 v4] debugfs: make chroot and cd " Zheng Liu
2012-07-31 11:48 ` [PATCH 11/36 v4] debugfs: make ls " Zheng Liu
2012-07-31 11:48 ` [PATCH 12/36 v4] debugfs: make stat " Zheng Liu
2012-07-31 11:48 ` [PATCH 13/36 v4] debugfs: make blocks " Zheng Liu
2012-07-31 11:48 ` [PATCH 14/36 v4] debugfs: make filefrag " Zheng Liu
2012-07-31 11:48 ` [PATCH 15/36 v4] debugfs: make link " Zheng Liu
2012-07-31 11:48 ` [PATCH 16/36 v4] debugfs: make unlink " Zheng Liu
2012-07-31 11:48 ` [PATCH 17/36 v4] debugfs: make mkdir " Zheng Liu
2012-07-31 11:48 ` [PATCH 18/36 v4] debugfs: make rmdir " Zheng Liu
2012-07-31 11:48 ` [PATCH 19/36 v4] debugfs: make rm and kill_file " Zheng Liu
2012-07-31 11:48 ` [PATCH 20/36 v4] debugfs: make pwd " Zheng Liu
2012-07-31 11:48 ` [PATCH 21/36 v4] debugfs: make expand_dir " Zheng Liu
2012-07-31 11:48 ` [PATCH 22/36 v4] debugfs: make lsdel " Zheng Liu
2012-07-31 11:48 ` [PATCH 23/36 v4] debugfs: make undelete " Zheng Liu
2012-07-31 11:48 ` [PATCH 24/36 v4] debugfs: make dump and cat " Zheng Liu
2012-07-31 11:48 ` [PATCH 25/36 v4] debugfs: make rdump " Zheng Liu
2012-07-31 11:48 ` [PATCH 26/36 v4] debugfs: make dirsearch " Zheng Liu
2012-07-31 11:48 ` [PATCH 27/36 v4] debugfs: make bmap " Zheng Liu
2012-07-31 11:48 ` [PATCH 28/36 v4] debugfs: make punch/truncate " Zheng Liu
2012-07-31 11:48 ` [PATCH 29/36 v4] e2fsck: add three problem descriptions in pass1 Zheng Liu
2012-07-31 11:48 ` [PATCH 30/36 v4] e2fsck: check incorrect inline data flag Zheng Liu
2012-07-31 11:48 ` [PATCH 31/36 v4] e2fsck: make pass1 support inline data Zheng Liu
2012-07-31 11:48 ` [PATCH 32/36 v4] libext2fs: add read/write inline data functions Zheng Liu
2012-07-31 11:48 ` [PATCH 33/36 v4] e2fsck: check inline data in pass2 Zheng Liu
2012-07-31 11:48 ` [PATCH 34/36 v4] mke2fs: enable inline_data feature on ext4dev filesystem Zheng Liu
2012-07-31 11:48 ` [PATCH 35/36 v4] tests: change test f_bad_disconnected_inode to support inline_data feature Zheng Liu
2012-07-31 11:48 ` [PATCH 36/36 v4] tune2fs: set " Zheng Liu
2012-09-17  1:06 ` [PATCH 00/36 v4] e2fsprogs: make e2fsprogs support inline data Theodore Ts'o
2012-09-17  2:04   ` 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=20120807184002.GB29928@thunk.org \
    --to=tytso@mit.edu \
    --cc=gnehzuil.liu@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.