Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for fast write path append bug #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions Linux-5.1/fs/winefs/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Linux-5.1/fs/winefs/xip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down