Lines Matching refs:fl
42 * Do not use the 'fl->fl_file' in release function, which
45 static void ceph_fl_release_lock(struct file_lock *fl)
47 struct inode *inode = fl->fl_u.ceph.inode;
64 fl->fl_u.ceph.inode = NULL;
77 int cmd, u8 wait, struct file_lock *fl)
92 fl->fl_ops = &ceph_fl_lock_ops;
93 fl->fl_ops->fl_copy_lock(fl, NULL);
107 if (LLONG_MAX == fl->fl_end)
110 length = fl->fl_end - fl->fl_start + 1;
112 owner = secure_addr(fl->fl_owner);
116 (int)operation, owner, (u64)fl->fl_pid, fl->fl_start, length,
117 wait, fl->fl_type);
122 req->r_args.filelock_change.pid = cpu_to_le64((u64)fl->fl_pid);
123 req->r_args.filelock_change.start = cpu_to_le64(fl->fl_start);
132 fl->fl_pid = -le64_to_cpu(req->r_reply_info.filelock_reply->pid);
134 fl->fl_type = F_RDLCK;
136 fl->fl_type = F_WRLCK;
138 fl->fl_type = F_UNLCK;
140 fl->fl_start = le64_to_cpu(req->r_reply_info.filelock_reply->start);
144 fl->fl_end = length -1;
146 fl->fl_end = 0;
152 (int)operation, (u64)fl->fl_pid, fl->fl_start,
153 length, wait, fl->fl_type, err);
226 static int try_unlock_file(struct file *file, struct file_lock *fl)
229 unsigned int orig_flags = fl->fl_flags;
230 fl->fl_flags |= FL_EXISTS;
231 err = locks_lock_file_wait(file, fl);
232 fl->fl_flags = orig_flags;
245 int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
254 if (!(fl->fl_flags & FL_POSIX))
260 dout("ceph_lock, fl_owner: %p\n", fl->fl_owner);
274 if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK == fl->fl_type)
275 posix_lock_file(file, fl, NULL);
279 if (F_RDLCK == fl->fl_type)
281 else if (F_WRLCK == fl->fl_type)
286 if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK == fl->fl_type) {
287 err = try_unlock_file(file, fl);
292 err = ceph_lock_message(CEPH_LOCK_FCNTL, op, inode, lock_cmd, wait, fl);
294 if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK != fl->fl_type) {
296 err = posix_lock_file(file, fl, NULL);
302 CEPH_LOCK_UNLOCK, 0, fl);
311 int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
319 if (!(fl->fl_flags & FL_FLOCK))
325 dout("ceph_flock, fl_file: %p\n", fl->fl_file);
333 if (F_UNLCK == fl->fl_type)
334 locks_lock_file_wait(file, fl);
341 if (F_RDLCK == fl->fl_type)
343 else if (F_WRLCK == fl->fl_type)
348 if (F_UNLCK == fl->fl_type) {
349 err = try_unlock_file(file, fl);
355 inode, lock_cmd, wait, fl);
356 if (!err && F_UNLCK != fl->fl_type) {
357 err = locks_lock_file_wait(file, fl);
361 inode, CEPH_LOCK_UNLOCK, 0, fl);