Merge branch 'stable-3.2' into pandora-3.2
[pandora-kernel.git] / fs / aufs / file.c
1 /*
2  * Copyright (C) 2005-2013 Junjiro R. Okajima
3  *
4  * This program, aufs is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18
19 /*
20  * handling file/dir, and address_space operation
21  */
22
23 #ifdef CONFIG_AUFS_DEBUG
24 #include <linux/migrate.h>
25 #endif
26 #include <linux/pagemap.h>
27 #include "aufs.h"
28
29 /* drop flags for writing */
30 unsigned int au_file_roflags(unsigned int flags)
31 {
32         flags &= ~(O_WRONLY | O_RDWR | O_APPEND | O_CREAT | O_TRUNC);
33         flags |= O_RDONLY | O_NOATIME;
34         return flags;
35 }
36
37 /* common functions to regular file and dir */
38 struct file *au_h_open(struct dentry *dentry, aufs_bindex_t bindex, int flags,
39                        struct file *file)
40 {
41         struct file *h_file;
42         struct dentry *h_dentry;
43         struct inode *h_inode;
44         struct super_block *sb;
45         struct au_branch *br;
46         struct path h_path;
47         int err, exec_flag;
48
49         /* a race condition can happen between open and unlink/rmdir */
50         h_file = ERR_PTR(-ENOENT);
51         h_dentry = au_h_dptr(dentry, bindex);
52         if (au_test_nfsd() && !h_dentry)
53                 goto out;
54         h_inode = h_dentry->d_inode;
55         if (au_test_nfsd() && !h_inode)
56                 goto out;
57         spin_lock(&h_dentry->d_lock);
58         err = (!d_unhashed(dentry) && d_unlinked(h_dentry))
59                 || !h_inode
60                 /* || !dentry->d_inode->i_nlink */
61                 ;
62         spin_unlock(&h_dentry->d_lock);
63         if (unlikely(err))
64                 goto out;
65
66         sb = dentry->d_sb;
67         br = au_sbr(sb, bindex);
68         h_file = ERR_PTR(-EACCES);
69         exec_flag = flags & __FMODE_EXEC;
70         if (exec_flag && (au_br_mnt(br)->mnt_flags & MNT_NOEXEC))
71                 goto out;
72
73         /* drop flags for writing */
74         if (au_test_ro(sb, bindex, dentry->d_inode))
75                 flags = au_file_roflags(flags);
76         flags &= ~O_CREAT;
77         atomic_inc(&br->br_count);
78         h_path.dentry = h_dentry;
79         h_path.mnt = au_br_mnt(br);
80         if (!au_special_file(h_inode->i_mode))
81                 h_file = vfsub_dentry_open(&h_path, flags);
82         else {
83                 /* this block depends upon the configuration */
84                 di_read_unlock(dentry, AuLock_IR);
85                 fi_write_unlock(file);
86                 si_read_unlock(sb);
87                 h_file = vfsub_dentry_open(&h_path, flags);
88                 si_noflush_read_lock(sb);
89                 fi_write_lock(file);
90                 di_read_lock_child(dentry, AuLock_IR);
91         }
92         if (IS_ERR(h_file))
93                 goto out_br;
94
95         if (exec_flag) {
96                 err = deny_write_access(h_file);
97                 if (unlikely(err)) {
98                         fput(h_file);
99                         h_file = ERR_PTR(err);
100                         goto out_br;
101                 }
102         }
103         fsnotify_open(h_file);
104         goto out; /* success */
105
106 out_br:
107         atomic_dec(&br->br_count);
108 out:
109         return h_file;
110 }
111
112 int au_do_open(struct file *file, int (*open)(struct file *file, int flags),
113                struct au_fidir *fidir)
114 {
115         int err;
116         struct dentry *dentry;
117
118         err = au_finfo_init(file, fidir);
119         if (unlikely(err))
120                 goto out;
121
122         dentry = file->f_dentry;
123         di_read_lock_child(dentry, AuLock_IR);
124         err = open(file, vfsub_file_flags(file));
125         di_read_unlock(dentry, AuLock_IR);
126
127         fi_write_unlock(file);
128         if (unlikely(err)) {
129                 au_fi(file)->fi_hdir = NULL;
130                 au_finfo_fin(file);
131         }
132
133 out:
134         return err;
135 }
136
137 int au_reopen_nondir(struct file *file)
138 {
139         int err;
140         aufs_bindex_t bstart;
141         struct dentry *dentry;
142         struct file *h_file, *h_file_tmp;
143
144         dentry = file->f_dentry;
145         AuDebugOn(au_special_file(dentry->d_inode->i_mode));
146         bstart = au_dbstart(dentry);
147         h_file_tmp = NULL;
148         if (au_fbstart(file) == bstart) {
149                 h_file = au_hf_top(file);
150                 if (file->f_mode == h_file->f_mode)
151                         return 0; /* success */
152                 h_file_tmp = h_file;
153                 get_file(h_file_tmp);
154                 au_set_h_fptr(file, bstart, NULL);
155         }
156         AuDebugOn(au_fi(file)->fi_hdir);
157         /*
158          * it can happen
159          * file exists on both of rw and ro
160          * open --> dbstart and fbstart are both 0
161          * prepend a branch as rw, "rw" become ro
162          * remove rw/file
163          * delete the top branch, "rw" becomes rw again
164          *      --> dbstart is 1, fbstart is still 0
165          * write --> fbstart is 0 but dbstart is 1
166          */
167         /* AuDebugOn(au_fbstart(file) < bstart); */
168
169         h_file = au_h_open(dentry, bstart, vfsub_file_flags(file) & ~O_TRUNC,
170                            file);
171         err = PTR_ERR(h_file);
172         if (IS_ERR(h_file)) {
173                 if (h_file_tmp) {
174                         atomic_inc(&au_sbr(dentry->d_sb, bstart)->br_count);
175                         au_set_h_fptr(file, bstart, h_file_tmp);
176                         h_file_tmp = NULL;
177                 }
178                 goto out; /* todo: close all? */
179         }
180
181         err = 0;
182         au_set_fbstart(file, bstart);
183         au_set_h_fptr(file, bstart, h_file);
184         au_update_figen(file);
185         /* todo: necessary? */
186         /* file->f_ra = h_file->f_ra; */
187
188 out:
189         if (h_file_tmp)
190                 fput(h_file_tmp);
191         return err;
192 }
193
194 /* ---------------------------------------------------------------------- */
195
196 static int au_reopen_wh(struct file *file, aufs_bindex_t btgt,
197                         struct dentry *hi_wh)
198 {
199         int err;
200         aufs_bindex_t bstart;
201         struct au_dinfo *dinfo;
202         struct dentry *h_dentry;
203         struct au_hdentry *hdp;
204
205         dinfo = au_di(file->f_dentry);
206         AuRwMustWriteLock(&dinfo->di_rwsem);
207
208         bstart = dinfo->di_bstart;
209         dinfo->di_bstart = btgt;
210         hdp = dinfo->di_hdentry;
211         h_dentry = hdp[0 + btgt].hd_dentry;
212         hdp[0 + btgt].hd_dentry = hi_wh;
213         err = au_reopen_nondir(file);
214         hdp[0 + btgt].hd_dentry = h_dentry;
215         dinfo->di_bstart = bstart;
216
217         return err;
218 }
219
220 static int au_ready_to_write_wh(struct file *file, loff_t len,
221                                 aufs_bindex_t bcpup, struct au_pin *pin)
222 {
223         int err;
224         struct inode *inode, *h_inode;
225         struct dentry *h_dentry, *hi_wh;
226         struct au_cp_generic cpg = {
227                 .dentry = file->f_dentry,
228                 .bdst   = bcpup,
229                 .bsrc   = -1,
230                 .len    = len,
231                 .pin    = pin
232         };
233
234         au_update_dbstart(cpg.dentry);
235         inode = cpg.dentry->d_inode;
236         h_inode = NULL;
237         if (au_dbstart(cpg.dentry) <= bcpup
238             && au_dbend(cpg.dentry) >= bcpup) {
239                 h_dentry = au_h_dptr(cpg.dentry, bcpup);
240                 if (h_dentry)
241                         h_inode = h_dentry->d_inode;
242         }
243         hi_wh = au_hi_wh(inode, bcpup);
244         if (!hi_wh && !h_inode)
245                 err = au_sio_cpup_wh(&cpg, file);
246         else
247                 /* already copied-up after unlink */
248                 err = au_reopen_wh(file, bcpup, hi_wh);
249
250         if (!err
251             && inode->i_nlink > 1
252             && au_opt_test(au_mntflags(cpg.dentry->d_sb), PLINK))
253                 au_plink_append(inode, bcpup, au_h_dptr(cpg.dentry, bcpup));
254
255         return err;
256 }
257
258 /*
259  * prepare the @file for writing.
260  */
261 int au_ready_to_write(struct file *file, loff_t len, struct au_pin *pin)
262 {
263         int err;
264         aufs_bindex_t dbstart;
265         struct dentry *parent, *h_dentry;
266         struct inode *inode;
267         struct super_block *sb;
268         struct file *h_file;
269         struct au_cp_generic cpg = {
270                 .dentry = file->f_dentry,
271                 .bdst   = -1,
272                 .bsrc   = -1,
273                 .len    = len,
274                 .pin    = pin,
275                 .flags  = AuCpup_DTIME
276         };
277
278         sb = cpg.dentry->d_sb;
279         inode = cpg.dentry->d_inode;
280         AuDebugOn(au_special_file(inode->i_mode));
281         cpg.bsrc = au_fbstart(file);
282         err = au_test_ro(sb, cpg.bsrc, inode);
283         if (!err && (au_hf_top(file)->f_mode & FMODE_WRITE)) {
284                 err = au_pin(pin, cpg.dentry, cpg.bsrc, AuOpt_UDBA_NONE,
285                              /*flags*/0);
286                 goto out;
287         }
288
289         /* need to cpup or reopen */
290         parent = dget_parent(cpg.dentry);
291         di_write_lock_parent(parent);
292         err = AuWbrCopyup(au_sbi(sb), cpg.dentry);
293         cpg.bdst = err;
294         if (unlikely(err < 0))
295                 goto out_dgrade;
296         err = 0;
297
298         if (!d_unhashed(cpg.dentry) && !au_h_dptr(parent, cpg.bdst)) {
299                 err = au_cpup_dirs(cpg.dentry, cpg.bdst);
300                 if (unlikely(err))
301                         goto out_dgrade;
302         }
303
304         err = au_pin(pin, cpg.dentry, cpg.bdst, AuOpt_UDBA_NONE,
305                      AuPin_DI_LOCKED | AuPin_MNT_WRITE);
306         if (unlikely(err))
307                 goto out_dgrade;
308
309         h_dentry = au_hf_top(file)->f_dentry;
310         dbstart = au_dbstart(cpg.dentry);
311         if (dbstart <= cpg.bdst) {
312                 h_dentry = au_h_dptr(cpg.dentry, cpg.bdst);
313                 AuDebugOn(!h_dentry);
314                 cpg.bsrc = cpg.bdst;
315         }
316
317         if (dbstart <= cpg.bdst         /* just reopen */
318             || !d_unhashed(cpg.dentry)  /* copyup and reopen */
319                 ) {
320                 h_file = au_h_open_pre(cpg.dentry, cpg.bsrc);
321                 if (IS_ERR(h_file))
322                         err = PTR_ERR(h_file);
323                 else {
324                         di_downgrade_lock(parent, AuLock_IR);
325                         if (dbstart > cpg.bdst)
326                                 err = au_sio_cpup_simple(&cpg);
327                         if (!err)
328                                 err = au_reopen_nondir(file);
329                         au_h_open_post(cpg.dentry, cpg.bsrc, h_file);
330                 }
331         } else {                        /* copyup as wh and reopen */
332                 /*
333                  * since writable hfsplus branch is not supported,
334                  * h_open_pre/post() are unnecessary.
335                  */
336                 err = au_ready_to_write_wh(file, len, cpg.bdst, pin);
337                 di_downgrade_lock(parent, AuLock_IR);
338         }
339
340         if (!err) {
341                 au_pin_set_parent_lflag(pin, /*lflag*/0);
342                 goto out_dput; /* success */
343         }
344         au_unpin(pin);
345         goto out_unlock;
346
347 out_dgrade:
348         di_downgrade_lock(parent, AuLock_IR);
349 out_unlock:
350         di_read_unlock(parent, AuLock_IR);
351 out_dput:
352         dput(parent);
353 out:
354         return err;
355 }
356
357 /* ---------------------------------------------------------------------- */
358
359 int au_do_flush(struct file *file, fl_owner_t id,
360                 int (*flush)(struct file *file, fl_owner_t id))
361 {
362         int err;
363         struct dentry *dentry;
364         struct super_block *sb;
365         struct inode *inode;
366
367         dentry = file->f_dentry;
368         sb = dentry->d_sb;
369         inode = dentry->d_inode;
370         si_noflush_read_lock(sb);
371         fi_read_lock(file);
372         ii_read_lock_child(inode);
373
374         err = flush(file, id);
375         au_cpup_attr_timesizes(inode);
376
377         ii_read_unlock(inode);
378         fi_read_unlock(file);
379         si_read_unlock(sb);
380         return err;
381 }
382
383 /* ---------------------------------------------------------------------- */
384
385 static int au_file_refresh_by_inode(struct file *file, int *need_reopen)
386 {
387         int err;
388         struct au_pin pin;
389         struct au_finfo *finfo;
390         struct dentry *parent, *hi_wh;
391         struct inode *inode;
392         struct super_block *sb;
393         struct au_cp_generic cpg = {
394                 .dentry = file->f_dentry,
395                 .bdst   = -1,
396                 .bsrc   = -1,
397                 .len    = -1,
398                 .pin    = &pin,
399                 .flags  = AuCpup_DTIME
400         };
401
402         FiMustWriteLock(file);
403
404         err = 0;
405         finfo = au_fi(file);
406         sb = cpg.dentry->d_sb;
407         inode = cpg.dentry->d_inode;
408         cpg.bdst = au_ibstart(inode);
409         if (cpg.bdst == finfo->fi_btop || IS_ROOT(cpg.dentry))
410                 goto out;
411
412         parent = dget_parent(cpg.dentry);
413         if (au_test_ro(sb, cpg.bdst, inode)) {
414                 di_read_lock_parent(parent, !AuLock_IR);
415                 err = AuWbrCopyup(au_sbi(sb), cpg.dentry);
416                 cpg.bdst = err;
417                 di_read_unlock(parent, !AuLock_IR);
418                 if (unlikely(err < 0))
419                         goto out_parent;
420                 err = 0;
421         }
422
423         di_read_lock_parent(parent, AuLock_IR);
424         hi_wh = au_hi_wh(inode, cpg.bdst);
425         if (!S_ISDIR(inode->i_mode)
426             && au_opt_test(au_mntflags(sb), PLINK)
427             && au_plink_test(inode)
428             && !d_unhashed(cpg.dentry)
429             && cpg.bdst < au_dbstart(cpg.dentry)) {
430                 err = au_test_and_cpup_dirs(cpg.dentry, cpg.bdst);
431                 if (unlikely(err))
432                         goto out_unlock;
433
434                 /* always superio. */
435                 err = au_pin(&pin, cpg.dentry, cpg.bdst, AuOpt_UDBA_NONE,
436                              AuPin_DI_LOCKED | AuPin_MNT_WRITE);
437                 if (!err) {
438                         err = au_sio_cpup_simple(&cpg);
439                         au_unpin(&pin);
440                 }
441         } else if (hi_wh) {
442                 /* already copied-up after unlink */
443                 err = au_reopen_wh(file, cpg.bdst, hi_wh);
444                 *need_reopen = 0;
445         }
446
447 out_unlock:
448         di_read_unlock(parent, AuLock_IR);
449 out_parent:
450         dput(parent);
451 out:
452         return err;
453 }
454
455 static void au_do_refresh_dir(struct file *file)
456 {
457         aufs_bindex_t bindex, bend, new_bindex, brid;
458         struct au_hfile *p, tmp, *q;
459         struct au_finfo *finfo;
460         struct super_block *sb;
461         struct au_fidir *fidir;
462
463         FiMustWriteLock(file);
464
465         sb = file->f_dentry->d_sb;
466         finfo = au_fi(file);
467         fidir = finfo->fi_hdir;
468         AuDebugOn(!fidir);
469         p = fidir->fd_hfile + finfo->fi_btop;
470         brid = p->hf_br->br_id;
471         bend = fidir->fd_bbot;
472         for (bindex = finfo->fi_btop; bindex <= bend; bindex++, p++) {
473                 if (!p->hf_file)
474                         continue;
475
476                 new_bindex = au_br_index(sb, p->hf_br->br_id);
477                 if (new_bindex == bindex)
478                         continue;
479                 if (new_bindex < 0) {
480                         au_set_h_fptr(file, bindex, NULL);
481                         continue;
482                 }
483
484                 /* swap two lower inode, and loop again */
485                 q = fidir->fd_hfile + new_bindex;
486                 tmp = *q;
487                 *q = *p;
488                 *p = tmp;
489                 if (tmp.hf_file) {
490                         bindex--;
491                         p--;
492                 }
493         }
494
495         p = fidir->fd_hfile;
496         if (!au_test_mmapped(file) && !d_unlinked(file->f_dentry)) {
497                 bend = au_sbend(sb);
498                 for (finfo->fi_btop = 0; finfo->fi_btop <= bend;
499                      finfo->fi_btop++, p++)
500                         if (p->hf_file) {
501                                 if (p->hf_file->f_dentry
502                                     && p->hf_file->f_dentry->d_inode)
503                                         break;
504                                 else
505                                         au_hfput(p, file);
506                         }
507         } else {
508                 bend = au_br_index(sb, brid);
509                 for (finfo->fi_btop = 0; finfo->fi_btop < bend;
510                      finfo->fi_btop++, p++)
511                         if (p->hf_file)
512                                 au_hfput(p, file);
513                 bend = au_sbend(sb);
514         }
515
516         p = fidir->fd_hfile + bend;
517         for (fidir->fd_bbot = bend; fidir->fd_bbot >= finfo->fi_btop;
518              fidir->fd_bbot--, p--)
519                 if (p->hf_file) {
520                         if (p->hf_file->f_dentry
521                             && p->hf_file->f_dentry->d_inode)
522                                 break;
523                         else
524                                 au_hfput(p, file);
525                 }
526         AuDebugOn(fidir->fd_bbot < finfo->fi_btop);
527 }
528
529 /*
530  * after branch manipulating, refresh the file.
531  */
532 static int refresh_file(struct file *file, int (*reopen)(struct file *file))
533 {
534         int err, need_reopen;
535         aufs_bindex_t bend, bindex;
536         struct dentry *dentry;
537         struct au_finfo *finfo;
538         struct au_hfile *hfile;
539
540         dentry = file->f_dentry;
541         finfo = au_fi(file);
542         if (!finfo->fi_hdir) {
543                 hfile = &finfo->fi_htop;
544                 AuDebugOn(!hfile->hf_file);
545                 bindex = au_br_index(dentry->d_sb, hfile->hf_br->br_id);
546                 AuDebugOn(bindex < 0);
547                 if (bindex != finfo->fi_btop)
548                         au_set_fbstart(file, bindex);
549         } else {
550                 err = au_fidir_realloc(finfo, au_sbend(dentry->d_sb) + 1);
551                 if (unlikely(err))
552                         goto out;
553                 au_do_refresh_dir(file);
554         }
555
556         err = 0;
557         need_reopen = 1;
558         if (!au_test_mmapped(file))
559                 err = au_file_refresh_by_inode(file, &need_reopen);
560         if (!err && need_reopen && !d_unlinked(dentry))
561                 err = reopen(file);
562         if (!err) {
563                 au_update_figen(file);
564                 goto out; /* success */
565         }
566
567         /* error, close all lower files */
568         if (finfo->fi_hdir) {
569                 bend = au_fbend_dir(file);
570                 for (bindex = au_fbstart(file); bindex <= bend; bindex++)
571                         au_set_h_fptr(file, bindex, NULL);
572         }
573
574 out:
575         return err;
576 }
577
578 /* common function to regular file and dir */
579 int au_reval_and_lock_fdi(struct file *file, int (*reopen)(struct file *file),
580                           int wlock)
581 {
582         int err;
583         unsigned int sigen, figen;
584         aufs_bindex_t bstart;
585         unsigned char pseudo_link;
586         struct dentry *dentry;
587         struct inode *inode;
588
589         err = 0;
590         dentry = file->f_dentry;
591         inode = dentry->d_inode;
592         AuDebugOn(au_special_file(inode->i_mode));
593         sigen = au_sigen(dentry->d_sb);
594         fi_write_lock(file);
595         figen = au_figen(file);
596         di_write_lock_child(dentry);
597         bstart = au_dbstart(dentry);
598         pseudo_link = (bstart != au_ibstart(inode));
599         if (sigen == figen && !pseudo_link && au_fbstart(file) == bstart) {
600                 if (!wlock) {
601                         di_downgrade_lock(dentry, AuLock_IR);
602                         fi_downgrade_lock(file);
603                 }
604                 goto out; /* success */
605         }
606
607         AuDbg("sigen %d, figen %d\n", sigen, figen);
608         if (au_digen_test(dentry, sigen)) {
609                 err = au_reval_dpath(dentry, sigen);
610                 AuDebugOn(!err && au_digen_test(dentry, sigen));
611         }
612
613         if (!err)
614                 err = refresh_file(file, reopen);
615         if (!err) {
616                 if (!wlock) {
617                         di_downgrade_lock(dentry, AuLock_IR);
618                         fi_downgrade_lock(file);
619                 }
620         } else {
621                 di_write_unlock(dentry);
622                 fi_write_unlock(file);
623         }
624
625 out:
626         return err;
627 }
628
629 /* ---------------------------------------------------------------------- */
630
631 /* cf. aufs_nopage() */
632 /* for madvise(2) */
633 static int aufs_readpage(struct file *file __maybe_unused, struct page *page)
634 {
635         unlock_page(page);
636         return 0;
637 }
638
639 /* it will never be called, but necessary to support O_DIRECT */
640 static ssize_t aufs_direct_IO(int rw, struct kiocb *iocb,
641                               const struct iovec *iov, loff_t offset,
642                               unsigned long nr_segs)
643 { BUG(); return 0; }
644
645 /*
646  * it will never be called, but madvise and fadvise behaves differently
647  * when get_xip_mem is defined
648  */
649 static int aufs_get_xip_mem(struct address_space *mapping, pgoff_t pgoff,
650                             int create, void **kmem, unsigned long *pfn)
651 { BUG(); return 0; }
652
653 /* they will never be called. */
654 #ifdef CONFIG_AUFS_DEBUG
655 static int aufs_write_begin(struct file *file, struct address_space *mapping,
656                             loff_t pos, unsigned len, unsigned flags,
657                             struct page **pagep, void **fsdata)
658 { AuUnsupport(); return 0; }
659 static int aufs_write_end(struct file *file, struct address_space *mapping,
660                           loff_t pos, unsigned len, unsigned copied,
661                           struct page *page, void *fsdata)
662 { AuUnsupport(); return 0; }
663 static int aufs_writepage(struct page *page, struct writeback_control *wbc)
664 { AuUnsupport(); return 0; }
665
666 static int aufs_set_page_dirty(struct page *page)
667 { AuUnsupport(); return 0; }
668 static void aufs_invalidatepage(struct page *page, unsigned long offset)
669 { AuUnsupport(); }
670 static int aufs_releasepage(struct page *page, gfp_t gfp)
671 { AuUnsupport(); return 0; }
672 static int aufs_migratepage(struct address_space *mapping, struct page *newpage,
673                             struct page *page, enum migrate_mode mode)
674 { AuUnsupport(); return 0; }
675 static int aufs_launder_page(struct page *page)
676 { AuUnsupport(); return 0; }
677 static int aufs_is_partially_uptodate(struct page *page,
678                                       read_descriptor_t *desc,
679                                       unsigned long from)
680 { AuUnsupport(); return 0; }
681 static int aufs_error_remove_page(struct address_space *mapping,
682                                   struct page *page)
683 { AuUnsupport(); return 0; }
684 #endif /* CONFIG_AUFS_DEBUG */
685
686 const struct address_space_operations aufs_aop = {
687         .readpage               = aufs_readpage,
688         .direct_IO              = aufs_direct_IO,
689         .get_xip_mem            = aufs_get_xip_mem,
690 #ifdef CONFIG_AUFS_DEBUG
691         .writepage              = aufs_writepage,
692         /* no writepages, because of writepage */
693         .set_page_dirty         = aufs_set_page_dirty,
694         /* no readpages, because of readpage */
695         .write_begin            = aufs_write_begin,
696         .write_end              = aufs_write_end,
697         /* no bmap, no block device */
698         .invalidatepage         = aufs_invalidatepage,
699         .releasepage            = aufs_releasepage,
700         .migratepage            = aufs_migratepage,
701         .launder_page           = aufs_launder_page,
702         .is_partially_uptodate  = aufs_is_partially_uptodate,
703         .error_remove_page      = aufs_error_remove_page
704 #endif /* CONFIG_AUFS_DEBUG */
705 };