All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 00/11] common implementation of dirent file types
@ 2016-12-19 20:10 Amir Goldstein
  2016-12-19 20:10 ` [RFC][PATCH 01/11] fs: common implementation of file type conversions Amir Goldstein
                   ` (10 more replies)
  0 siblings, 11 replies; 35+ messages in thread
From: Amir Goldstein @ 2016-12-19 20:10 UTC (permalink / raw)
  To: Jan Kara, Theodore Ts'o, Dave Chinner
  Cc: Darrick J . Wong, Chris Mason, Boaz Harrosh, Jaegeuk Kim,
	Ryusuke Konishi, Mark Fasheh, Evgeniy Dushistov, Miklos Szeredi,
	Al Viro, linux-fsdevel

This cleanup series removes 8 instances of duplicated code.
Most of the duplication dates back to git pre-historic era.

The controversial aspect of this cleanup is that it uses common
code to handle file system specific on-disk format bits.
All 8 file systems use a single byte to store dirent file type
on-disk and all of them use the same conversion routines from
i_mode to 4bits DT_* constants to 3bits on-disk FT_* constants.

Patch 1 hoists a common implementation to file_type.h and
add some useful conversion helpers.

Patches 2-3 makes use of some helpers in ufs and hfsplus
without any on-disk implications.

Patches 4-3 replace the specific implementation in ext2 and exofs
with the common implementation.  In this case, the fs specific
constants (EXT2_FT_*) are defined in local include file and never
used, so the constants have been removed.

Patches 5-6 replace the specific implementation in ext4 and ocfs2
with the common implementation.  In this case, the fs specific
constants (EXT4_FT_*) are defined in local include file that look
like it is a version of an include file used in a library.
The constants remained in the include file and were defined to
refer to the common constants (EXT4_FT_DIR => FT_DIR).

Patches 7-8 replace the specific implementation in f2fs and nilfs2
with the common implementation.  In this case, the fs specific
constants (F2FS_FT_*) are defined in a global include file.
The constants remained in the include file a comment was added
to keep them in sync with the common constants.

Patches 9-10 replace the specific implementation in btrfs and xfs
with the common implementation.  In this case, the fs specific
constants (BTRFS_FT_*) are defined in an include file that is
also used by a library.  Also, both btrfs and xfs use the 4th bit
of the file type on-disk.  The constants remained in the include
file and a comment was added that constants 0..7 should be kept
in sync with the common constants.

I posted xfstest generic/396 to sanity test d_type in readdir.
Tested these patches on ext2, ext4, xfs.
In any case, all the individual fs patches are completely independent
of each other and all depend only on patch 1, so each fs maintainer
can test and apply the relevant patch to his tree after the
common implementation is merged.

Obviously, I am looking for feedback from fs maintainers if the
approach chosen for their fs is the right approach and feedback
on the cleanup in general.

Amir Goldstein (11):
  fs: common implementation of file type conversions
  ufs: use fs_umode_to_dtype() helper
  hfsplus: use fs_umode_to_dtype() helper
  ext2: use common file type conversion
  exofs: use common file type conversion
  ext4: use common file type conversion
  ocfs2: use common file type conversion
  f2fs: use common file type conversion
  nilfs2: use common file type conversion
  btrfs: use common file type conversion
  xfs: use common file type conversion

 fs/btrfs/btrfs_inode.h             |   2 -
 fs/btrfs/delayed-inode.c           |   2 +-
 fs/btrfs/inode.c                   |  19 +------
 fs/exofs/common.h                  |  12 -----
 fs/exofs/dir.c                     |  34 +-----------
 fs/ext2/dir.c                      |  35 +++---------
 fs/ext2/ext2.h                     |  16 ------
 fs/ext4/ext4.h                     |  38 +++++--------
 fs/f2fs/dir.c                      |  27 +---------
 fs/f2fs/inline.c                   |   2 +-
 fs/hfsplus/dir.c                   |  16 +-----
 fs/nilfs2/dir.c                    |  38 ++-----------
 fs/ocfs2/dir.c                     |  18 ++-----
 fs/ocfs2/ocfs2_fs.h                |  32 ++++-------
 fs/ufs/util.h                      |  29 +---------
 fs/xfs/libxfs/xfs_da_format.h      |   5 +-
 fs/xfs/libxfs/xfs_dir2.c           |  17 ------
 fs/xfs/libxfs/xfs_dir2.h           |   6 ---
 fs/xfs/xfs_iops.c                  |   2 +-
 include/linux/f2fs_fs.h            |   8 +--
 include/linux/file_type.h          | 107 +++++++++++++++++++++++++++++++++++++
 include/linux/fs.h                 |  17 +-----
 include/uapi/linux/btrfs_tree.h    |   2 +
 include/uapi/linux/nilfs2_ondisk.h |   1 +
 24 files changed, 167 insertions(+), 318 deletions(-)
 create mode 100644 include/linux/file_type.h

-- 
2.7.4


^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2016-12-24 14:12 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 20:10 [RFC][PATCH 00/11] common implementation of dirent file types Amir Goldstein
2016-12-19 20:10 ` [RFC][PATCH 01/11] fs: common implementation of file type conversions Amir Goldstein
2016-12-19 21:13   ` Darrick J. Wong
2016-12-20  5:01     ` Amir Goldstein
2016-12-20  7:37   ` [RFC][PATCH v2 " Amir Goldstein
2016-12-19 20:10 ` [RFC][PATCH 02/11] ufs: use fs_umode_to_dtype() helper Amir Goldstein
2016-12-19 20:11 ` [RFC][PATCH 03/11] hfsplus: " Amir Goldstein
2016-12-19 20:11 ` [RFC][PATCH 04/11] ext2: use common file type conversion Amir Goldstein
2016-12-19 20:11 ` [RFC][PATCH 05/11] exofs: " Amir Goldstein
2016-12-19 21:50   ` Boaz Harrosh
2016-12-19 20:11 ` [RFC][PATCH 06/11] ext4: " Amir Goldstein
2016-12-19 20:11 ` [RFC][PATCH 07/11] ocfs2: " Amir Goldstein
2016-12-19 20:11 ` [RFC][PATCH 08/11] f2fs: " Amir Goldstein
2016-12-19 20:11 ` [RFC][PATCH 09/11] nilfs2: " Amir Goldstein
2016-12-19 20:11 ` [RFC][PATCH 10/11] btrfs: " Amir Goldstein
2016-12-19 20:11 ` [RFC][PATCH 11/11] xfs: " Amir Goldstein
2016-12-19 21:55   ` Darrick J. Wong
2016-12-20  6:17     ` Amir Goldstein
2016-12-20 14:07       ` Amir Goldstein
2016-12-20  0:28   ` Darrick J. Wong
2016-12-20  5:20     ` Amir Goldstein
2016-12-21  5:23       ` Dave Chinner
2016-12-21  6:37         ` Amir Goldstein
2016-12-21 10:12           ` [RFC][PATCH v2 " Amir Goldstein
2016-12-21 18:01             ` [PATCH v3 " Amir Goldstein
2016-12-22 21:07               ` [PATCH v4] xfs: fix the size of xfs_mode_to_ftype table Amir Goldstein
2016-12-23 21:01                 ` Darrick J. Wong
2016-12-24  7:31                   ` Amir Goldstein
2016-12-24 14:11                 ` Brian Foster
2016-12-21 15:06         ` [RFC][PATCH 11/11] xfs: use common file type conversion Theodore Ts'o
2016-12-21 16:37           ` Amir Goldstein
2016-12-21 22:56             ` Theodore Ts'o
2016-12-22  5:54               ` Amir Goldstein
2016-12-22 20:30                 ` Amir Goldstein
2016-12-21 16:59           ` Miklos Szeredi

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.