diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/fuse/inode.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'fs/fuse/inode.c')
-rw-r--r-- | fs/fuse/inode.c | 73 |
1 files changed, 36 insertions, 37 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index da9e6e11374c..38f84cd48b67 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -71,6 +71,11 @@ struct fuse_mount_data { | |||
71 | unsigned blksize; | 71 | unsigned blksize; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | struct fuse_forget_link *fuse_alloc_forget() | ||
75 | { | ||
76 | return kzalloc(sizeof(struct fuse_forget_link), GFP_KERNEL); | ||
77 | } | ||
78 | |||
74 | static struct inode *fuse_alloc_inode(struct super_block *sb) | 79 | static struct inode *fuse_alloc_inode(struct super_block *sb) |
75 | { | 80 | { |
76 | struct inode *inode; | 81 | struct inode *inode; |
@@ -90,8 +95,8 @@ static struct inode *fuse_alloc_inode(struct super_block *sb) | |||
90 | INIT_LIST_HEAD(&fi->queued_writes); | 95 | INIT_LIST_HEAD(&fi->queued_writes); |
91 | INIT_LIST_HEAD(&fi->writepages); | 96 | INIT_LIST_HEAD(&fi->writepages); |
92 | init_waitqueue_head(&fi->page_waitq); | 97 | init_waitqueue_head(&fi->page_waitq); |
93 | fi->forget_req = fuse_request_alloc(); | 98 | fi->forget = fuse_alloc_forget(); |
94 | if (!fi->forget_req) { | 99 | if (!fi->forget) { |
95 | kmem_cache_free(fuse_inode_cachep, inode); | 100 | kmem_cache_free(fuse_inode_cachep, inode); |
96 | return NULL; | 101 | return NULL; |
97 | } | 102 | } |
@@ -99,27 +104,20 @@ static struct inode *fuse_alloc_inode(struct super_block *sb) | |||
99 | return inode; | 104 | return inode; |
100 | } | 105 | } |
101 | 106 | ||
102 | static void fuse_destroy_inode(struct inode *inode) | 107 | static void fuse_i_callback(struct rcu_head *head) |
103 | { | 108 | { |
104 | struct fuse_inode *fi = get_fuse_inode(inode); | 109 | struct inode *inode = container_of(head, struct inode, i_rcu); |
105 | BUG_ON(!list_empty(&fi->write_files)); | 110 | INIT_LIST_HEAD(&inode->i_dentry); |
106 | BUG_ON(!list_empty(&fi->queued_writes)); | ||
107 | if (fi->forget_req) | ||
108 | fuse_request_free(fi->forget_req); | ||
109 | kmem_cache_free(fuse_inode_cachep, inode); | 111 | kmem_cache_free(fuse_inode_cachep, inode); |
110 | } | 112 | } |
111 | 113 | ||
112 | void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req, | 114 | static void fuse_destroy_inode(struct inode *inode) |
113 | u64 nodeid, u64 nlookup) | ||
114 | { | 115 | { |
115 | struct fuse_forget_in *inarg = &req->misc.forget_in; | 116 | struct fuse_inode *fi = get_fuse_inode(inode); |
116 | inarg->nlookup = nlookup; | 117 | BUG_ON(!list_empty(&fi->write_files)); |
117 | req->in.h.opcode = FUSE_FORGET; | 118 | BUG_ON(!list_empty(&fi->queued_writes)); |
118 | req->in.h.nodeid = nodeid; | 119 | kfree(fi->forget); |
119 | req->in.numargs = 1; | 120 | call_rcu(&inode->i_rcu, fuse_i_callback); |
120 | req->in.args[0].size = sizeof(struct fuse_forget_in); | ||
121 | req->in.args[0].value = inarg; | ||
122 | fuse_request_send_noreply(fc, req); | ||
123 | } | 121 | } |
124 | 122 | ||
125 | static void fuse_evict_inode(struct inode *inode) | 123 | static void fuse_evict_inode(struct inode *inode) |
@@ -129,8 +127,8 @@ static void fuse_evict_inode(struct inode *inode) | |||
129 | if (inode->i_sb->s_flags & MS_ACTIVE) { | 127 | if (inode->i_sb->s_flags & MS_ACTIVE) { |
130 | struct fuse_conn *fc = get_fuse_conn(inode); | 128 | struct fuse_conn *fc = get_fuse_conn(inode); |
131 | struct fuse_inode *fi = get_fuse_inode(inode); | 129 | struct fuse_inode *fi = get_fuse_inode(inode); |
132 | fuse_send_forget(fc, fi->forget_req, fi->nodeid, fi->nlookup); | 130 | fuse_queue_forget(fc, fi->forget, fi->nodeid, fi->nlookup); |
133 | fi->forget_req = NULL; | 131 | fi->forget = NULL; |
134 | } | 132 | } |
135 | } | 133 | } |
136 | 134 | ||
@@ -534,6 +532,7 @@ void fuse_conn_init(struct fuse_conn *fc) | |||
534 | INIT_LIST_HEAD(&fc->interrupts); | 532 | INIT_LIST_HEAD(&fc->interrupts); |
535 | INIT_LIST_HEAD(&fc->bg_queue); | 533 | INIT_LIST_HEAD(&fc->bg_queue); |
536 | INIT_LIST_HEAD(&fc->entry); | 534 | INIT_LIST_HEAD(&fc->entry); |
535 | fc->forget_list_tail = &fc->forget_list_head; | ||
537 | atomic_set(&fc->num_waiting, 0); | 536 | atomic_set(&fc->num_waiting, 0); |
538 | fc->max_background = FUSE_DEFAULT_MAX_BACKGROUND; | 537 | fc->max_background = FUSE_DEFAULT_MAX_BACKGROUND; |
539 | fc->congestion_threshold = FUSE_DEFAULT_CONGESTION_THRESHOLD; | 538 | fc->congestion_threshold = FUSE_DEFAULT_CONGESTION_THRESHOLD; |
@@ -618,10 +617,8 @@ static struct dentry *fuse_get_dentry(struct super_block *sb, | |||
618 | goto out_iput; | 617 | goto out_iput; |
619 | 618 | ||
620 | entry = d_obtain_alias(inode); | 619 | entry = d_obtain_alias(inode); |
621 | if (!IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID) { | 620 | if (!IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID) |
622 | entry->d_op = &fuse_dentry_operations; | ||
623 | fuse_invalidate_entry_cache(entry); | 621 | fuse_invalidate_entry_cache(entry); |
624 | } | ||
625 | 622 | ||
626 | return entry; | 623 | return entry; |
627 | 624 | ||
@@ -640,8 +637,10 @@ static int fuse_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, | |||
640 | u64 nodeid; | 637 | u64 nodeid; |
641 | u32 generation; | 638 | u32 generation; |
642 | 639 | ||
643 | if (*max_len < len) | 640 | if (*max_len < len) { |
641 | *max_len = len; | ||
644 | return 255; | 642 | return 255; |
643 | } | ||
645 | 644 | ||
646 | nodeid = get_fuse_inode(inode)->nodeid; | 645 | nodeid = get_fuse_inode(inode)->nodeid; |
647 | generation = inode->i_generation; | 646 | generation = inode->i_generation; |
@@ -720,10 +719,8 @@ static struct dentry *fuse_get_parent(struct dentry *child) | |||
720 | } | 719 | } |
721 | 720 | ||
722 | parent = d_obtain_alias(inode); | 721 | parent = d_obtain_alias(inode); |
723 | if (!IS_ERR(parent) && get_node_id(inode) != FUSE_ROOT_ID) { | 722 | if (!IS_ERR(parent) && get_node_id(inode) != FUSE_ROOT_ID) |
724 | parent->d_op = &fuse_dentry_operations; | ||
725 | fuse_invalidate_entry_cache(parent); | 723 | fuse_invalidate_entry_cache(parent); |
726 | } | ||
727 | 724 | ||
728 | return parent; | 725 | return parent; |
729 | } | 726 | } |
@@ -873,7 +870,6 @@ static int fuse_bdi_init(struct fuse_conn *fc, struct super_block *sb) | |||
873 | 870 | ||
874 | fc->bdi.name = "fuse"; | 871 | fc->bdi.name = "fuse"; |
875 | fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; | 872 | fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; |
876 | fc->bdi.unplug_io_fn = default_unplug_io_fn; | ||
877 | /* fuse does it's own writeback accounting */ | 873 | /* fuse does it's own writeback accounting */ |
878 | fc->bdi.capabilities = BDI_CAP_NO_ACCT_WB; | 874 | fc->bdi.capabilities = BDI_CAP_NO_ACCT_WB; |
879 | 875 | ||
@@ -925,6 +921,8 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
925 | if (sb->s_flags & MS_MANDLOCK) | 921 | if (sb->s_flags & MS_MANDLOCK) |
926 | goto err; | 922 | goto err; |
927 | 923 | ||
924 | sb->s_flags &= ~MS_NOSEC; | ||
925 | |||
928 | if (!parse_fuse_opt((char *) data, &d, is_bdev)) | 926 | if (!parse_fuse_opt((char *) data, &d, is_bdev)) |
929 | goto err; | 927 | goto err; |
930 | 928 | ||
@@ -990,6 +988,8 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
990 | iput(root); | 988 | iput(root); |
991 | goto err_put_conn; | 989 | goto err_put_conn; |
992 | } | 990 | } |
991 | /* only now - we want root dentry with NULL ->d_op */ | ||
992 | sb->s_d_op = &fuse_dentry_operations; | ||
993 | 993 | ||
994 | init_req = fuse_request_alloc(); | 994 | init_req = fuse_request_alloc(); |
995 | if (!init_req) | 995 | if (!init_req) |
@@ -1041,11 +1041,11 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
1041 | return err; | 1041 | return err; |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | static int fuse_get_sb(struct file_system_type *fs_type, | 1044 | static struct dentry *fuse_mount(struct file_system_type *fs_type, |
1045 | int flags, const char *dev_name, | 1045 | int flags, const char *dev_name, |
1046 | void *raw_data, struct vfsmount *mnt) | 1046 | void *raw_data) |
1047 | { | 1047 | { |
1048 | return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt); | 1048 | return mount_nodev(fs_type, flags, raw_data, fuse_fill_super); |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | static void fuse_kill_sb_anon(struct super_block *sb) | 1051 | static void fuse_kill_sb_anon(struct super_block *sb) |
@@ -1065,17 +1065,16 @@ static struct file_system_type fuse_fs_type = { | |||
1065 | .owner = THIS_MODULE, | 1065 | .owner = THIS_MODULE, |
1066 | .name = "fuse", | 1066 | .name = "fuse", |
1067 | .fs_flags = FS_HAS_SUBTYPE, | 1067 | .fs_flags = FS_HAS_SUBTYPE, |
1068 | .get_sb = fuse_get_sb, | 1068 | .mount = fuse_mount, |
1069 | .kill_sb = fuse_kill_sb_anon, | 1069 | .kill_sb = fuse_kill_sb_anon, |
1070 | }; | 1070 | }; |
1071 | 1071 | ||
1072 | #ifdef CONFIG_BLOCK | 1072 | #ifdef CONFIG_BLOCK |
1073 | static int fuse_get_sb_blk(struct file_system_type *fs_type, | 1073 | static struct dentry *fuse_mount_blk(struct file_system_type *fs_type, |
1074 | int flags, const char *dev_name, | 1074 | int flags, const char *dev_name, |
1075 | void *raw_data, struct vfsmount *mnt) | 1075 | void *raw_data) |
1076 | { | 1076 | { |
1077 | return get_sb_bdev(fs_type, flags, dev_name, raw_data, fuse_fill_super, | 1077 | return mount_bdev(fs_type, flags, dev_name, raw_data, fuse_fill_super); |
1078 | mnt); | ||
1079 | } | 1078 | } |
1080 | 1079 | ||
1081 | static void fuse_kill_sb_blk(struct super_block *sb) | 1080 | static void fuse_kill_sb_blk(struct super_block *sb) |
@@ -1094,7 +1093,7 @@ static void fuse_kill_sb_blk(struct super_block *sb) | |||
1094 | static struct file_system_type fuseblk_fs_type = { | 1093 | static struct file_system_type fuseblk_fs_type = { |
1095 | .owner = THIS_MODULE, | 1094 | .owner = THIS_MODULE, |
1096 | .name = "fuseblk", | 1095 | .name = "fuseblk", |
1097 | .get_sb = fuse_get_sb_blk, | 1096 | .mount = fuse_mount_blk, |
1098 | .kill_sb = fuse_kill_sb_blk, | 1097 | .kill_sb = fuse_kill_sb_blk, |
1099 | .fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE, | 1098 | .fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE, |
1100 | }; | 1099 | }; |