diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-08-12 12:50:09 +0200 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-22 15:40:24 +0200 |
commit | 0cb97766f2928579f1029ea7b28ae946cdd6fbe1 (patch) | |
tree | 4e64fcd122c5b3ddda050e23efc940eaaea4bb9c /fs/xfs/xfs_sb.h | |
parent | powerpc/spufs: convert userns uid/gid mount options to kuid/kgid (diff) | |
download | linux-0cb97766f2928579f1029ea7b28ae946cdd6fbe1.tar.xz linux-0cb97766f2928579f1029ea7b28ae946cdd6fbe1.zip |
xfs: Add read-only support for dirent filetype field
Add support for the file type field in directory entries so that
readdir can return the type of the inode the dirent points to to
userspace without first having to read the inode off disk.
The encoding of the type field is a single byte that is added to the
end of the directory entry name length. For all intents and
purposes, it appends a "hidden" byte to the name field which
contains the type information. As the directory entry is already of
dynamic size, helpers are already required to access and decode the
direct entry structures.
Hence the relevent extraction and iteration helpers are updated to
understand the hidden byte. Helpers for reading and writing the
filetype field from the directory entries are also added. Only the
read helpers are used by this patch. It also adds all the code
necessary to read the type information out of the dirents on disk.
Further we add the superblock feature bit and helpers to indicate
that we understand the on-disk format change. This is not a
compatible change - existing kernels cannot read the new format
successfully - so an incompatible feature flag is added. We don't
yet allow filesystems to mount with this flag yet - that will be
added once write support is added.
Finally, the code to take the type from the VFS, convert it to an
XFS on-disk type and put it into the xfs_name structures passed
around is added, but the directory code does not use this field yet.
That will be in the next patch.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_sb.h')
-rw-r--r-- | fs/xfs/xfs_sb.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h index db7593f4bc7e..3c297a451622 100644 --- a/fs/xfs/xfs_sb.h +++ b/fs/xfs/xfs_sb.h @@ -555,12 +555,6 @@ static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT; } -static inline int xfs_sb_version_hascrc(xfs_sb_t *sbp) -{ - return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5; -} - - /* * Extended v5 superblock feature masks. These are to be used for new v5 * superblock features only. @@ -599,7 +593,9 @@ xfs_sb_has_ro_compat_feature( return (sbp->sb_features_ro_compat & feature) != 0; } +#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ #define XFS_SB_FEAT_INCOMPAT_ALL 0 + #define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALL static inline bool xfs_sb_has_incompat_feature( @@ -619,11 +615,25 @@ xfs_sb_has_incompat_log_feature( return (sbp->sb_features_log_incompat & feature) != 0; } +/* + * V5 superblock specific feature checks + */ +static inline int xfs_sb_version_hascrc(xfs_sb_t *sbp) +{ + return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5; +} + static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp) { return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5; } +static inline int xfs_sb_version_hasftype(struct xfs_sb *sbp) +{ + return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 && + xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE); +} + /* * end of superblock version macros */ |