77
88#include "super.h"
99#include "mds_client.h"
10- #define _NEED_FILE_LOCK_FIELD_MACROS
1110#include <linux/filelock.h>
1211#include <linux/ceph/pagelist.h>
1312
@@ -34,7 +33,7 @@ void __init ceph_flock_init(void)
3433
3534static void ceph_fl_copy_lock (struct file_lock * dst , struct file_lock * src )
3635{
37- struct inode * inode = file_inode (dst -> fl_file );
36+ struct inode * inode = file_inode (dst -> c . flc_file );
3837 atomic_inc (& ceph_inode (inode )-> i_filelock_ref );
3938 dst -> fl_u .ceph .inode = igrab (inode );
4039}
@@ -111,17 +110,18 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode,
111110 else
112111 length = fl -> fl_end - fl -> fl_start + 1 ;
113112
114- owner = secure_addr (fl -> fl_owner );
113+ owner = secure_addr (fl -> c . flc_owner );
115114
116115 doutc (cl , "rule: %d, op: %d, owner: %llx, pid: %llu, "
117116 "start: %llu, length: %llu, wait: %d, type: %d\n" ,
118- (int )lock_type , (int )operation , owner , (u64 )fl -> fl_pid ,
119- fl -> fl_start , length , wait , fl -> fl_type );
117+ (int )lock_type , (int )operation , owner ,
118+ (u64 ) fl -> c .flc_pid ,
119+ fl -> fl_start , length , wait , fl -> c .flc_type );
120120
121121 req -> r_args .filelock_change .rule = lock_type ;
122122 req -> r_args .filelock_change .type = cmd ;
123123 req -> r_args .filelock_change .owner = cpu_to_le64 (owner );
124- req -> r_args .filelock_change .pid = cpu_to_le64 ((u64 )fl -> fl_pid );
124+ req -> r_args .filelock_change .pid = cpu_to_le64 ((u64 ) fl -> c . flc_pid );
125125 req -> r_args .filelock_change .start = cpu_to_le64 (fl -> fl_start );
126126 req -> r_args .filelock_change .length = cpu_to_le64 (length );
127127 req -> r_args .filelock_change .wait = wait ;
@@ -131,13 +131,13 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode,
131131 err = ceph_mdsc_wait_request (mdsc , req , wait ?
132132 ceph_lock_wait_for_completion : NULL );
133133 if (!err && operation == CEPH_MDS_OP_GETFILELOCK ) {
134- fl -> fl_pid = - le64_to_cpu (req -> r_reply_info .filelock_reply -> pid );
134+ fl -> c . flc_pid = - le64_to_cpu (req -> r_reply_info .filelock_reply -> pid );
135135 if (CEPH_LOCK_SHARED == req -> r_reply_info .filelock_reply -> type )
136- fl -> fl_type = F_RDLCK ;
136+ fl -> c . flc_type = F_RDLCK ;
137137 else if (CEPH_LOCK_EXCL == req -> r_reply_info .filelock_reply -> type )
138- fl -> fl_type = F_WRLCK ;
138+ fl -> c . flc_type = F_WRLCK ;
139139 else
140- fl -> fl_type = F_UNLCK ;
140+ fl -> c . flc_type = F_UNLCK ;
141141
142142 fl -> fl_start = le64_to_cpu (req -> r_reply_info .filelock_reply -> start );
143143 length = le64_to_cpu (req -> r_reply_info .filelock_reply -> start ) +
@@ -151,8 +151,8 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode,
151151 ceph_mdsc_put_request (req );
152152 doutc (cl , "rule: %d, op: %d, pid: %llu, start: %llu, "
153153 "length: %llu, wait: %d, type: %d, err code %d\n" ,
154- (int )lock_type , (int )operation , (u64 )fl -> fl_pid ,
155- fl -> fl_start , length , wait , fl -> fl_type , err );
154+ (int )lock_type , (int )operation , (u64 ) fl -> c . flc_pid ,
155+ fl -> fl_start , length , wait , fl -> c . flc_type , err );
156156 return err ;
157157}
158158
@@ -228,10 +228,10 @@ static int ceph_lock_wait_for_completion(struct ceph_mds_client *mdsc,
228228static int try_unlock_file (struct file * file , struct file_lock * fl )
229229{
230230 int err ;
231- unsigned int orig_flags = fl -> fl_flags ;
232- fl -> fl_flags |= FL_EXISTS ;
231+ unsigned int orig_flags = fl -> c . flc_flags ;
232+ fl -> c . flc_flags |= FL_EXISTS ;
233233 err = locks_lock_file_wait (file , fl );
234- fl -> fl_flags = orig_flags ;
234+ fl -> c . flc_flags = orig_flags ;
235235 if (err == - ENOENT ) {
236236 if (!(orig_flags & FL_EXISTS ))
237237 err = 0 ;
@@ -254,13 +254,13 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
254254 u8 wait = 0 ;
255255 u8 lock_cmd ;
256256
257- if (!(fl -> fl_flags & FL_POSIX ))
257+ if (!(fl -> c . flc_flags & FL_POSIX ))
258258 return - ENOLCK ;
259259
260260 if (ceph_inode_is_shutdown (inode ))
261261 return - ESTALE ;
262262
263- doutc (cl , "fl_owner: %p\n" , fl -> fl_owner );
263+ doutc (cl , "fl_owner: %p\n" , fl -> c . flc_owner );
264264
265265 /* set wait bit as appropriate, then make command as Ceph expects it*/
266266 if (IS_GETLK (cmd ))
@@ -294,7 +294,7 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
294294
295295 err = ceph_lock_message (CEPH_LOCK_FCNTL , op , inode , lock_cmd , wait , fl );
296296 if (!err ) {
297- if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK != fl -> fl_type ) {
297+ if (op == CEPH_MDS_OP_SETFILELOCK && F_UNLCK != fl -> c . flc_type ) {
298298 doutc (cl , "locking locally\n" );
299299 err = posix_lock_file (file , fl , NULL );
300300 if (err ) {
@@ -320,13 +320,13 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
320320 u8 wait = 0 ;
321321 u8 lock_cmd ;
322322
323- if (!(fl -> fl_flags & FL_FLOCK ))
323+ if (!(fl -> c . flc_flags & FL_FLOCK ))
324324 return - ENOLCK ;
325325
326326 if (ceph_inode_is_shutdown (inode ))
327327 return - ESTALE ;
328328
329- doutc (cl , "fl_file: %p\n" , fl -> fl_file );
329+ doutc (cl , "fl_file: %p\n" , fl -> c . flc_file );
330330
331331 spin_lock (& ci -> i_ceph_lock );
332332 if (ci -> i_ceph_flags & CEPH_I_ERROR_FILELOCK ) {
@@ -357,7 +357,7 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
357357
358358 err = ceph_lock_message (CEPH_LOCK_FLOCK , CEPH_MDS_OP_SETFILELOCK ,
359359 inode , lock_cmd , wait , fl );
360- if (!err && F_UNLCK != fl -> fl_type ) {
360+ if (!err && F_UNLCK != fl -> c . flc_type ) {
361361 err = locks_lock_file_wait (file , fl );
362362 if (err ) {
363363 ceph_lock_message (CEPH_LOCK_FLOCK ,
@@ -409,10 +409,10 @@ static int lock_to_ceph_filelock(struct inode *inode,
409409 cephlock -> start = cpu_to_le64 (lock -> fl_start );
410410 cephlock -> length = cpu_to_le64 (lock -> fl_end - lock -> fl_start + 1 );
411411 cephlock -> client = cpu_to_le64 (0 );
412- cephlock -> pid = cpu_to_le64 ((u64 )lock -> fl_pid );
413- cephlock -> owner = cpu_to_le64 (secure_addr (lock -> fl_owner ));
412+ cephlock -> pid = cpu_to_le64 ((u64 ) lock -> c . flc_pid );
413+ cephlock -> owner = cpu_to_le64 (secure_addr (lock -> c . flc_owner ));
414414
415- switch (lock -> fl_type ) {
415+ switch (lock -> c . flc_type ) {
416416 case F_RDLCK :
417417 cephlock -> type = CEPH_LOCK_SHARED ;
418418 break ;
@@ -423,7 +423,8 @@ static int lock_to_ceph_filelock(struct inode *inode,
423423 cephlock -> type = CEPH_LOCK_UNLOCK ;
424424 break ;
425425 default :
426- doutc (cl , "Have unknown lock type %d\n" , lock -> fl_type );
426+ doutc (cl , "Have unknown lock type %d\n" ,
427+ lock -> c .flc_type );
427428 err = - EINVAL ;
428429 }
429430
0 commit comments