From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sukadev Bhattiprolu Subject: [RFC][PATCH 1/3][cr][v2]: Define do_setlease() Date: Tue, 25 May 2010 18:07:41 -0700 Message-ID: <1274836063-13271-2-git-send-email-sukadev@linux.vnet.ibm.com> References: <1274836063-13271-1-git-send-email-sukadev@linux.vnet.ibm.com> Cc: serue@us.ibm.com, Matt Helsley , matthew@wil.cx, , Containers To: Oren Laadan Return-path: Received: from e35.co.us.ibm.com ([32.97.110.153]:49538 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932398Ab0EZBAj (ORCPT ); Tue, 25 May 2010 21:00:39 -0400 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e35.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o4Q0sA3q015087 for ; Tue, 25 May 2010 18:54:10 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o4Q10c0P131852 for ; Tue, 25 May 2010 19:00:38 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o4Q10bof029250 for ; Tue, 25 May 2010 19:00:38 -0600 In-Reply-To: <1274836063-13271-1-git-send-email-sukadev@linux.vnet.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Move the core functionality of fcntl_setlease() into a new function, do_setlease(). do_setlease() is same as fcntl_setlease() except that it takes an extra 'rem_lease' parameter. do_setlease() will be used in a follow-on patch to checkpoint/restart file-leases. Signed-off-by: Sukadev Bhattiprolu --- fs/locks.c | 27 ++++++++++++++++----------- include/linux/fs.h | 1 + 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index c62ab7f..4107295 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1471,17 +1471,7 @@ int vfs_setlease(struct file *filp, long arg, struct file_lock **lease) } EXPORT_SYMBOL_GPL(vfs_setlease); -/** - * fcntl_setlease - sets a lease on an open file - * @fd: open file descriptor - * @filp: file pointer - * @arg: type of lease to obtain - * - * Call this fcntl to establish a lease on the file. - * Note that you also need to call %F_SETSIG to - * receive a signal when the lease is broken. - */ -int fcntl_setlease(unsigned int fd, struct file *filp, long arg) +int do_setlease(unsigned int fd, struct file *filp, long arg, int rem_lease) { struct file_lock fl, *flp = &fl; struct inode *inode = filp->f_path.dentry->d_inode; @@ -1515,6 +1505,21 @@ out_unlock: } /** + * fcntl_setlease - sets a lease on an open file + * @fd: open file descriptor + * @filp: file pointer + * @arg: type of lease to obtain + * + * Call this fcntl to establish a lease on the file. + * Note that you also need to call %F_SETSIG to + * receive a signal when the lease is broken. + */ +int fcntl_setlease(unsigned int fd, struct file *filp, long arg) +{ + return do_setlease(fd, filp, arg, 0); +} + +/** * flock_lock_file_wait - Apply a FLOCK-style lock to a file * @filp: The file to apply the lock to * @fl: The lock to be applied diff --git a/include/linux/fs.h b/include/linux/fs.h index 49d4eeb..700317a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1122,6 +1122,7 @@ extern int flock64_set(unsigned int, struct file *, unsigned int, struct flock64 *); #endif +extern int do_setlease(unsigned int fd, struct file *filp, long arg, int rem_lease); extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); extern int fcntl_getlease(struct file *filp); -- 1.6.0.4