structs with bitfields and spinlocks/atomics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I would like to point out that xfs-code may need a review, whether it is affected by compiler issues as described in [1]. There has been a patch [2] for btrfs this year summarizing the problem as follows:

On ia64, powerpc64 and sparc64 the bitfield is modified through a RMW cycle and current gcc rewrites the adjacent 4B word, which in case of a spinlock or atomic has disaterous effect.

In xfs_aops.h we have
typedef struct xfs_ioend {
        struct xfs_ioend        *io_list;
        unsigned int            io_type;
        int                     io_error;
        atomic_t                io_remaining;
        unsigned int            io_isasync : 1;
        unsigned int            io_isdirect : 1;
[...]

where atomic_t, io_isasync and io_isdirect presumably share a common 8B word. I only found this occurrence so far.

Thanks to Dave Chinner for pointing out the correct mailing list.

Best regards
 Damian Lukowski

[1] https://lkml.org/lkml/2012/2/1/220
[2] btrfs: fix structs where bitfields and spinlock/atomic share 8B word (commit c08782dacd7a098f2b8bca7f4a57a5b402e9e1e5)

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux