From: Shailendra Tripathi <stripathi@agami.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: David Chinner <dgc@sgi.com>,
xfs@oss.sgi.com, t-nagano@ah.jp.nec.com, xfs-dev@sgi.com
Subject: Re: [REVIEW 1 of 4] Clean up i_flags handling
Date: Tue, 24 Oct 2006 15:15:03 -0700 [thread overview]
Message-ID: <453E9067.1010107@agami.com> (raw)
In-Reply-To: <20061024213822.GA23909@infradead.org>
Christoph Hellwig wrote:
>> +/*
>> + * 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.
>
>
Isn't true that UNLOCK and LOCK in the given order imply full barrier
Chris ?
As the flag is modified only within the lock/unlock pair, if one tries
to access the field (test it), it should be like
LOCK IP
modify ...
UNLOCK IP -----|
| ---> This pair should act as a full
barrier.
LOCK IP -----|
read ...
UNLOCK IP
-shailendra
next prev parent reply other threads:[~2006-10-24 22:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-24 7:17 [REVIEW 1 of 4] Clean up i_flags handling David Chinner
2006-10-24 21:38 ` Christoph Hellwig
2006-10-24 22:15 ` Shailendra Tripathi [this message]
2006-10-26 9:46 ` David Chinner
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=453E9067.1010107@agami.com \
--to=stripathi@agami.com \
--cc=dgc@sgi.com \
--cc=hch@infradead.org \
--cc=t-nagano@ah.jp.nec.com \
--cc=xfs-dev@sgi.com \
--cc=xfs@oss.sgi.com \
/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