2 * Copyright (C) 2005-2013 Junjiro R. Okajima
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.
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.
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
20 * sub-routines for dentry cache
23 #ifndef __AUFS_DCSUB_H__
24 #define __AUFS_DCSUB_H__
28 #include <linux/dcache.h>
35 struct dentry **dentries;
38 struct au_dcsub_pages {
40 struct au_dpage *dpages;
43 /* ---------------------------------------------------------------------- */
46 int au_dpages_init(struct au_dcsub_pages *dpages, gfp_t gfp);
47 void au_dpages_free(struct au_dcsub_pages *dpages);
48 typedef int (*au_dpages_test)(struct dentry *dentry, void *arg);
49 int au_dcsub_pages(struct au_dcsub_pages *dpages, struct dentry *root,
50 au_dpages_test test, void *arg);
51 int au_dcsub_pages_rev(struct au_dcsub_pages *dpages, struct dentry *dentry,
52 int do_include, au_dpages_test test, void *arg);
53 int au_dcsub_pages_rev_aufs(struct au_dcsub_pages *dpages,
54 struct dentry *dentry, int do_include);
55 int au_test_subdir(struct dentry *d1, struct dentry *d2);
57 /* ---------------------------------------------------------------------- */
59 static inline int au_d_hashed_positive(struct dentry *d)
62 struct inode *inode = d->d_inode;
64 if (unlikely(d_unhashed(d) || !inode || !inode->i_nlink))
69 static inline int au_d_alive(struct dentry *d)
75 err = au_d_hashed_positive(d);
78 if (unlikely(d_unlinked(d) || !inode || !inode->i_nlink))
84 static inline int au_alive_dir(struct dentry *d)
88 if (unlikely(err || IS_DEADDIR(d->d_inode)))
93 #endif /* __KERNEL__ */
94 #endif /* __AUFS_DCSUB_H__ */