xfs
[Top] [All Lists]

Re: [REVIEW 1 of 4] Clean up i_flags handling

To: David Chinner <dgc@xxxxxxx>
Subject: Re: [REVIEW 1 of 4] Clean up i_flags handling
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Tue, 24 Oct 2006 22:38:22 +0100
Cc: xfs@xxxxxxxxxxx, t-nagano@xxxxxxxxxxxxx, xfs-dev@xxxxxxx
In-reply-to: <20061024071723.GR11034@xxxxxxxxxxxxxxxxx>
References: <20061024071723.GR11034@xxxxxxxxxxxxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
> +/*
> + * i_flags helper functions
> + */
> +static inline void
> +__xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
> +{
> +     ip->i_flags |= flags;
> +}
> +
> +static inline void
> +xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
> +{
> +     spin_lock(&ip->i_flags_lock);
> +     __xfs_iflags_set(ip, flags);
> +     spin_unlock(&ip->i_flags_lock);
> +}

This is not actually 

> +
> +static inline void
> +xfs_iflags_clear(xfs_inode_t *ip, unsigned short flags)
> +{
> +     spin_lock(&ip->i_flags_lock);
> +     ip->i_flags &= ~flags;
> +     spin_unlock(&ip->i_flags_lock);
> +}
> +
> +static inline int
> +__xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
> +{
> +     return (ip->i_flags & flags);
> +}
> +
> +static inline int
> +xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
> +{
> +     int ret;
> +     spin_lock(&ip->i_flags_lock);
> +     ret = __xfs_iflags_test(ip, flags);
> +     spin_unlock(&ip->i_flags_lock);
> +     return ret;

This is not actually guaranteed to work on machiens with very weak
memory ordering.  Please use the *_bit routines from bitops.h instead.


<Prev in Thread] Current Thread [Next in Thread>