linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 06/17] fuse: miscellaneous cleanup
Date: Sat, 14 Jan 2006 01:39:54 +0100	[thread overview]
Message-ID: <20060114004048.517453000@dorka.pomaz.szeredi.hu> (raw)
In-Reply-To: 20060114003948.793910000@dorka.pomaz.szeredi.hu

[-- Attachment #1: fuse_cleanup.patch --]
[-- Type: text/plain, Size: 2984 bytes --]

 - 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>

Index: linux/fs/fuse/inode.c
===================================================================
--- linux.orig/fs/fuse/inode.c	2006-01-13 23:12:58.000000000 +0100
+++ linux/fs/fuse/inode.c	2006-01-13 23:40:48.000000000 +0100
@@ -200,9 +200,6 @@ static void fuse_put_super(struct super_
 
 	spin_lock(&fuse_lock);
 	fc->mounted = 0;
-	fc->user_id = 0;
-	fc->group_id = 0;
-	fc->flags = 0;
 	/* Flush all readers on this fs */
 	wake_up_all(&fc->waitq);
 	up_write(&fc->sbput_sem);
@@ -379,16 +376,15 @@ static struct fuse_conn *new_conn(void)
 {
 	struct fuse_conn *fc;
 
-	fc = kmalloc(sizeof(*fc), GFP_KERNEL);
+	fc = kzalloc(sizeof(*fc), GFP_KERNEL);
 	if (fc != NULL) {
 		int i;
-		memset(fc, 0, sizeof(*fc));
 		init_waitqueue_head(&fc->waitq);
 		INIT_LIST_HEAD(&fc->pending);
 		INIT_LIST_HEAD(&fc->processing);
 		INIT_LIST_HEAD(&fc->unused_list);
 		INIT_LIST_HEAD(&fc->background);
-		sema_init(&fc->outstanding_sem, 0);
+		sema_init(&fc->outstanding_sem, 1); /* One for INIT */
 		init_rwsem(&fc->sbput_sem);
 		for (i = 0; i < FUSE_MAX_OUTSTANDING; i++) {
 			struct fuse_req *req = fuse_request_alloc();
@@ -420,7 +416,7 @@ static struct fuse_conn *get_conn(struct
 		fc = ERR_PTR(-EINVAL);
 	} else {
 		file->private_data = fc;
-		*get_fuse_conn_super_p(sb) = fc;
+		sb->s_fs_info = fc;
 		fc->mounted = 1;
 		fc->connected = 1;
 		fc->count = 2;
Index: linux/fs/fuse/fuse_i.h
===================================================================
--- linux.orig/fs/fuse/fuse_i.h	2006-01-13 23:12:57.000000000 +0100
+++ linux/fs/fuse/fuse_i.h	2006-01-13 23:40:18.000000000 +0100
@@ -280,14 +280,9 @@ struct fuse_conn {
 	struct backing_dev_info bdi;
 };
 
-static inline struct fuse_conn **get_fuse_conn_super_p(struct super_block *sb)
-{
-	return (struct fuse_conn **) &sb->s_fs_info;
-}
-
 static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
 {
-	return *get_fuse_conn_super_p(sb);
+	return (struct fuse_conn *) sb->s_fs_info;
 }
 
 static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
Index: linux/fs/fuse/dev.c
===================================================================
--- linux.orig/fs/fuse/dev.c	2006-01-13 23:40:09.000000000 +0100
+++ linux/fs/fuse/dev.c	2006-01-13 23:40:18.000000000 +0100
@@ -361,8 +361,8 @@ void request_send_background(struct fuse
 void fuse_send_init(struct fuse_conn *fc)
 {
 	/* This is called from fuse_read_super() so there's guaranteed
-	   to be a request available */
-	struct fuse_req *req = do_get_request(fc);
+	   to be exactly one request available */
+	struct fuse_req *req = fuse_get_request(fc);
 	struct fuse_init_in *arg = &req->misc.init_in;
 	arg->major = FUSE_KERNEL_VERSION;
 	arg->minor = FUSE_KERNEL_MINOR_VERSION;

--

  parent reply	other threads:[~2006-01-14  0:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-14  0:39 [PATCH 00/17] fuse: fixes, cleanups and asynchronous read requests Miklos Szeredi
2006-01-14  0:39 ` [PATCH 01/17] add /sys/fs Miklos Szeredi
2006-01-17 12:47   ` Christoph Hellwig
2006-01-17 12:52     ` Miklos Szeredi
2006-01-14  0:39 ` [PATCH 02/17] fuse: fuse_copy_finish() order fix Miklos Szeredi
2006-01-14  0:39 ` [PATCH 03/17] fuse: fix request_end() Miklos Szeredi
2006-01-14  0:39 ` [PATCH 04/17] fuse: handle error INIT reply Miklos Szeredi
2006-01-14  0:39 ` [PATCH 05/17] fuse: uninline some functions Miklos Szeredi
2006-01-14  0:39 ` Miklos Szeredi [this message]
2006-01-14  0:39 ` [PATCH 07/17] fuse: introduce unified request state Miklos Szeredi
2006-01-14  0:39 ` [PATCH 08/17] fuse: introduce list for requests under I/O Miklos Szeredi
2006-01-14  0:39 ` [PATCH 09/17] fuse: extend semantics of connected flag Miklos Szeredi
2006-01-14  0:39 ` [PATCH 10/17] fuse: make fuse connection a kobject Miklos Szeredi
2006-01-14  0:39 ` [PATCH 11/17] fuse: add number of waiting requests attribute Miklos Szeredi
2006-01-14  1:28   ` Andrew Morton
2006-01-14  9:44     ` Miklos Szeredi
2006-01-14  9:53       ` Andrew Morton
2006-01-18  5:56     ` Eric Dumazet
2006-01-14  0:40 ` [PATCH 12/17] fuse: add connection aborting Miklos Szeredi
2006-01-14  1:31   ` Andrew Morton
2006-01-14  9:50     ` Miklos Szeredi
2006-01-14  0:40 ` [PATCH 13/17] fuse: add asynchronous request support Miklos Szeredi
2006-01-14  0:40 ` [PATCH 14/17] fuse: move INIT handling to inode.c Miklos Szeredi
2006-01-14  0:40 ` [PATCH 15/17] fuse: READ request initialization Miklos Szeredi
2006-01-14  0:40 ` [PATCH 16/17] fuse: use asynchronous READ requests for readpages Miklos Szeredi
2006-01-14  0:40 ` [PATCH 17/17] fuse: update documentation for sysfs Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060114004048.517453000@dorka.pomaz.szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).