public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Bird <tim.bird@am.sony.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	linux-kernel@vger.kernel.org, linux-embedded@vger.kernel.org,
	michael@free-electrons.com, Matt Mackall <mpm@selenic.com>,
	matthew@wil.cx, linux-fsdevel@vger.kernel.org,
	akpm@linux-foundation.org
Subject: Re: [patch 2/4] Configure out file locking features
Date: Mon, 4 Aug 2008 15:32:27 -0700	[thread overview]
Message-ID: <4897837B.3070605@am.sony.com> (raw)
In-Reply-To: <20080804182532.GF25940@fieldses.org>

J. Bruce Fields wrote:
> On Mon, Aug 04, 2008 at 11:24:51AM -0700, Tim Bird wrote:
>> J. Bruce Fields wrote:
>>> On Mon, Aug 04, 2008 at 03:52:37PM +0200, Thomas Petazzoni wrote:
>>>> Le Sat, 2 Aug 2008 12:38:48 -0400,
>>>> "J. Bruce Fields" <bfields@fieldses.org> a écrit :
>>>>
>>>>> Out of curiosity, why does the nfs client need disabling, but not
>>>>> nfsd, gfs2, fuse, etc.?
>>>> Then also need disabling.
>>> OK by me, but again, why exactly?  Since you're replacing the locking
>>> calls they used by stubs that just return errors, in theory nfs, nfsd,
>>> gfs2, and the rest should still compile and run, just without locking
>>> support, right?
>> I think so, but haven't tested this myself.
>>
>> However, I would still be inclined to NOT add the extra config
>> dependencies.  Just my 2 cents.
> 
> OK.  My fear was that there was some good reason that the nfs dependency
> was added in the first place, and that it's since been lost....

For general information,  I just ran a test with the NFS dependency
on file locking turned off, and with the NFS auto-enable of
CONFIG_LOCKD removed.

It got me about a 16K savings, and I was able to successfully boot
a target with an NFS-mounted root file system.  I haven't run extensive
tests, so I don't know what apps might break in this configuration,
but at least in this test, it ran well enough to boot the machine.

Below is the patch I used, which is only provided for information.
This should NOT be applied - it consists of quick hacks to test this
configuration only (that is, to test NFS with CONFIG_FILE_LOCKING=n).

BTW - this is on a 2.6.23 kernel, so even the regular FILE_LOCKING
bits may be different from the current no-file-locking patch.

---
 fs/Kconfig         |    3 +--
 fs/nfs/client.c    |    6 ++++++
 fs/nfs/nfs3proc.c  |    4 ++++
 fs/nfs/proc.c      |    4 ++++
 fs/read_write.c    |    2 ++
 include/linux/fs.h |   13 +++++++------
 6 files changed, 24 insertions(+), 8 deletions(-)

--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1701,8 +1701,7 @@ menu "Network File Systems"

 config NFS_FS
 	tristate "NFS file system support"
-	depends on INET && FILE_LOCKING
-	select LOCKD
+	depends on INET
 	select SUNRPC
 	select NFS_ACL_SUPPORT if NFS_V3_ACL
 	help
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -414,6 +414,7 @@ static void nfs_destroy_server(struct nf
 		lockd_down();	/* release rpc.lockd */
 }

+#ifdef LOCKD
 /*
  * Version 2 or 3 lockd setup
  */
@@ -434,6 +435,7 @@ static int nfs_start_lockd(struct nfs_se
 out:
 	return error;
 }
+#endif

 /*
  * Initialise an NFSv3 ACL client connection
@@ -577,9 +579,11 @@ static int nfs_init_server(struct nfs_se
 	server->acdirmax = data->acdirmax * HZ;

 	/* Start lockd here, before we might error out */
+#ifdef LOCKD
 	error = nfs_start_lockd(server);
 	if (error < 0)
 		goto error;
+#endif

 	error = nfs_init_server_rpcclient(server, data->pseudoflavor);
 	if (error < 0)
@@ -1128,9 +1132,11 @@ struct nfs_server *nfs_clone_server(stru
 		(unsigned long long) server->fsid.major,
 		(unsigned long long) server->fsid.minor);

+#ifdef LOCKD
 	error = nfs_start_lockd(server);
 	if (error < 0)
 		goto out_free_server;
+#endif

 	spin_lock(&nfs_client_lock);
 	list_add_tail(&server->client_link, &server->nfs_client->cl_superblocks);
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -795,7 +795,11 @@ static void nfs3_proc_commit_setup(struc
 static int
 nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
 {
+#ifdef LOCKD
 	return nlmclnt_proc(filp->f_path.dentry->d_inode, cmd, fl);
+#else
+	return -ENOLCK;
+#endif
 }

 const struct nfs_rpc_ops nfs_v3_clientops = {
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -605,7 +605,11 @@ nfs_proc_commit_setup(struct nfs_write_d
 static int
 nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
 {
+#ifdef LOCKD
 	return nlmclnt_proc(filp->f_path.dentry->d_inode, cmd, fl);
+#else
+	return -ENOLCK;
+#endif
 }


--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -211,6 +211,7 @@ int rw_verify_area(int read_write, struc
 	if (unlikely((pos < 0) || (loff_t) (pos + count) < 0))
 		goto Einval;

+#ifdef FILE_LOCKING
 	if (unlikely(inode->i_flock && MANDATORY_LOCK(inode))) {
 		int retval = locks_mandatory_area(
 			read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE,
@@ -218,6 +219,7 @@ int rw_verify_area(int read_write, struc
 		if (retval < 0)
 			return retval;
 	}
+#endif
 	return count > MAX_RW_COUNT ? MAX_RW_COUNT : count;

 Einval:
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -863,10 +863,6 @@ extern int fcntl_setlk64(unsigned int, s
 extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
 extern int fcntl_getlease(struct file *filp);

-/* fs/sync.c */
-extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
-			loff_t endbyte, unsigned int flags);
-
 /* fs/locks.c */
 extern void locks_init_lock(struct file_lock *);
 extern void locks_copy_lock(struct file_lock *, struct file_lock *);
@@ -918,6 +914,10 @@ extern int lock_may_write(struct inode *
 #define steal_locks(a)
 #endif /* !CONFIG_FILE_LOCKING */

+/* fs/sync.c */
+extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
+			loff_t endbyte, unsigned int flags);
+
 struct fasync_struct {
 	int	magic;
 	int	fa_fd;
@@ -1424,8 +1424,6 @@ static inline int locks_verify_locked(st
 	return 0;
 }

-extern int rw_verify_area(int, struct file *, loff_t *, size_t);
-
 static inline int locks_verify_truncate(struct inode *inode,
 				    struct file *filp,
 				    loff_t size)
@@ -1459,6 +1457,9 @@ static inline int break_lease(struct ino

 #endif /* !CONFIG_FILE_LOCKING */

+extern int rw_verify_area(int, struct file *, loff_t *, size_t);
+
+
 /* fs/open.c */

 extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,



=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Corporation of America
=============================


  parent reply	other threads:[~2008-08-04 22:30 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-31  9:27 [patch 0/4] [resend] Add configuration options to disable features not needed on embedded devices Thomas Petazzoni
2008-07-31  9:27 ` [patch 1/4] Configure out AIO support Thomas Petazzoni
2008-07-31 10:09   ` Bernhard Fischer
2008-07-31 10:12     ` Adrian Bunk
2008-07-31 22:42       ` Bernhard Fischer
2008-08-05 18:15         ` Adrian Bunk
2008-08-05 18:26           ` Jamie Lokier
2008-08-05 18:36             ` Bernhard Fischer
2008-07-31  9:27 ` [patch 2/4] Configure out file locking features Thomas Petazzoni
2008-07-31 13:53   ` Adrian Bunk
2008-07-31 14:20     ` Thomas Petazzoni
2008-07-31 15:37       ` Adrian Bunk
2008-07-31 16:26         ` Thomas Petazzoni
2008-07-31 16:49           ` Adrian Bunk
2008-07-31 16:57             ` David Woodhouse
2008-07-31 17:32             ` Tim Bird
2008-07-31 18:12               ` Robert Schwebel
2008-07-31 19:31                 ` Adrian Bunk
2008-08-01  7:28                   ` Robert Schwebel
2008-07-31 19:16               ` Adrian Bunk
2008-07-31 20:37                 ` Tim Bird
2008-08-02 16:38   ` J. Bruce Fields
2008-08-04 13:52     ` Thomas Petazzoni
2008-08-04 18:16       ` J. Bruce Fields
2008-08-04 18:24         ` Tim Bird
2008-08-04 18:25           ` J. Bruce Fields
2008-08-04 18:54             ` Matt Mackall
2008-08-04 19:42               ` J. Bruce Fields
2008-08-04 22:32             ` Tim Bird [this message]
2008-08-06 13:12         ` Thomas Petazzoni
2008-08-07 22:55           ` J. Bruce Fields
2008-07-31  9:27 ` [patch 3/4] Configure out ethtool support Thomas Petazzoni
2008-07-31 10:40   ` Ben Hutchings
2008-07-31 10:49     ` David Miller
2008-07-31 10:54       ` David Woodhouse
2008-07-31 10:57         ` David Miller
2008-07-31 10:42   ` David Woodhouse
2008-07-31 10:51     ` David Miller
2008-07-31 11:29       ` David Woodhouse
2008-07-31 11:33         ` David Miller
2008-07-31 11:46           ` David Woodhouse
2008-07-31 11:50             ` David Miller
2008-07-31 15:58             ` Adrian Bunk
2008-07-31 16:35               ` Thomas Petazzoni
2008-07-31  9:27 ` [patch 4/4] Configure out IGMP support Thomas Petazzoni
2008-08-01 19:41   ` David Woodhouse
2008-08-04 12:48     ` Thomas Petazzoni
2008-08-04 12:53       ` Adrian Bunk
2008-08-04 13:53       ` David Woodhouse
2008-07-31  9:40 ` [patch 0/4] [resend] Add configuration options to disable features not needed on embedded devices David Miller
2008-07-31  9:51   ` David Woodhouse
2008-07-31  9:55     ` David Miller
2008-07-31  9:59       ` David Woodhouse
2008-07-31 10:02         ` David Miller
2008-07-31 10:15           ` David Woodhouse
2008-07-31 10:25             ` David Miller
2008-07-31 17:59               ` Tim Bird
2008-07-31 18:50                 ` [patch 0/4] [resend] Add configuration options to disable features Ulrich Teichert
2008-07-31 19:46                   ` Josh Boyer
2008-07-31 19:55                     ` David Woodhouse
2008-08-01  7:17                     ` Robert Schwebel
2008-08-01 19:15                     ` Linus Torvalds
2008-08-01 19:47                       ` David Woodhouse
2008-07-31 16:42       ` [patch 0/4] [resend] Add configuration options to disable features not needed on embedded devices Tim Bird
2008-07-31 17:20         ` Tim Bird
     [not found] <20080729154520.728594017@free-electrons.com>
     [not found] ` <20080729154747.872888047@free-electrons.com>
2008-07-29 18:17   ` [patch 2/4] Configure out file locking features Matthew Wilcox
2008-07-29 18:57     ` Matt Mackall
2008-07-29 20:00       ` Jamie Lokier
2008-07-30 14:27     ` Adrian Bunk
2008-07-30 15:40       ` Thomas Petazzoni
2008-07-31  6:27         ` Uwe Kleine-König

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=4897837B.3070605@am.sony.com \
    --to=tim.bird@am.sony.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=linux-embedded@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=michael@free-electrons.com \
    --cc=mpm@selenic.com \
    --cc=thomas.petazzoni@free-electrons.com \
    /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