Re: [patch 2/4] Configure out file locking features

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: J. Bruce Fields <bfields@...>
Cc: Thomas Petazzoni <thomas.petazzoni@...>, <linux-kernel@...>, <linux-embedded@...>, <michael@...>, Matt Mackall <mpm@...>, <matthew@...>, <linux-fsdevel@...>, <akpm@...>
Date: Monday, August 4, 2008 - 6:32 pm

J. Bruce Fields wrote:

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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 2/4] Configure out file locking features, Thomas Petazzoni, (Thu Jul 31, 5:27 am)
Re: [patch 2/4] Configure out file locking features, J. Bruce Fields, (Sat Aug 2, 12:38 pm)
Re: [patch 2/4] Configure out file locking features, Thomas Petazzoni, (Mon Aug 4, 9:52 am)
Re: [patch 2/4] Configure out file locking features, J. Bruce Fields, (Mon Aug 4, 2:16 pm)
Re: [patch 2/4] Configure out file locking features, Thomas Petazzoni, (Wed Aug 6, 9:12 am)
Re: [patch 2/4] Configure out file locking features, J. Bruce Fields, (Thu Aug 7, 6:55 pm)
Re: [patch 2/4] Configure out file locking features, J. Bruce Fields, (Mon Aug 4, 2:25 pm)
Re: [patch 2/4] Configure out file locking features, Tim Bird, (Mon Aug 4, 6:32 pm)
Re: [patch 2/4] Configure out file locking features, Matt Mackall, (Mon Aug 4, 2:54 pm)
Re: [patch 2/4] Configure out file locking features, J. Bruce Fields, (Mon Aug 4, 3:42 pm)
Re: [patch 2/4] Configure out file locking features, Adrian Bunk, (Thu Jul 31, 9:53 am)
Re: [patch 2/4] Configure out file locking features, Thomas Petazzoni, (Thu Jul 31, 10:20 am)
Re: [patch 2/4] Configure out file locking features, Adrian Bunk, (Thu Jul 31, 11:37 am)
Re: [patch 2/4] Configure out file locking features, Thomas Petazzoni, (Thu Jul 31, 12:26 pm)
Re: [patch 2/4] Configure out file locking features, Adrian Bunk, (Thu Jul 31, 12:49 pm)
Re: [patch 2/4] Configure out file locking features, Adrian Bunk, (Thu Jul 31, 3:16 pm)
Re: [patch 2/4] Configure out file locking features, Robert Schwebel, (Thu Jul 31, 2:12 pm)
Re: [patch 2/4] Configure out file locking features, Adrian Bunk, (Thu Jul 31, 3:31 pm)
Re: [patch 2/4] Configure out file locking features, Robert Schwebel, (Fri Aug 1, 3:28 am)
Re: [patch 2/4] Configure out file locking features, David Woodhouse, (Thu Jul 31, 12:57 pm)