diff --git a/Linux-5.1/fs/winefs/inode.h b/Linux-5.1/fs/winefs/inode.h index 5c76f6089..6835047bf 100644 --- a/Linux-5.1/fs/winefs/inode.h +++ b/Linux-5.1/fs/winefs/inode.h @@ -343,17 +343,15 @@ static inline void check_eof_blocks(struct super_block *sb, static inline void pmfs_update_time_and_size(struct inode *inode, struct pmfs_inode *pi) { - __le32 words[2]; + __le64 words; __le64 new_pi_size = cpu_to_le64(i_size_read(inode)); - /* pi->i_size, pi->i_ctime, and pi->i_mtime need to be atomically updated. - * So use cmpxchg16b here. */ - words[0] = cpu_to_le32(inode->i_ctime.tv_sec); - words[1] = cpu_to_le32(inode->i_mtime.tv_sec); - /* TODO: the following function assumes cmpxchg16b instruction writes - * 16 bytes atomically. Confirm if it is really true. */ - cmpxchg_double_local(&pi->i_size, (u64 *)&pi->i_ctime, pi->i_size, - *(u64 *)&pi->i_ctime, new_pi_size, *(u64 *)words); + words = cpu_to_le32(inode->i_mtime.tv_sec); + words <<= 32; + words |= cpu_to_le32(inode->i_ctime.tv_sec); + volatile __le64* target = (__le64*) &pi->i_ctime; + *target = words; + ((volatile struct pmfs_inode*)pi)->i_size = new_pi_size; } int pmfs_init_inode_inuse_list(struct super_block *sb); diff --git a/Linux-5.1/fs/winefs/xip.c b/Linux-5.1/fs/winefs/xip.c index 6ad3f4c4a..841925fcd 100644 --- a/Linux-5.1/fs/winefs/xip.c +++ b/Linux-5.1/fs/winefs/xip.c @@ -715,7 +715,7 @@ ssize_t pmfs_xip_file_write(struct file *filp, const char __user *buf, start_blk = pos >> sb->s_blocksize_bits; end_blk = start_blk + num_blocks - 1; - if (!(strong_guarantees && pos < i_size_read(inode))) { + if (!strong_guarantees) { num_blocks_found = pmfs_find_data_blocks(inode, start_blk, &block, 1); /* Referring to the inode's block size, not 4K */