/
kern_feature.h
56 lines (46 loc) · 1.16 KB
/
kern_feature.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* kern_feature.h - Kernel dependent features
*
* Licensed under GPLv2: the complete text of the GNU General Public
* License can be found in COPYING file of the nilfs-kmod package.
*/
#ifndef NILFS_KERN_FEATURE_H
#define NILFS_KERN_FEATURE_H
#include <linux/version.h>
/*
* Please define as 0/1 here if you want to override
*/
/*
* for Red Hat Enterprise Linux 7.x (and clones like CentOS or SL)
*/
#if defined(RHEL_MAJOR) && (RHEL_MAJOR == 7)
# define HAVE_TRUNCATE_INODE_PAGES_FINAL 1
#endif
/*
* defaults
*/
/*
* defaults dependent to kernel versions
*/
#ifdef LINUX_VERSION_CODE
/*
* linux-3.15 and later kernels have truncate_inode_pages_final()
* and use it in ->evict_inode() implementation.
*/
#ifndef HAVE_TRUNCATE_INODE_PAGES_FINAL
# define HAVE_TRUNCATE_INODE_PAGES_FINAL \
(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
#endif
#endif /* LINUX_VERSION_CODE */
#include <linux/fs.h>
/*
* definitions dependent to above macros
*/
#if !HAVE_TRUNCATE_INODE_PAGES_FINAL
static inline void truncate_inode_pages_final(struct address_space *mapping)
{
if (mapping->nrpages)
truncate_inode_pages(mapping, 0);
}
#endif
#endif /* NILFS_KERN_FEATURE_H */