Whamcloud - gitweb
Still call mdc_close() if there was an error during obd_close(), or we
[fs/lustre-release.git] / lustre / llite / file.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  linux/fs/ext2/file.c
5  *
6  * This code is issued under the GNU General Public License.
7  * See the file COPYING in this distribution
8  *
9  * Copyright (C) 1992, 1993, 1994, 1995
10  * Remy Card (card@masi.ibp.fr)
11  * Laboratoire MASI - Institut Blaise Pascal
12  * Universite Pierre et Marie Curie (Paris VI)
13  *
14  *  from
15  *
16  *  linux/fs/minix/file.c
17  *
18  *  Copyright (C) 1991, 1992  Linus Torvalds
19  *
20  *  ext2 fs regular file handling primitives
21  *
22  *  64-bit file support on 64-bit platforms by Jakub Jelinek
23  *      (jj@sunsite.ms.mff.cuni.cz)
24  */
25
26 #define DEBUG_SUBSYSTEM S_LLITE
27
28 #include <linux/lustre_dlm.h>
29 #include <linux/lustre_lite.h>
30 #include <linux/random.h>
31
32 int ll_inode_setattr(struct inode *inode, struct iattr *attr, int do_trunc);
33 extern int ll_setattr(struct dentry *de, struct iattr *attr);
34
35 static int ll_file_open(struct inode *inode, struct file *file)
36 {
37         struct ptlrpc_request *req = NULL;
38         struct ll_file_data *fd;
39         struct obdo *oa = NULL;
40         struct lov_stripe_md *lsm = NULL;
41         struct ll_sb_info *sbi = ll_i2sbi(inode);
42         struct ll_inode_info *lli = ll_i2info(inode);
43         int rc;
44         ENTRY;
45
46         LASSERT(!file->private_data);
47
48         CHECK_MOUNT_EPOCH(inode);
49
50         lsm = lli->lli_smd;
51
52         /*  delayed create of object (intent created inode) */
53         /*  XXX object needs to be cleaned up if mdc_open fails */
54         /*  XXX error handling appropriate here? */
55         if (lsm == NULL) {
56                 struct inode *inode = file->f_dentry->d_inode;
57
58                 down(&lli->lli_open_sem);
59                 /* Check to see if we lost the race */
60                 if (lli->lli_smd == NULL) {
61                         oa = obdo_alloc();
62                         if (!oa) {
63                                 up(&lli->lli_open_sem);
64                                 RETURN(-ENOMEM);
65                         }
66                         oa->o_mode = S_IFREG | 0600;
67                         oa->o_easize = ll_mds_easize(inode->i_sb);
68                         oa->o_id = inode->i_ino;
69                         oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE |
70                                 OBD_MD_FLMODE | OBD_MD_FLEASIZE;
71                         rc = obd_create(ll_i2obdconn(inode), oa, &lli->lli_smd);
72
73                         if (rc) {
74                                 obdo_free(oa);
75                                 up(&lli->lli_open_sem);
76                                 RETURN(rc);
77                         }
78                 }
79                 if (lli->lli_smd->lsm_object_id == 0)
80                         LBUG();
81                 up(&lli->lli_open_sem);
82                 lsm = lli->lli_smd;
83         }
84
85         fd = kmem_cache_alloc(ll_file_data_slab, SLAB_KERNEL);
86         if (!fd)
87                 GOTO(out, rc = -ENOMEM);
88         memset(fd, 0, sizeof(*fd));
89
90         fd->fd_mdshandle.addr = (__u64)(unsigned long)file;
91         get_random_bytes(&fd->fd_mdshandle.cookie,
92                          sizeof(fd->fd_mdshandle.cookie));
93         rc = mdc_open(&sbi->ll_mdc_conn, inode->i_ino, S_IFREG | inode->i_mode,
94                       file->f_flags, lsm, &fd->fd_mdshandle, &req);
95         fd->fd_req = req;
96         ptlrpc_req_finished(req);
97         if (rc)
98                 GOTO(out_req, -abs(rc));
99         if (!fd->fd_mdshandle.addr ||
100             fd->fd_mdshandle.addr == (__u64)(unsigned long)file) {
101                 CERROR("hmm, mdc_open didn't assign fd_mdshandle?\n");
102                 /* XXX handle this how, abort or is it non-fatal? */
103         }
104
105         if (!oa)
106                 oa = obdo_alloc();
107         if (!oa)
108                 GOTO(out_mdc, rc = -EINVAL);
109
110         oa->o_id = lsm->lsm_object_id;
111         oa->o_mode = S_IFREG;
112         oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLSIZE;
113         rc = obd_open(ll_i2obdconn(inode), oa, lsm);
114         obd_oa2handle(&fd->fd_osthandle, oa);
115
116         if (rc)
117                 GOTO(out_mdc, rc = -abs(rc));
118
119         obdo_free(oa);
120
121         file->private_data = fd;
122
123         RETURN(0);
124 out_mdc:
125         mdc_close(&sbi->ll_mdc_conn, inode->i_ino,
126                   S_IFREG, &fd->fd_mdshandle, &req);
127 out_req:
128         ptlrpc_free_req(req);
129 //out_fd:
130         obdo_free(oa);
131         kmem_cache_free(ll_file_data_slab, fd);
132         file->private_data = NULL;
133 out:
134         return rc;
135 }
136
137 int ll_size_lock(struct inode *inode, struct lov_stripe_md *lsm, __u64 start,
138                  int mode, struct lustre_handle **lockhs_p)
139 {
140         struct ll_sb_info *sbi = ll_i2sbi(inode);
141         struct ldlm_extent extent;
142         struct lustre_handle *lockhs = NULL;
143         int rc, flags = 0, stripe_count;
144         ENTRY;
145
146         if (sbi->ll_flags & LL_SBI_NOLCK) {
147                 *lockhs_p = NULL;
148                 RETURN(0);
149         }
150
151         stripe_count = lsm->lsm_stripe_count;
152         if (!stripe_count)
153                 stripe_count = 1;
154
155         OBD_ALLOC(lockhs, stripe_count * sizeof(*lockhs));
156         if (lockhs == NULL)
157                 RETURN(-ENOMEM);
158
159         extent.start = start;
160         extent.end = OBD_PUNCH_EOF;
161
162         rc = obd_enqueue(&sbi->ll_osc_conn, lsm, NULL, LDLM_EXTENT, &extent,
163                          sizeof(extent), mode, &flags, ll_lock_callback,
164                          inode, sizeof(*inode), lockhs);
165         if (rc != ELDLM_OK) {
166                 CERROR("lock enqueue: %d\n", rc);
167                 OBD_FREE(lockhs, stripe_count * sizeof(*lockhs));
168         } else
169                 *lockhs_p = lockhs;
170         RETURN(rc);
171 }
172
173 int ll_size_unlock(struct inode *inode, struct lov_stripe_md *lsm, int mode,
174                    struct lustre_handle *lockhs)
175 {
176         struct ll_sb_info *sbi = ll_i2sbi(inode);
177         int rc, stripe_count;
178         ENTRY;
179
180         if (sbi->ll_flags & LL_SBI_NOLCK)
181                 RETURN(0);
182
183         if (lockhs == NULL) {
184                 LBUG();
185                 RETURN(-EINVAL);
186         }
187
188         rc = obd_cancel(&sbi->ll_osc_conn, lsm, mode, lockhs);
189         if (rc != ELDLM_OK) {
190                 CERROR("lock cancel: %d\n", rc);
191                 LBUG();
192         }
193
194         stripe_count = lsm->lsm_stripe_count;
195         if (!stripe_count)
196                 stripe_count = 1;
197
198         OBD_FREE(lockhs, stripe_count * sizeof(*lockhs));
199         RETURN(rc);
200 }
201
202 int ll_file_size(struct inode *inode, struct lov_stripe_md *lsm)
203 {
204         struct ll_sb_info *sbi = ll_i2sbi(inode);
205         struct lustre_handle *lockhs;
206         struct obdo oa;
207         int err, rc;
208         ENTRY;
209
210         LASSERT(lsm);
211         LASSERT(sbi);
212
213         rc = ll_size_lock(inode, lsm, 0, LCK_PR, &lockhs);
214         if (rc != ELDLM_OK) {
215                 CERROR("lock enqueue: %d\n", rc);
216                 RETURN(rc);
217         }
218
219         oa.o_id = lsm->lsm_object_id;
220         oa.o_mode = S_IFREG;
221         oa.o_valid = OBD_MD_FLID|OBD_MD_FLTYPE|OBD_MD_FLSIZE|OBD_MD_FLBLOCKS;
222         rc = obd_getattr(&sbi->ll_osc_conn, &oa, lsm);
223         if (!rc)
224                 obdo_to_inode(inode, &oa,
225                               oa.o_valid & ~(OBD_MD_FLTYPE | OBD_MD_FLMODE));
226
227         err = ll_size_unlock(inode, lsm, LCK_PR, lockhs);
228         if (err != ELDLM_OK) {
229                 CERROR("lock cancel: %d\n", err);
230                 LBUG();
231         }
232         RETURN(rc);
233 }
234
235 static int ll_file_release(struct inode *inode, struct file *file)
236 {
237         struct ptlrpc_request *req = NULL;
238         struct ll_file_data *fd;
239         struct obdo oa;
240         struct ll_sb_info *sbi = ll_i2sbi(inode);
241         struct ll_inode_info *lli = ll_i2info(inode);
242         struct lov_stripe_md *lsm = lli->lli_smd;
243         int rc, rc2;
244
245         ENTRY;
246
247         CHECK_MOUNT_EPOCH(inode);
248
249         fd = (struct ll_file_data *)file->private_data;
250         if (!fd) {
251                 LBUG();
252                 GOTO(out, rc = -EINVAL);
253         }
254
255         memset(&oa, 0, sizeof(oa));
256         oa.o_id = lsm->lsm_object_id;
257         oa.o_mode = S_IFREG;
258         oa.o_valid = OBD_MD_FLTYPE | OBD_MD_FLID;
259         obd_handle2oa(&oa, &fd->fd_osthandle);
260         rc = obd_close(ll_i2obdconn(inode), &oa, lsm);
261         if (rc)
262                 GOTO(out_mdc, rc = -abs(rc));
263
264         /* If this fails and we goto out_fd, the file size on the MDS is out of
265          * date.  Is that a big deal? */
266         if (file->f_mode & FMODE_WRITE) {
267                 struct lustre_handle *lockhs;
268
269                 rc = ll_size_lock(inode, lsm, 0, LCK_PR, &lockhs);
270                 if (rc)
271                         GOTO(out_mdc, -abs(rc));
272
273                 oa.o_id = lsm->lsm_object_id;
274                 oa.o_mode = S_IFREG;
275                 oa.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLSIZE |
276                         OBD_MD_FLBLOCKS;
277                 rc = obd_getattr(&sbi->ll_osc_conn, &oa, lsm);
278                 if (!rc) {
279                         struct iattr attr;
280                         attr.ia_valid = (ATTR_MTIME | ATTR_CTIME | ATTR_ATIME |
281                                          ATTR_SIZE);
282                         attr.ia_mtime = inode->i_mtime;
283                         attr.ia_ctime = inode->i_ctime;
284                         attr.ia_atime = inode->i_atime;
285                         attr.ia_size = oa.o_size;
286
287                         inode->i_blocks = oa.o_blocks;
288
289                         /* XXX: this introduces a small race that we should
290                          * evaluate */
291                         rc = ll_inode_setattr(inode, &attr, 0);
292                 }
293                 rc2 = ll_size_unlock(inode, lli->lli_smd, LCK_PR, lockhs);
294                 if (rc2) {
295                         CERROR("lock cancel: %d\n", rc);
296                         LBUG();
297                         if (!rc)
298                                 rc = rc2;
299                 }
300         }
301
302 out_mdc:
303         rc2 = mdc_close(&sbi->ll_mdc_conn, inode->i_ino,
304                         S_IFREG, &fd->fd_mdshandle, &req);
305         ptlrpc_req_finished(req);
306         if (rc2) {
307                 if (!rc)
308                         rc = -abs(rc2);
309                 GOTO(out_fd, rc);
310         }
311         /* XXX Mike, we have also done this in ll_file_open? */
312         ptlrpc_req_finished(fd->fd_req);
313
314         rc = obd_cancel_unused(ll_i2obdconn(inode), lsm, 0);
315         if (rc)
316                 CERROR("obd_cancel_unused: %d\n", rc);
317
318         EXIT;
319
320 out_fd:
321         kmem_cache_free(ll_file_data_slab, fd);
322         file->private_data = NULL;
323 out:
324         return rc;
325 }
326
327
328 static inline void ll_remove_suid(struct inode *inode)
329 {
330         unsigned int mode;
331
332         /* set S_IGID if S_IXGRP is set, and always set S_ISUID */
333         mode = (inode->i_mode & S_IXGRP)*(S_ISGID/S_IXGRP) | S_ISUID;
334
335         /* was any of the uid bits set? */
336         mode &= inode->i_mode;
337         if (mode && !capable(CAP_FSETID)) {
338                 inode->i_mode &= ~mode;
339                 // XXX careful here - we cannot change the size
340         }
341 }
342
343 static void ll_update_atime(struct inode *inode)
344 {
345         struct iattr attr;
346
347         attr.ia_atime = CURRENT_TIME;
348         attr.ia_valid = ATTR_ATIME;
349
350         if (inode->i_atime == attr.ia_atime) return;
351         if (IS_RDONLY(inode)) return;
352         if (IS_NOATIME(inode)) return;
353
354         /* ll_inode_setattr() sets inode->i_atime from attr.ia_atime */
355         ll_inode_setattr(inode, &attr, 0);
356 }
357
358 int ll_lock_callback(struct ldlm_lock *lock, struct ldlm_lock_desc *new,
359                      void *data, __u32 data_len, int flag)
360 {
361         struct inode *inode = data;
362         struct lustre_handle lockh;
363         int rc;
364         ENTRY;
365
366         if (data_len != sizeof(struct inode))
367                 LBUG();
368
369         if (inode == NULL)
370                 LBUG();
371
372         switch (flag) {
373         case LDLM_CB_BLOCKING:
374                 ldlm_lock2handle(lock, &lockh);
375                 rc = ldlm_cli_cancel(&lockh);
376                 if (rc != ELDLM_OK)
377                         CERROR("ldlm_cli_cancel failed: %d\n", rc);
378                 break;
379         case LDLM_CB_CANCELING:
380                 CDEBUG(D_INODE, "invalidating obdo/inode %ld\n", inode->i_ino);
381                 /* FIXME: do something better than throwing away everything */
382                 //down(&inode->i_sem);
383                 invalidate_inode_pages(inode);
384                 //up(&inode->i_sem);
385                 break;
386         default:
387                 LBUG();
388         }
389
390         RETURN(0);
391 }
392
393 static ssize_t ll_file_read(struct file *filp, char *buf, size_t count,
394                             loff_t *ppos)
395 {
396         struct ll_file_data *fd = (struct ll_file_data *)filp->private_data;
397         struct inode *inode = filp->f_dentry->d_inode;
398         struct ll_sb_info *sbi = ll_i2sbi(inode);
399         struct ldlm_extent extent;
400         struct lustre_handle *lockhs = NULL;
401         struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
402         int flags = 0;
403         ldlm_error_t err;
404         ssize_t retval;
405         ENTRY;
406
407         if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
408             sbi->ll_flags & LL_SBI_NOLCK) {
409                 OBD_ALLOC(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
410                 if (!lockhs)
411                         RETURN(-ENOMEM);
412
413                 extent.start = *ppos;
414                 extent.end = *ppos + count;
415                 CDEBUG(D_INFO, "Locking inode %ld, start "LPU64" end "LPU64"\n",
416                        inode->i_ino, extent.start, extent.end);
417
418                 err = obd_enqueue(&sbi->ll_osc_conn, lsm, NULL, LDLM_EXTENT,
419                                   &extent, sizeof(extent), LCK_PR, &flags,
420                                   ll_lock_callback, inode, sizeof(*inode),
421                                   lockhs);
422                 if (err != ELDLM_OK) {
423                         OBD_FREE(lockhs, lsm->lsm_stripe_count*sizeof(*lockhs));
424                         CERROR("lock enqueue: err: %d\n", err);
425                         RETURN(err);
426                 }
427         }
428
429         CDEBUG(D_INFO, "Reading inode %ld, %d bytes, offset %Ld\n",
430                inode->i_ino, count, *ppos);
431         retval = generic_file_read(filp, buf, count, ppos);
432
433         if (retval > 0)
434                 ll_update_atime(inode);
435
436         if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
437             sbi->ll_flags & LL_SBI_NOLCK) {
438                 err = obd_cancel(&sbi->ll_osc_conn, lsm, LCK_PR, lockhs);
439                 if (err != ELDLM_OK) {
440                         CERROR("lock cancel: err: %d\n", err);
441                         retval = err;
442                 }
443         }
444
445         if (lockhs)
446                 OBD_FREE(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
447         RETURN(retval);
448 }
449
450 /*
451  * Write to a file (through the page cache).
452  */
453 static ssize_t
454 ll_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
455 {
456         struct ll_file_data *fd = (struct ll_file_data *)file->private_data;
457         struct inode *inode = file->f_dentry->d_inode;
458         struct ll_sb_info *sbi = ll_i2sbi(inode);
459         struct ldlm_extent extent;
460         struct lustre_handle *lockhs = NULL, *eof_lockhs = NULL;
461         struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
462         int flags = 0;
463         ldlm_error_t err;
464         ssize_t retval;
465         ENTRY;
466
467         if (!S_ISBLK(inode->i_mode) && file->f_flags & O_APPEND) {
468                 struct obdo *oa;
469
470                 oa = obdo_alloc();
471                 if (!oa)
472                         RETURN(-ENOMEM);
473
474                 err = ll_size_lock(inode, lsm, 0, LCK_PW, &eof_lockhs);
475                 if (err) {
476                         obdo_free(oa);
477                         RETURN(err);
478                 }
479
480                 oa->o_id = lsm->lsm_object_id;
481                 oa->o_mode = inode->i_mode;
482                 oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLSIZE |
483                         OBD_MD_FLBLOCKS;
484                 obd_handle2oa(oa, &fd->fd_osthandle);
485                 retval = obd_getattr(&sbi->ll_osc_conn, oa, lsm);
486                 if (retval) {
487                         obdo_free(oa);
488                         GOTO(out_eof, retval);
489                 }
490
491                 *ppos = oa->o_size;
492                 obdo_to_inode(inode, oa, oa->o_valid);
493                 obdo_free(oa);
494         }
495
496         if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
497             sbi->ll_flags & LL_SBI_NOLCK) {
498                 OBD_ALLOC(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
499                 if (!lockhs)
500                         GOTO(out_eof, retval = -ENOMEM);
501                 extent.start = *ppos;
502                 extent.end = *ppos + count;
503                 CDEBUG(D_INFO, "Locking inode %ld, start "LPU64" end "LPU64"\n",
504                        inode->i_ino, extent.start, extent.end);
505
506                 err = obd_enqueue(&sbi->ll_osc_conn, lsm, NULL, LDLM_EXTENT,
507                                   &extent, sizeof(extent), LCK_PW, &flags,
508                                   ll_lock_callback, inode, sizeof(*inode),
509                                   lockhs);
510                 if (err != ELDLM_OK) {
511                         CERROR("lock enqueue: err: %d\n", err);
512                         GOTO(out_free, retval = err);
513                 }
514         }
515
516         CDEBUG(D_INFO, "Writing inode %ld, %ld bytes, offset "LPD64"\n",
517                inode->i_ino, (long)count, *ppos);
518
519         retval = generic_file_write(file, buf, count, ppos);
520
521         if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
522             sbi->ll_flags & LL_SBI_NOLCK) {
523                 err = obd_cancel(&sbi->ll_osc_conn, lsm, LCK_PW, lockhs);
524                 if (err != ELDLM_OK) {
525                         CERROR("lock cancel: err: %d\n", err);
526                         GOTO(out_free, retval = err);
527                 }
528         }
529
530         EXIT;
531  out_free:
532         if (lockhs)
533                 OBD_FREE(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
534
535  out_eof:
536         if (!S_ISBLK(inode->i_mode) && file->f_flags & O_APPEND) {
537                 err = ll_size_unlock(inode, lsm, LCK_PW, eof_lockhs);
538                 if (err && !retval)
539                         retval = err;
540         }
541
542         return retval;
543 }
544
545 int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
546                   unsigned long arg)
547 {
548         struct ll_file_data *fd = (struct ll_file_data *)file->private_data;
549         int flags;
550
551         switch(cmd) {
552         case LL_IOC_GETFLAGS:
553                 /* Get the current value of the file flags */
554                 return put_user(fd->fd_flags, (int *)arg);
555         case LL_IOC_SETFLAGS:
556         case LL_IOC_CLRFLAGS:
557                 /* Set or clear specific file flags */
558                 /* XXX This probably needs checks to ensure the flags are
559                  *     not abused, and to handle any flag side effects.
560                  */
561                 if (get_user(flags, (int *) arg))
562                         return -EFAULT;
563
564                 if (cmd == LL_IOC_SETFLAGS)
565                         fd->fd_flags |= flags;
566                 else
567                         fd->fd_flags &= ~flags;
568                 return 0;
569
570         /* We need to special case any other ioctls we want to handle,
571          * to send them to the MDS/OST as appropriate and to properly
572          * network encode the arg field.
573         case EXT2_IOC_GETFLAGS:
574         case EXT2_IOC_SETFLAGS:
575         case EXT2_IOC_GETVERSION_OLD:
576         case EXT2_IOC_GETVERSION_NEW:
577         case EXT2_IOC_SETVERSION_OLD:
578         case EXT2_IOC_SETVERSION_NEW:
579         */
580         default:
581                 return -ENOTTY;
582         }
583 }
584
585 loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
586 {
587         struct inode *inode = file->f_dentry->d_inode;
588         long long retval;
589         ENTRY;
590
591         CHECK_MOUNT_EPOCH(inode);
592
593         switch (origin) {
594         case 2: {
595                 struct ll_inode_info *lli = ll_i2info(inode);
596
597                 retval = ll_file_size(inode, lli->lli_smd);
598                 if (retval)
599                         RETURN(retval);
600
601                 offset += inode->i_size;
602                 break;
603         }
604         case 1:
605                 offset += file->f_pos;
606         }
607         retval = -EINVAL;
608         if (offset >= 0 && offset <= inode->i_sb->s_maxbytes) {
609                 if (offset != file->f_pos) {
610                         file->f_pos = offset;
611                         file->f_reada = 0;
612                         file->f_version = ++event;
613                 }
614                 retval = offset;
615         }
616         RETURN(retval);
617 }
618
619 /* XXX this does not need to do anything for data, it _does_ need to
620    call setattr */
621 int ll_fsync(struct file *file, struct dentry *dentry, int data)
622 {
623         return 0;
624 }
625
626 static int ll_inode_revalidate(struct dentry *dentry)
627 {
628         struct inode *inode = dentry->d_inode;
629         struct lov_stripe_md *lsm;
630         ENTRY;
631
632         if (!inode)
633                 RETURN(0);
634
635         lsm = ll_i2info(inode)->lli_smd;
636         if (!lsm)       /* object not yet allocated, don't validate size */
637                 RETURN(0);
638
639         RETURN(ll_file_size(inode, lsm));
640 }
641
642 struct file_operations ll_file_operations = {
643         read:           ll_file_read,
644         write:          ll_file_write,
645         ioctl:          ll_file_ioctl,
646         open:           ll_file_open,
647         release:        ll_file_release,
648         mmap:           generic_file_mmap,
649         llseek:         ll_file_seek,
650         fsync:          NULL
651 };
652
653 struct inode_operations ll_file_inode_operations = {
654         truncate:   ll_truncate,
655         setattr:    ll_setattr,
656         revalidate: ll_inode_revalidate
657 };