Lines Matching refs:fl

41 static void ceph_fl_release_lock(struct file_lock *fl)  in ceph_fl_release_lock()  argument
43 struct ceph_file_info *fi = fl->fl_file->private_data; in ceph_fl_release_lock()
44 struct inode *inode = file_inode(fl->fl_file); in ceph_fl_release_lock()
64 int cmd, u8 wait, struct file_lock *fl) in ceph_lock_message() argument
79 fl->fl_ops = &ceph_fl_lock_ops; in ceph_lock_message()
80 fl->fl_ops->fl_copy_lock(fl, NULL); in ceph_lock_message()
94 if (LLONG_MAX == fl->fl_end) in ceph_lock_message()
97 length = fl->fl_end - fl->fl_start + 1; in ceph_lock_message()
99 owner = secure_addr(fl->fl_owner); in ceph_lock_message()
103 (int)operation, owner, (u64)fl->fl_pid, fl->fl_start, length, in ceph_lock_message()
104 wait, fl->fl_type); in ceph_lock_message()
109 req->r_args.filelock_change.pid = cpu_to_le64((u64)fl->fl_pid); in ceph_lock_message()
110 req->r_args.filelock_change.start = cpu_to_le64(fl->fl_start); in ceph_lock_message()
119 fl->fl_pid = -le64_to_cpu(req->r_reply_info.filelock_reply->pid); in ceph_lock_message()
121 fl->fl_type = F_RDLCK; in ceph_lock_message()
123 fl->fl_type = F_WRLCK; in ceph_lock_message()
125 fl->fl_type = F_UNLCK; in ceph_lock_message()
127 fl->fl_start = le64_to_cpu(req->r_reply_info.filelock_reply->start); in ceph_lock_message()
131 fl->fl_end = length -1; in ceph_lock_message()
133 fl->fl_end = 0; in ceph_lock_message()
139 (int)operation, (u64)fl->fl_pid, fl->fl_start, in ceph_lock_message()
140 length, wait, fl->fl_type, err); in ceph_lock_message()
213 static int try_unlock_file(struct file *file, struct file_lock *fl) in try_unlock_file() argument
216 unsigned int orig_flags = fl->fl_flags; in try_unlock_file()
217 fl->fl_flags |= FL_EXISTS; in try_unlock_file()
218 err = locks_lock_file_wait(file, fl); in try_unlock_file()
219 fl->fl_flags = orig_flags; in try_unlock_file()
232 int ceph_lock(struct file *file, int cmd, struct file_lock *fl) in ceph_lock() argument
241 if (!(fl->fl_flags & FL_POSIX)) in ceph_lock()
244 if (__mandatory_lock(file->f_mapping->host) && fl->fl_type != F_UNLCK) in ceph_lock()
247 dout("ceph_lock, fl_owner: %p\n", fl->fl_owner); in ceph_lock()
261 if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK == fl->fl_type) in ceph_lock()
262 posix_lock_file(file, fl, NULL); in ceph_lock()
266 if (F_RDLCK == fl->fl_type) in ceph_lock()
268 else if (F_WRLCK == fl->fl_type) in ceph_lock()
273 if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK == fl->fl_type) { in ceph_lock()
274 err = try_unlock_file(file, fl); in ceph_lock()
279 err = ceph_lock_message(CEPH_LOCK_FCNTL, op, inode, lock_cmd, wait, fl); in ceph_lock()
281 if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK != fl->fl_type) { in ceph_lock()
283 err = posix_lock_file(file, fl, NULL); in ceph_lock()
289 CEPH_LOCK_UNLOCK, 0, fl); in ceph_lock()
298 int ceph_flock(struct file *file, int cmd, struct file_lock *fl) in ceph_flock() argument
306 if (!(fl->fl_flags & FL_FLOCK)) in ceph_flock()
309 if (fl->fl_type & LOCK_MAND) in ceph_flock()
312 dout("ceph_flock, fl_file: %p\n", fl->fl_file); in ceph_flock()
320 if (F_UNLCK == fl->fl_type) in ceph_flock()
321 locks_lock_file_wait(file, fl); in ceph_flock()
328 if (F_RDLCK == fl->fl_type) in ceph_flock()
330 else if (F_WRLCK == fl->fl_type) in ceph_flock()
335 if (F_UNLCK == fl->fl_type) { in ceph_flock()
336 err = try_unlock_file(file, fl); in ceph_flock()
342 inode, lock_cmd, wait, fl); in ceph_flock()
343 if (!err && F_UNLCK != fl->fl_type) { in ceph_flock()
344 err = locks_lock_file_wait(file, fl); in ceph_flock()
348 inode, CEPH_LOCK_UNLOCK, 0, fl); in ceph_flock()