Lines Matching refs:fl

45 static void ceph_fl_release_lock(struct file_lock *fl)  in ceph_fl_release_lock()  argument
47 struct inode *inode = fl->fl_u.ceph.inode; in ceph_fl_release_lock()
64 fl->fl_u.ceph.inode = NULL; in ceph_fl_release_lock()
77 int cmd, u8 wait, struct file_lock *fl) in ceph_lock_message() argument
93 fl->fl_ops = &ceph_fl_lock_ops; in ceph_lock_message()
94 fl->fl_ops->fl_copy_lock(fl, NULL); in ceph_lock_message()
108 if (LLONG_MAX == fl->fl_end) in ceph_lock_message()
111 length = fl->fl_end - fl->fl_start + 1; in ceph_lock_message()
113 owner = secure_addr(fl->c.flc_owner); in ceph_lock_message()
118 (u64) fl->c.flc_pid, in ceph_lock_message()
119 fl->fl_start, length, wait, fl->c.flc_type); in ceph_lock_message()
124 req->r_args.filelock_change.pid = cpu_to_le64((u64) fl->c.flc_pid); in ceph_lock_message()
125 req->r_args.filelock_change.start = cpu_to_le64(fl->fl_start); in ceph_lock_message()
134 fl->c.flc_pid = -le64_to_cpu(req->r_reply_info.filelock_reply->pid); in ceph_lock_message()
136 fl->c.flc_type = F_RDLCK; in ceph_lock_message()
138 fl->c.flc_type = F_WRLCK; in ceph_lock_message()
140 fl->c.flc_type = F_UNLCK; in ceph_lock_message()
142 fl->fl_start = le64_to_cpu(req->r_reply_info.filelock_reply->start); in ceph_lock_message()
146 fl->fl_end = length -1; in ceph_lock_message()
148 fl->fl_end = 0; in ceph_lock_message()
154 (int)lock_type, (int)operation, (u64) fl->c.flc_pid, in ceph_lock_message()
155 fl->fl_start, length, wait, fl->c.flc_type, err); in ceph_lock_message()
231 static int try_unlock_file(struct file *file, struct file_lock *fl) in try_unlock_file() argument
234 unsigned int orig_flags = fl->c.flc_flags; in try_unlock_file()
235 fl->c.flc_flags |= FL_EXISTS; in try_unlock_file()
236 err = locks_lock_file_wait(file, fl); in try_unlock_file()
237 fl->c.flc_flags = orig_flags; in try_unlock_file()
250 int ceph_lock(struct file *file, int cmd, struct file_lock *fl) in ceph_lock() argument
260 if (!(fl->c.flc_flags & FL_POSIX)) in ceph_lock()
266 doutc(cl, "fl_owner: %p\n", fl->c.flc_owner); in ceph_lock()
280 if (op == CEPH_MDS_OP_SETFILELOCK && lock_is_unlock(fl)) in ceph_lock()
281 posix_lock_file(file, fl, NULL); in ceph_lock()
285 if (lock_is_read(fl)) in ceph_lock()
287 else if (lock_is_write(fl)) in ceph_lock()
292 if (op == CEPH_MDS_OP_SETFILELOCK && lock_is_unlock(fl)) { in ceph_lock()
293 err = try_unlock_file(file, fl); in ceph_lock()
298 err = ceph_lock_message(CEPH_LOCK_FCNTL, op, inode, lock_cmd, wait, fl); in ceph_lock()
300 if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK != fl->c.flc_type) { in ceph_lock()
302 err = posix_lock_file(file, fl, NULL); in ceph_lock()
308 CEPH_LOCK_UNLOCK, 0, fl); in ceph_lock()
317 int ceph_flock(struct file *file, int cmd, struct file_lock *fl) in ceph_flock() argument
326 if (!(fl->c.flc_flags & FL_FLOCK)) in ceph_flock()
332 doutc(cl, "fl_file: %p\n", fl->c.flc_file); in ceph_flock()
340 if (lock_is_unlock(fl)) in ceph_flock()
341 locks_lock_file_wait(file, fl); in ceph_flock()
348 if (lock_is_read(fl)) in ceph_flock()
350 else if (lock_is_write(fl)) in ceph_flock()
355 if (lock_is_unlock(fl)) { in ceph_flock()
356 err = try_unlock_file(file, fl); in ceph_flock()
362 inode, lock_cmd, wait, fl); in ceph_flock()
363 if (!err && F_UNLCK != fl->c.flc_type) { in ceph_flock()
364 err = locks_lock_file_wait(file, fl); in ceph_flock()
368 inode, CEPH_LOCK_UNLOCK, 0, fl); in ceph_flock()