* simpler _xfs_dic2xflags() ?
@ 2010-08-13 22:29 utz lehmann
2010-08-13 23:16 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: utz lehmann @ 2010-08-13 22:29 UTC (permalink / raw)
To: linux-xfs
Hello
I just found following function in xfs_inode.c:
STATIC uint
_xfs_dic2xflags(
__uint16_t di_flags)
{
uint flags = 0;
if (di_flags & XFS_DIFLAG_ANY) {
if (di_flags & XFS_DIFLAG_REALTIME)
flags |= XFS_XFLAG_REALTIME;
if (di_flags & XFS_DIFLAG_PREALLOC)
flags |= XFS_XFLAG_PREALLOC;
if (di_flags & XFS_DIFLAG_IMMUTABLE)
flags |= XFS_XFLAG_IMMUTABLE;
if (di_flags & XFS_DIFLAG_APPEND)
flags |= XFS_XFLAG_APPEND;
if (di_flags & XFS_DIFLAG_SYNC)
flags |= XFS_XFLAG_SYNC;
if (di_flags & XFS_DIFLAG_NOATIME)
flags |= XFS_XFLAG_NOATIME;
if (di_flags & XFS_DIFLAG_NODUMP)
flags |= XFS_XFLAG_NODUMP;
if (di_flags & XFS_DIFLAG_RTINHERIT)
flags |= XFS_XFLAG_RTINHERIT;
if (di_flags & XFS_DIFLAG_PROJINHERIT)
flags |= XFS_XFLAG_PROJINHERIT;
if (di_flags & XFS_DIFLAG_NOSYMLINKS)
flags |= XFS_XFLAG_NOSYMLINKS;
if (di_flags & XFS_DIFLAG_EXTSIZE)
flags |= XFS_XFLAG_EXTSIZE;
if (di_flags & XFS_DIFLAG_EXTSZINHERIT)
flags |= XFS_XFLAG_EXTSZINHERIT;
if (di_flags & XFS_DIFLAG_NODEFRAG)
flags |= XFS_XFLAG_NODEFRAG;
if (di_flags & XFS_DIFLAG_FILESTREAM)
flags |= XFS_XFLAG_FILESTREAM;
}
return flags;
}
Can't the whole function be replaced by something like this?
flags = di_flags & MASK;
The corresponding XFS_DIFLAGS and XFS_XFLAGS have the same values.
utz
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: simpler _xfs_dic2xflags() ?
2010-08-13 22:29 simpler _xfs_dic2xflags() ? utz lehmann
@ 2010-08-13 23:16 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2010-08-13 23:16 UTC (permalink / raw)
To: utz lehmann; +Cc: linux-xfs
On Sat, Aug 14, 2010 at 12:29:51AM +0200, utz lehmann wrote:
> Hello
>
> I just found following function in xfs_inode.c:
>
> STATIC uint
> _xfs_dic2xflags(
> __uint16_t di_flags)
> {
> uint flags = 0;
>
> if (di_flags & XFS_DIFLAG_ANY) {
> if (di_flags & XFS_DIFLAG_REALTIME)
> flags |= XFS_XFLAG_REALTIME;
> if (di_flags & XFS_DIFLAG_PREALLOC)
> flags |= XFS_XFLAG_PREALLOC;
> if (di_flags & XFS_DIFLAG_IMMUTABLE)
> flags |= XFS_XFLAG_IMMUTABLE;
> if (di_flags & XFS_DIFLAG_APPEND)
> flags |= XFS_XFLAG_APPEND;
> if (di_flags & XFS_DIFLAG_SYNC)
> flags |= XFS_XFLAG_SYNC;
> if (di_flags & XFS_DIFLAG_NOATIME)
> flags |= XFS_XFLAG_NOATIME;
> if (di_flags & XFS_DIFLAG_NODUMP)
> flags |= XFS_XFLAG_NODUMP;
> if (di_flags & XFS_DIFLAG_RTINHERIT)
> flags |= XFS_XFLAG_RTINHERIT;
> if (di_flags & XFS_DIFLAG_PROJINHERIT)
> flags |= XFS_XFLAG_PROJINHERIT;
> if (di_flags & XFS_DIFLAG_NOSYMLINKS)
> flags |= XFS_XFLAG_NOSYMLINKS;
> if (di_flags & XFS_DIFLAG_EXTSIZE)
> flags |= XFS_XFLAG_EXTSIZE;
> if (di_flags & XFS_DIFLAG_EXTSZINHERIT)
> flags |= XFS_XFLAG_EXTSZINHERIT;
> if (di_flags & XFS_DIFLAG_NODEFRAG)
> flags |= XFS_XFLAG_NODEFRAG;
> if (di_flags & XFS_DIFLAG_FILESTREAM)
> flags |= XFS_XFLAG_FILESTREAM;
> }
>
> return flags;
> }
>
> Can't the whole function be replaced by something like this?
>
> flags = di_flags & MASK;
>
> The corresponding XFS_DIFLAGS and XFS_XFLAGS have the same values.
Sure they have the same value right now, but remember that
XFS_XFLAG_* values are part of userspace ABI and the XFS_DIFLAG_*
define to the on-disk format values.
We keep a logical separation of the two as there is no guarantee
they will remain the same over time. Indeed, there are XFS_XFLAGS_*
values that have no equivalent XFS_DIFLAG_ value. Further, we are
out of space for new flags in the inode flags field and hence any
new on-disk flags will be in a different format to the current on
disk values and hence we'd break any masking based optimisation if
we change them...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-13 23:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-13 22:29 simpler _xfs_dic2xflags() ? utz lehmann
2010-08-13 23:16 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox