diff options
author | Christoph Hellwig <hch@lst.de> | 2015-12-03 06:59:49 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-12-07 23:09:16 -0500 |
commit | acc15575e78e534c12549d8057a692f490a50f61 (patch) | |
tree | a177119e84264c8a8db1e04090f97a7335ccfc69 /fs/locks.c | |
parent | eac70053a141998c40907747d6cea1d53a9414be (diff) |
locks: new locks_mandatory_area calling convention
Pass a loff_t end for the last byte instead of the 32-bit count
parameter to allow full file clones even on 32-bit architectures.
While we're at it also simplify the read/write selection.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/locks.c')
-rw-r--r-- | fs/locks.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/fs/locks.c b/fs/locks.c index 0d2b3267e2a3..c77a299c1e9e 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1227,20 +1227,16 @@ int locks_mandatory_locked(struct file *file) | |||
1227 | 1227 | ||
1228 | /** | 1228 | /** |
1229 | * locks_mandatory_area - Check for a conflicting lock | 1229 | * locks_mandatory_area - Check for a conflicting lock |
1230 | * @read_write: %FLOCK_VERIFY_WRITE for exclusive access, %FLOCK_VERIFY_READ | 1230 | * @inode: the file to check |
1231 | * for shared | ||
1232 | * @inode: the file to check | ||
1233 | * @filp: how the file was opened (if it was) | 1231 | * @filp: how the file was opened (if it was) |
1234 | * @offset: start of area to check | 1232 | * @start: first byte in the file to check |
1235 | * @count: length of area to check | 1233 | * @end: lastbyte in the file to check |
1234 | * @type: %F_WRLCK for a write lock, else %F_RDLCK | ||
1236 | * | 1235 | * |
1237 | * Searches the inode's list of locks to find any POSIX locks which conflict. | 1236 | * Searches the inode's list of locks to find any POSIX locks which conflict. |
1238 | * This function is called from rw_verify_area() and | ||
1239 | * locks_verify_truncate(). | ||
1240 | */ | 1237 | */ |
1241 | int locks_mandatory_area(int read_write, struct inode *inode, | 1238 | int locks_mandatory_area(struct inode *inode, struct file *filp, loff_t start, |
1242 | struct file *filp, loff_t offset, | 1239 | loff_t end, unsigned char type) |
1243 | size_t count) | ||
1244 | { | 1240 | { |
1245 | struct file_lock fl; | 1241 | struct file_lock fl; |
1246 | int error; | 1242 | int error; |
@@ -1252,9 +1248,9 @@ int locks_mandatory_area(int read_write, struct inode *inode, | |||
1252 | fl.fl_flags = FL_POSIX | FL_ACCESS; | 1248 | fl.fl_flags = FL_POSIX | FL_ACCESS; |
1253 | if (filp && !(filp->f_flags & O_NONBLOCK)) | 1249 | if (filp && !(filp->f_flags & O_NONBLOCK)) |
1254 | sleep = true; | 1250 | sleep = true; |
1255 | fl.fl_type = (read_write == FLOCK_VERIFY_WRITE) ? F_WRLCK : F_RDLCK; | 1251 | fl.fl_type = type; |
1256 | fl.fl_start = offset; | 1252 | fl.fl_start = start; |
1257 | fl.fl_end = offset + count - 1; | 1253 | fl.fl_end = end; |
1258 | 1254 | ||
1259 | for (;;) { | 1255 | for (;;) { |
1260 | if (filp) { | 1256 | if (filp) { |