public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: utz lehmann <xfs2@s2y4n2c.de>
Cc: linux-xfs <linux-xfs@oss.sgi.com>
Subject: Re: simpler _xfs_dic2xflags() ?
Date: Sat, 14 Aug 2010 09:16:19 +1000	[thread overview]
Message-ID: <20100813231619.GG10429@dastard> (raw)
In-Reply-To: <1281738591.5897.17.camel@segv.aura.of.mankind>

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

      reply	other threads:[~2010-08-13 23:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-13 22:29 simpler _xfs_dic2xflags() ? utz lehmann
2010-08-13 23:16 ` Dave Chinner [this message]

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=20100813231619.GG10429@dastard \
    --to=david@fromorbit.com \
    --cc=linux-xfs@oss.sgi.com \
    --cc=xfs2@s2y4n2c.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox