aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-01-17 01:14:29 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-17 02:15:30 -0500
commit6383bdaa2ed2d461d9f4d369dfaa9d610fc972e3 (patch)
tree2bdbc25280c0666c2f2f5869c5487541fa670579
parent8bfc016d2e2fff71c6843257f0fd0b60876331ed (diff)
[PATCH] fuse: miscellaneous cleanup
- remove some unneeded assignments - use kzalloc instead of kmalloc + memset - simplify setting sb->s_fs_info - in fuse_send_init() use fuse_get_request() instead of do_get_request() helper Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/fuse/dev.c4
-rw-r--r--fs/fuse/fuse_i.h7
-rw-r--r--fs/fuse/inode.c10
3 files changed, 6 insertions, 15 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index d76432b757c9..4f1ca7b119ed 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -361,8 +361,8 @@ void request_send_background(struct fuse_conn *fc, struct fuse_req *req)
361void fuse_send_init(struct fuse_conn *fc) 361void fuse_send_init(struct fuse_conn *fc)
362{ 362{
363 /* This is called from fuse_read_super() so there's guaranteed 363 /* This is called from fuse_read_super() so there's guaranteed
364 to be a request available */ 364 to be exactly one request available */
365 struct fuse_req *req = do_get_request(fc); 365 struct fuse_req *req = fuse_get_request(fc);
366 struct fuse_init_in *arg = &req->misc.init_in; 366 struct fuse_init_in *arg = &req->misc.init_in;
367 arg->major = FUSE_KERNEL_VERSION; 367 arg->major = FUSE_KERNEL_VERSION;
368 arg->minor = FUSE_KERNEL_MINOR_VERSION; 368 arg->minor = FUSE_KERNEL_MINOR_VERSION;
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 74c8d098a14a..27937e8018eb 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -280,14 +280,9 @@ struct fuse_conn {
280 struct backing_dev_info bdi; 280 struct backing_dev_info bdi;
281}; 281};
282 282
283static inline struct fuse_conn **get_fuse_conn_super_p(struct super_block *sb)
284{
285 return (struct fuse_conn **) &sb->s_fs_info;
286}
287
288static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) 283static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
289{ 284{
290 return *get_fuse_conn_super_p(sb); 285 return sb->s_fs_info;
291} 286}
292 287
293static inline struct fuse_conn *get_fuse_conn(struct inode *inode) 288static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 04c80cc957a3..ceee75df7b32 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -200,9 +200,6 @@ static void fuse_put_super(struct super_block *sb)
200 200
201 spin_lock(&fuse_lock); 201 spin_lock(&fuse_lock);
202 fc->mounted = 0; 202 fc->mounted = 0;
203 fc->user_id = 0;
204 fc->group_id = 0;
205 fc->flags = 0;
206 /* Flush all readers on this fs */ 203 /* Flush all readers on this fs */
207 wake_up_all(&fc->waitq); 204 wake_up_all(&fc->waitq);
208 up_write(&fc->sbput_sem); 205 up_write(&fc->sbput_sem);
@@ -379,16 +376,15 @@ static struct fuse_conn *new_conn(void)
379{ 376{
380 struct fuse_conn *fc; 377 struct fuse_conn *fc;
381 378
382 fc = kmalloc(sizeof(*fc), GFP_KERNEL); 379 fc = kzalloc(sizeof(*fc), GFP_KERNEL);
383 if (fc != NULL) { 380 if (fc != NULL) {
384 int i; 381 int i;
385 memset(fc, 0, sizeof(*fc));
386 init_waitqueue_head(&fc->waitq); 382 init_waitqueue_head(&fc->waitq);
387 INIT_LIST_HEAD(&fc->pending); 383 INIT_LIST_HEAD(&fc->pending);
388 INIT_LIST_HEAD(&fc->processing); 384 INIT_LIST_HEAD(&fc->processing);
389 INIT_LIST_HEAD(&fc->unused_list); 385 INIT_LIST_HEAD(&fc->unused_list);
390 INIT_LIST_HEAD(&fc->background); 386 INIT_LIST_HEAD(&fc->background);
391 sema_init(&fc->outstanding_sem, 0); 387 sema_init(&fc->outstanding_sem, 1); /* One for INIT */
392 init_rwsem(&fc->sbput_sem); 388 init_rwsem(&fc->sbput_sem);
393 for (i = 0; i < FUSE_MAX_OUTSTANDING; i++) { 389 for (i = 0; i < FUSE_MAX_OUTSTANDING; i++) {
394 struct fuse_req *req = fuse_request_alloc(); 390 struct fuse_req *req = fuse_request_alloc();
@@ -420,7 +416,7 @@ static struct fuse_conn *get_conn(struct file *file, struct super_block *sb)
420 fc = ERR_PTR(-EINVAL); 416 fc = ERR_PTR(-EINVAL);
421 } else { 417 } else {
422 file->private_data = fc; 418 file->private_data = fc;
423 *get_fuse_conn_super_p(sb) = fc; 419 sb->s_fs_info = fc;
424 fc->mounted = 1; 420 fc->mounted = 1;
425 fc->connected = 1; 421 fc->connected = 1;
426 fc->count = 2; 422 fc->count = 2;