mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Use inode_set_flags when available
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
This commit is contained in:
parent
c360af5411
commit
a5248129b8
18
config/kernel-inode-set-flags.m4
Normal file
18
config/kernel-inode-set-flags.m4
Normal file
@ -0,0 +1,18 @@
|
||||
dnl #
|
||||
dnl # 3.15 API change
|
||||
dnl # inode_set_flags introduced to set i_flags
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_INODE_SET_FLAGS], [
|
||||
AC_MSG_CHECKING([whether inode_set_flags() exists])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct inode inode;
|
||||
inode_set_flags(&inode, S_IMMUTABLE, S_IMMUTABLE);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INODE_SET_FLAGS, 1, [inode_set_flags() exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
@ -56,6 +56,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
||||
ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS
|
||||
ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
|
||||
ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
|
||||
ZFS_AC_KERNEL_INODE_SET_FLAGS
|
||||
ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
|
||||
ZFS_AC_KERNEL_SHOW_OPTIONS
|
||||
ZFS_AC_KERNEL_FILE_INODE
|
||||
|
@ -486,7 +486,15 @@ zfs_set_inode_flags(znode_t *zp, struct inode *ip)
|
||||
* Linux and Solaris have different sets of file attributes, so we
|
||||
* restrict this conversion to the intersection of the two.
|
||||
*/
|
||||
#ifdef HAVE_INODE_SET_FLAGS
|
||||
unsigned int flags = 0;
|
||||
if (zp->z_pflags & ZFS_IMMUTABLE)
|
||||
flags |= S_IMMUTABLE;
|
||||
if (zp->z_pflags & ZFS_APPENDONLY)
|
||||
flags |= S_APPEND;
|
||||
|
||||
inode_set_flags(ip, flags, S_IMMUTABLE|S_APPEND);
|
||||
#else
|
||||
if (zp->z_pflags & ZFS_IMMUTABLE)
|
||||
ip->i_flags |= S_IMMUTABLE;
|
||||
else
|
||||
@ -496,6 +504,7 @@ zfs_set_inode_flags(znode_t *zp, struct inode *ip)
|
||||
ip->i_flags |= S_APPEND;
|
||||
else
|
||||
ip->i_flags &= ~S_APPEND;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user