Let's stay on the safe side away from gcc bugs and separate ints and bitfields with another access rules

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4127 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2012-02-13 22:35:52 +00:00
parent fab05915ad
commit c9b149c5ce
2 changed files with 15 additions and 4 deletions

View File

@@ -2276,8 +2276,13 @@ struct scst_device {
/**************************************************************/
/* How many cmds alive on this dev */
atomic_t dev_cmd_count;
/*
* How many cmds alive on this dev. Modified independently to the
* above fields, hence the alignment. Gcc reported to have
* a long standing bug, when it uses 64-bit memory accesses for
* int bit fields, so this alignment must be here to workaroud it.
*/
atomic_t dev_cmd_count __aligned(sizeof(long));
spinlock_t dev_lock; /* device lock */

View File

@@ -106,8 +106,12 @@ struct scst_user_cmd {
struct scst_cmd *cmd;
struct scst_user_dev *dev;
atomic_t ucmd_ref;
/*
* Note, gcc reported to have a long standing bug, when it uses 64-bit
* memory accesses for int bit fields, so, if any neighbor int field
* modified intependently to those bit fields, it must be 64-bit
* aligned to workaround this gcc bug!
*/
unsigned int buff_cached:1;
unsigned int buf_dirty:1;
unsigned int background_exec:1;
@@ -115,6 +119,8 @@ struct scst_user_cmd {
struct scst_user_cmd *buf_ucmd;
atomic_t ucmd_ref;
int cur_data_page;
int num_data_pages;
int first_page_offset;