Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310053
b: refs/heads/master
c: e41f941
h: refs/heads/master
i:
  310051: 80f4aa6
v: v3
  • Loading branch information
Josef Bacik authored and Al Viro committed Jun 1, 2012
1 parent 519dd75 commit fae7d78
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c3b2da314834499f34cba94f7053e55f6d6f92d8
refs/heads/master: e41f941a23115e84a8550b3d901a13a14b2edc2f
1 change: 0 additions & 1 deletion trunk/fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -2922,7 +2922,6 @@ int btrfs_readpage(struct file *file, struct page *page);
void btrfs_evict_inode(struct inode *inode);
int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc);
int btrfs_dirty_inode(struct inode *inode);
int btrfs_update_time(struct file *file);
struct inode *btrfs_alloc_inode(struct super_block *sb);
void btrfs_destroy_inode(struct inode *inode);
int btrfs_drop_inode(struct inode *inode);
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
goto out;
}

err = btrfs_update_time(file);
err = file_update_time(file);
if (err) {
mutex_unlock(&inode->i_mutex);
goto out;
Expand Down
53 changes: 14 additions & 39 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4431,46 +4431,18 @@ int btrfs_dirty_inode(struct inode *inode)
* This is a copy of file_update_time. We need this so we can return error on
* ENOSPC for updating the inode in the case of file write and mmap writes.
*/
int btrfs_update_time(struct file *file)
static int btrfs_update_time(struct inode *inode, struct timespec *now,
int flags)
{
struct inode *inode = file->f_path.dentry->d_inode;
struct timespec now;
int ret;
enum { S_MTIME = 1, S_CTIME = 2, S_VERSION = 4 } sync_it = 0;

/* First try to exhaust all avenues to not sync */
if (IS_NOCMTIME(inode))
return 0;

now = current_fs_time(inode->i_sb);
if (!timespec_equal(&inode->i_mtime, &now))
sync_it = S_MTIME;

if (!timespec_equal(&inode->i_ctime, &now))
sync_it |= S_CTIME;

if (IS_I_VERSION(inode))
sync_it |= S_VERSION;

if (!sync_it)
return 0;

/* Finally allowed to write? Takes lock. */
if (mnt_want_write_file(file))
return 0;

/* Only change inode inside the lock region */
if (sync_it & S_VERSION)
if (flags & S_VERSION)
inode_inc_iversion(inode);
if (sync_it & S_CTIME)
inode->i_ctime = now;
if (sync_it & S_MTIME)
inode->i_mtime = now;
ret = btrfs_dirty_inode(inode);
if (!ret)
mark_inode_dirty_sync(inode);
mnt_drop_write(file->f_path.mnt);
return ret;
if (flags & S_CTIME)
inode->i_ctime = *now;
if (flags & S_MTIME)
inode->i_mtime = *now;
if (flags & S_ATIME)
inode->i_atime = *now;
return btrfs_dirty_inode(inode);
}

/*
Expand Down Expand Up @@ -6576,7 +6548,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)

ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE);
if (!ret) {
ret = btrfs_update_time(vma->vm_file);
ret = file_update_time(vma->vm_file);
reserved = 1;
}
if (ret) {
Expand Down Expand Up @@ -7647,6 +7619,7 @@ static const struct inode_operations btrfs_file_inode_operations = {
.permission = btrfs_permission,
.fiemap = btrfs_fiemap,
.get_acl = btrfs_get_acl,
.update_time = btrfs_update_time,
};
static const struct inode_operations btrfs_special_inode_operations = {
.getattr = btrfs_getattr,
Expand All @@ -7657,6 +7630,7 @@ static const struct inode_operations btrfs_special_inode_operations = {
.listxattr = btrfs_listxattr,
.removexattr = btrfs_removexattr,
.get_acl = btrfs_get_acl,
.update_time = btrfs_update_time,
};
static const struct inode_operations btrfs_symlink_inode_operations = {
.readlink = generic_readlink,
Expand All @@ -7670,6 +7644,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = {
.listxattr = btrfs_listxattr,
.removexattr = btrfs_removexattr,
.get_acl = btrfs_get_acl,
.update_time = btrfs_update_time,
};

const struct dentry_operations btrfs_dentry_operations = {
Expand Down

0 comments on commit fae7d78

Please sign in to comment.