]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - fs/aufs/dcsub.h
2 * Copyright (C) 2005-2016 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, see <http://www.gnu.org/licenses/>.
19 * sub-routines for dentry cache
22 #ifndef __AUFS_DCSUB_H__
23 #define __AUFS_DCSUB_H__
27 #include <linux/dcache.h>
32 struct dentry
**dentries
;
35 struct au_dcsub_pages
{
37 struct au_dpage
*dpages
;
40 /* ---------------------------------------------------------------------- */
43 int au_dpages_init(struct au_dcsub_pages
*dpages
, gfp_t gfp
);
44 void au_dpages_free(struct au_dcsub_pages
*dpages
);
45 typedef int (*au_dpages_test
)(struct dentry
*dentry
, void *arg
);
46 int au_dcsub_pages(struct au_dcsub_pages
*dpages
, struct dentry
*root
,
47 au_dpages_test test
, void *arg
);
48 int au_dcsub_pages_rev(struct au_dcsub_pages
*dpages
, struct dentry
*dentry
,
49 int do_include
, au_dpages_test test
, void *arg
);
50 int au_dcsub_pages_rev_aufs(struct au_dcsub_pages
*dpages
,
51 struct dentry
*dentry
, int do_include
);
52 int au_test_subdir(struct dentry
*d1
, struct dentry
*d2
);
54 /* ---------------------------------------------------------------------- */
57 * todo: in linux-3.13, several similar (but faster) helpers are added to
58 * include/linux/dcache.h. Try them (in the future).
61 static inline int au_d_hashed_positive(struct dentry
*d
)
64 struct inode
*inode
= d_inode(d
);
67 if (unlikely(d_unhashed(d
)
74 static inline int au_d_linkable(struct dentry
*d
)
77 struct inode
*inode
= d_inode(d
);
79 err
= au_d_hashed_positive(d
);
82 && (inode
->i_state
& I_LINKABLE
))
87 static inline int au_d_alive(struct dentry
*d
)
94 err
= au_d_hashed_positive(d
);
97 if (unlikely(d_unlinked(d
)
105 static inline int au_alive_dir(struct dentry
*d
)
110 if (unlikely(err
|| IS_DEADDIR(d_inode(d
))))
115 static inline int au_qstreq(struct qstr
*a
, struct qstr
*b
)
117 return a
->len
== b
->len
118 && !memcmp(a
->name
, b
->name
, a
->len
);
123 * 360f547 2015-01-25 dcache: let the dentry count go down to zero without
125 * the type of d_lockref.count became int, but the inlined function d_count()
126 * still returns unsigned int.
127 * I don't know why. Maybe it is for every d_count() users?
128 * Anyway au_dcount() lives on.
130 static inline int au_dcount(struct dentry
*d
)
132 return (int)d_count(d
);
135 #endif /* __KERNEL__ */
136 #endif /* __AUFS_DCSUB_H__ */