Commit aa80167f authored by Nathan Scott's avatar Nathan Scott Committed by Nathan Scott

[XFS] Add a realtime inheritance bit for directory inodes so new

files can be automatically created as realtime files.

SGI Modid: xfs-linux:xfs-kern:177129a
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent e5bfd05f
......@@ -456,6 +456,7 @@ xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp);
#define XFS_DIFLAG_SYNC_BIT 5 /* inode is written synchronously */
#define XFS_DIFLAG_NOATIME_BIT 6 /* do not update atime */
#define XFS_DIFLAG_NODUMP_BIT 7 /* do not dump */
#define XFS_DIFLAG_RTINHERIT_BIT 8 /* create with realtime bit set */
#define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)
#define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)
#define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
......@@ -464,5 +465,11 @@ xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp);
#define XFS_DIFLAG_SYNC (1 << XFS_DIFLAG_SYNC_BIT)
#define XFS_DIFLAG_NOATIME (1 << XFS_DIFLAG_NOATIME_BIT)
#define XFS_DIFLAG_NODUMP (1 << XFS_DIFLAG_NODUMP_BIT)
#define XFS_DIFLAG_RTINHERIT (1 << XFS_DIFLAG_RTINHERIT_BIT)
#define XFS_DIFLAG_ANY \
(XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \
XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT)
#endif /* __XFS_DINODE_H__ */
......@@ -76,6 +76,7 @@ struct fsxattr {
#define XFS_XFLAG_SYNC 0x00000020 /* all writes synchronous */
#define XFS_XFLAG_NOATIME 0x00000040 /* do not update access time */
#define XFS_XFLAG_NODUMP 0x00000080 /* do not include in backups */
#define XFS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */
#define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
/*
......
......@@ -860,9 +860,11 @@ xfs_dic2xflags(
xfs_arch_t arch)
{
__uint16_t di_flags;
uint flags = 0;
uint flags;
di_flags = INT_GET(dic->di_flags, arch);
flags = XFS_CFORK_Q_ARCH(dic, arch) ? XFS_XFLAG_HASATTR : 0;
if (di_flags & XFS_DIFLAG_ANY) {
if (di_flags & XFS_DIFLAG_REALTIME)
flags |= XFS_XFLAG_REALTIME;
if (di_flags & XFS_DIFLAG_PREALLOC)
......@@ -877,8 +879,9 @@ xfs_dic2xflags(
flags |= XFS_XFLAG_NOATIME;
if (di_flags & XFS_DIFLAG_NODUMP)
flags |= XFS_XFLAG_NODUMP;
if (XFS_CFORK_Q_ARCH(dic, arch))
flags |= XFS_XFLAG_HASATTR;
if (di_flags & XFS_DIFLAG_RTINHERIT)
flags |= XFS_XFLAG_RTINHERIT;
}
return flags;
}
......@@ -1236,8 +1239,15 @@ xfs_ialloc(
break;
case S_IFREG:
case S_IFDIR:
if (pip->i_d.di_flags &
(XFS_DIFLAG_NOATIME|XFS_DIFLAG_NODUMP|XFS_DIFLAG_SYNC)) {
if (unlikely(pip->i_d.di_flags & XFS_DIFLAG_ANY)) {
if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) {
if ((mode & S_IFMT) == S_IFDIR) {
ip->i_d.di_flags |= XFS_DIFLAG_RTINHERIT;
} else {
ip->i_d.di_flags |= XFS_DIFLAG_REALTIME;
ip->i_iocore.io_flags |= XFS_IOCORE_RT;
}
}
if ((pip->i_d.di_flags & XFS_DIFLAG_NOATIME) &&
xfs_inherit_noatime)
ip->i_d.di_flags |= XFS_DIFLAG_NOATIME;
......@@ -1248,6 +1258,7 @@ xfs_ialloc(
xfs_inherit_sync)
ip->i_d.di_flags |= XFS_DIFLAG_SYNC;
}
/* FALLTHROUGH */
case S_IFLNK:
ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
ip->i_df.if_flags = XFS_IFEXTENTS;
......
......@@ -826,7 +826,8 @@ xfs_setattr(
/* can't set PREALLOC this way, just preserve it */
ip->i_d.di_flags =
(ip->i_d.di_flags & XFS_DIFLAG_PREALLOC);
if (vap->va_xflags & XFS_XFLAG_REALTIME) {
if (vap->va_xflags & XFS_XFLAG_REALTIME &&
(ip->i_d.di_mode & S_IFMT) == S_IFREG) {
ip->i_d.di_flags |= XFS_DIFLAG_REALTIME;
ip->i_iocore.io_flags |= XFS_IOCORE_RT;
} else {
......@@ -842,6 +843,9 @@ xfs_setattr(
ip->i_d.di_flags |= XFS_DIFLAG_NOATIME;
if (vap->va_xflags & XFS_XFLAG_NODUMP)
ip->i_d.di_flags |= XFS_DIFLAG_NODUMP;
if ((vap->va_xflags & XFS_XFLAG_RTINHERIT) &&
(ip->i_d.di_mode & S_IFMT) == S_IFDIR)
ip->i_d.di_flags |= XFS_DIFLAG_RTINHERIT;
}
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
timeflags |= XFS_ICHGTIME_CHG;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment