diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-01 13:34:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-01 13:34:35 -0400 |
commit | 1193755ac6328ad240ba987e6ec41d5e8baf0680 (patch) | |
tree | 40bf847d7e3ebaa57b107151d14e6cd1d280cc6d /fs/btrfs | |
parent | 4edebed86690eb8db9af3ab85baf4a34e73266cc (diff) | |
parent | 0ef97dcfce4179a2eba046b855ee2f91d6f1b414 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs changes from Al Viro.
"A lot of misc stuff. The obvious groups:
* Miklos' atomic_open series; kills the damn abuse of
->d_revalidate() by NFS, which was the major stumbling block for
all work in that area.
* ripping security_file_mmap() and dealing with deadlocks in the
area; sanitizing the neighborhood of vm_mmap()/vm_munmap() in
general.
* ->encode_fh() switched to saner API; insane fake dentry in
mm/cleancache.c gone.
* assorted annotations in fs (endianness, __user)
* parts of Artem's ->s_dirty work (jff2 and reiserfs parts)
* ->update_time() work from Josef.
* other bits and pieces all over the place.
Normally it would've been in two or three pull requests, but
signal.git stuff had eaten a lot of time during this cycle ;-/"
Fix up trivial conflicts in Documentation/filesystems/vfs.txt (the
'truncate_range' inode method was removed by the VM changes, the VFS
update adds an 'update_time()' method), and in fs/btrfs/ulist.[ch] (due
to sparse fix added twice, with other changes nearby).
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (95 commits)
nfs: don't open in ->d_revalidate
vfs: retry last component if opening stale dentry
vfs: nameidata_to_filp(): don't throw away file on error
vfs: nameidata_to_filp(): inline __dentry_open()
vfs: do_dentry_open(): don't put filp
vfs: split __dentry_open()
vfs: do_last() common post lookup
vfs: do_last(): add audit_inode before open
vfs: do_last(): only return EISDIR for O_CREAT
vfs: do_last(): check LOOKUP_DIRECTORY
vfs: do_last(): make ENOENT exit RCU safe
vfs: make follow_link check RCU safe
vfs: do_last(): use inode variable
vfs: do_last(): inline walk_component()
vfs: do_last(): make exit RCU safe
vfs: split do_lookup()
Btrfs: move over to use ->update_time
fs: introduce inode operation ->update_time
reiserfs: get rid of resierfs_sync_super
reiserfs: mark the superblock as dirty a bit later
...
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
-rw-r--r-- | fs/btrfs/export.c | 15 | ||||
-rw-r--r-- | fs/btrfs/file.c | 2 | ||||
-rw-r--r-- | fs/btrfs/free-space-cache.c | 7 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 53 |
5 files changed, 23 insertions, 55 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0151ca1ac657..0236d03c6732 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2974,7 +2974,6 @@ int btrfs_readpage(struct file *file, struct page *page); | |||
2974 | void btrfs_evict_inode(struct inode *inode); | 2974 | void btrfs_evict_inode(struct inode *inode); |
2975 | int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); | 2975 | int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); |
2976 | int btrfs_dirty_inode(struct inode *inode); | 2976 | int btrfs_dirty_inode(struct inode *inode); |
2977 | int btrfs_update_time(struct file *file); | ||
2978 | struct inode *btrfs_alloc_inode(struct super_block *sb); | 2977 | struct inode *btrfs_alloc_inode(struct super_block *sb); |
2979 | void btrfs_destroy_inode(struct inode *inode); | 2978 | void btrfs_destroy_inode(struct inode *inode); |
2980 | int btrfs_drop_inode(struct inode *inode); | 2979 | int btrfs_drop_inode(struct inode *inode); |
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index e887ee62b6d4..614f34a899c2 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c | |||
@@ -13,15 +13,14 @@ | |||
13 | parent_root_objectid) / 4) | 13 | parent_root_objectid) / 4) |
14 | #define BTRFS_FID_SIZE_CONNECTABLE_ROOT (sizeof(struct btrfs_fid) / 4) | 14 | #define BTRFS_FID_SIZE_CONNECTABLE_ROOT (sizeof(struct btrfs_fid) / 4) |
15 | 15 | ||
16 | static int btrfs_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, | 16 | static int btrfs_encode_fh(struct inode *inode, u32 *fh, int *max_len, |
17 | int connectable) | 17 | struct inode *parent) |
18 | { | 18 | { |
19 | struct btrfs_fid *fid = (struct btrfs_fid *)fh; | 19 | struct btrfs_fid *fid = (struct btrfs_fid *)fh; |
20 | struct inode *inode = dentry->d_inode; | ||
21 | int len = *max_len; | 20 | int len = *max_len; |
22 | int type; | 21 | int type; |
23 | 22 | ||
24 | if (connectable && (len < BTRFS_FID_SIZE_CONNECTABLE)) { | 23 | if (parent && (len < BTRFS_FID_SIZE_CONNECTABLE)) { |
25 | *max_len = BTRFS_FID_SIZE_CONNECTABLE; | 24 | *max_len = BTRFS_FID_SIZE_CONNECTABLE; |
26 | return 255; | 25 | return 255; |
27 | } else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) { | 26 | } else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) { |
@@ -36,19 +35,13 @@ static int btrfs_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, | |||
36 | fid->root_objectid = BTRFS_I(inode)->root->objectid; | 35 | fid->root_objectid = BTRFS_I(inode)->root->objectid; |
37 | fid->gen = inode->i_generation; | 36 | fid->gen = inode->i_generation; |
38 | 37 | ||
39 | if (connectable && !S_ISDIR(inode->i_mode)) { | 38 | if (parent) { |
40 | struct inode *parent; | ||
41 | u64 parent_root_id; | 39 | u64 parent_root_id; |
42 | 40 | ||
43 | spin_lock(&dentry->d_lock); | ||
44 | |||
45 | parent = dentry->d_parent->d_inode; | ||
46 | fid->parent_objectid = BTRFS_I(parent)->location.objectid; | 41 | fid->parent_objectid = BTRFS_I(parent)->location.objectid; |
47 | fid->parent_gen = parent->i_generation; | 42 | fid->parent_gen = parent->i_generation; |
48 | parent_root_id = BTRFS_I(parent)->root->objectid; | 43 | parent_root_id = BTRFS_I(parent)->root->objectid; |
49 | 44 | ||
50 | spin_unlock(&dentry->d_lock); | ||
51 | |||
52 | if (parent_root_id != fid->root_objectid) { | 45 | if (parent_root_id != fid->root_objectid) { |
53 | fid->parent_root_objectid = parent_root_id; | 46 | fid->parent_root_objectid = parent_root_id; |
54 | len = BTRFS_FID_SIZE_CONNECTABLE_ROOT; | 47 | len = BTRFS_FID_SIZE_CONNECTABLE_ROOT; |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 876cddd6b2f0..70dc8ca73e25 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1433,7 +1433,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1433 | goto out; | 1433 | goto out; |
1434 | } | 1434 | } |
1435 | 1435 | ||
1436 | err = btrfs_update_time(file); | 1436 | err = file_update_time(file); |
1437 | if (err) { | 1437 | if (err) { |
1438 | mutex_unlock(&inode->i_mutex); | 1438 | mutex_unlock(&inode->i_mutex); |
1439 | goto out; | 1439 | goto out; |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 19a0d85b451c..81296c57405a 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -77,7 +77,8 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root, | |||
77 | return ERR_PTR(-ENOENT); | 77 | return ERR_PTR(-ENOENT); |
78 | } | 78 | } |
79 | 79 | ||
80 | inode->i_mapping->flags &= ~__GFP_FS; | 80 | mapping_set_gfp_mask(inode->i_mapping, |
81 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); | ||
81 | 82 | ||
82 | return inode; | 83 | return inode; |
83 | } | 84 | } |
@@ -367,7 +368,7 @@ static int io_ctl_prepare_pages(struct io_ctl *io_ctl, struct inode *inode, | |||
367 | 368 | ||
368 | static void io_ctl_set_generation(struct io_ctl *io_ctl, u64 generation) | 369 | static void io_ctl_set_generation(struct io_ctl *io_ctl, u64 generation) |
369 | { | 370 | { |
370 | u64 *val; | 371 | __le64 *val; |
371 | 372 | ||
372 | io_ctl_map_page(io_ctl, 1); | 373 | io_ctl_map_page(io_ctl, 1); |
373 | 374 | ||
@@ -390,7 +391,7 @@ static void io_ctl_set_generation(struct io_ctl *io_ctl, u64 generation) | |||
390 | 391 | ||
391 | static int io_ctl_check_generation(struct io_ctl *io_ctl, u64 generation) | 392 | static int io_ctl_check_generation(struct io_ctl *io_ctl, u64 generation) |
392 | { | 393 | { |
393 | u64 *gen; | 394 | __le64 *gen; |
394 | 395 | ||
395 | /* | 396 | /* |
396 | * Skip the crc area. If we don't check crcs then we just have a 64bit | 397 | * Skip the crc area. If we don't check crcs then we just have a 64bit |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e9991adc0960..f6ab6f5e635a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4475,46 +4475,18 @@ int btrfs_dirty_inode(struct inode *inode) | |||
4475 | * This is a copy of file_update_time. We need this so we can return error on | 4475 | * This is a copy of file_update_time. We need this so we can return error on |
4476 | * ENOSPC for updating the inode in the case of file write and mmap writes. | 4476 | * ENOSPC for updating the inode in the case of file write and mmap writes. |
4477 | */ | 4477 | */ |
4478 | int btrfs_update_time(struct file *file) | 4478 | static int btrfs_update_time(struct inode *inode, struct timespec *now, |
4479 | int flags) | ||
4479 | { | 4480 | { |
4480 | struct inode *inode = file->f_path.dentry->d_inode; | 4481 | if (flags & S_VERSION) |
4481 | struct timespec now; | ||
4482 | int ret; | ||
4483 | enum { S_MTIME = 1, S_CTIME = 2, S_VERSION = 4 } sync_it = 0; | ||
4484 | |||
4485 | /* First try to exhaust all avenues to not sync */ | ||
4486 | if (IS_NOCMTIME(inode)) | ||
4487 | return 0; | ||
4488 | |||
4489 | now = current_fs_time(inode->i_sb); | ||
4490 | if (!timespec_equal(&inode->i_mtime, &now)) | ||
4491 | sync_it = S_MTIME; | ||
4492 | |||
4493 | if (!timespec_equal(&inode->i_ctime, &now)) | ||
4494 | sync_it |= S_CTIME; | ||
4495 | |||
4496 | if (IS_I_VERSION(inode)) | ||
4497 | sync_it |= S_VERSION; | ||
4498 | |||
4499 | if (!sync_it) | ||
4500 | return 0; | ||
4501 | |||
4502 | /* Finally allowed to write? Takes lock. */ | ||
4503 | if (mnt_want_write_file(file)) | ||
4504 | return 0; | ||
4505 | |||
4506 | /* Only change inode inside the lock region */ | ||
4507 | if (sync_it & S_VERSION) | ||
4508 | inode_inc_iversion(inode); | 4482 | inode_inc_iversion(inode); |
4509 | if (sync_it & S_CTIME) | 4483 | if (flags & S_CTIME) |
4510 | inode->i_ctime = now; | 4484 | inode->i_ctime = *now; |
4511 | if (sync_it & S_MTIME) | 4485 | if (flags & S_MTIME) |
4512 | inode->i_mtime = now; | 4486 | inode->i_mtime = *now; |
4513 | ret = btrfs_dirty_inode(inode); | 4487 | if (flags & S_ATIME) |
4514 | if (!ret) | 4488 | inode->i_atime = *now; |
4515 | mark_inode_dirty_sync(inode); | 4489 | return btrfs_dirty_inode(inode); |
4516 | mnt_drop_write(file->f_path.mnt); | ||
4517 | return ret; | ||
4518 | } | 4490 | } |
4519 | 4491 | ||
4520 | /* | 4492 | /* |
@@ -6565,7 +6537,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
6565 | 6537 | ||
6566 | ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE); | 6538 | ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE); |
6567 | if (!ret) { | 6539 | if (!ret) { |
6568 | ret = btrfs_update_time(vma->vm_file); | 6540 | ret = file_update_time(vma->vm_file); |
6569 | reserved = 1; | 6541 | reserved = 1; |
6570 | } | 6542 | } |
6571 | if (ret) { | 6543 | if (ret) { |
@@ -7635,6 +7607,7 @@ static const struct inode_operations btrfs_file_inode_operations = { | |||
7635 | .permission = btrfs_permission, | 7607 | .permission = btrfs_permission, |
7636 | .fiemap = btrfs_fiemap, | 7608 | .fiemap = btrfs_fiemap, |
7637 | .get_acl = btrfs_get_acl, | 7609 | .get_acl = btrfs_get_acl, |
7610 | .update_time = btrfs_update_time, | ||
7638 | }; | 7611 | }; |
7639 | static const struct inode_operations btrfs_special_inode_operations = { | 7612 | static const struct inode_operations btrfs_special_inode_operations = { |
7640 | .getattr = btrfs_getattr, | 7613 | .getattr = btrfs_getattr, |
@@ -7645,6 +7618,7 @@ static const struct inode_operations btrfs_special_inode_operations = { | |||
7645 | .listxattr = btrfs_listxattr, | 7618 | .listxattr = btrfs_listxattr, |
7646 | .removexattr = btrfs_removexattr, | 7619 | .removexattr = btrfs_removexattr, |
7647 | .get_acl = btrfs_get_acl, | 7620 | .get_acl = btrfs_get_acl, |
7621 | .update_time = btrfs_update_time, | ||
7648 | }; | 7622 | }; |
7649 | static const struct inode_operations btrfs_symlink_inode_operations = { | 7623 | static const struct inode_operations btrfs_symlink_inode_operations = { |
7650 | .readlink = generic_readlink, | 7624 | .readlink = generic_readlink, |
@@ -7658,6 +7632,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = { | |||
7658 | .listxattr = btrfs_listxattr, | 7632 | .listxattr = btrfs_listxattr, |
7659 | .removexattr = btrfs_removexattr, | 7633 | .removexattr = btrfs_removexattr, |
7660 | .get_acl = btrfs_get_acl, | 7634 | .get_acl = btrfs_get_acl, |
7635 | .update_time = btrfs_update_time, | ||
7661 | }; | 7636 | }; |
7662 | 7637 | ||
7663 | const struct dentry_operations btrfs_dentry_operations = { | 7638 | const struct dentry_operations btrfs_dentry_operations = { |