4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 2011, Lawrence Livermore National Security, LLC.
26 #include <sys/zfs_vfsops.h>
27 #include <sys/zfs_vnops.h>
28 #include <sys/zfs_znode.h>
33 zpl_inode_alloc(struct super_block
*sb
)
37 VERIFY3S(zfs_inode_alloc(sb
, &ip
), ==, 0);
44 zpl_inode_destroy(struct inode
*ip
)
46 ASSERT(atomic_read(&ip
->i_count
) == 0);
47 zfs_inode_destroy(ip
);
51 zpl_inode_delete(struct inode
*ip
)
53 loff_t oldsize
= i_size_read(ip
);
56 truncate_pagecache(ip
, oldsize
, 0);
61 zpl_evict_inode(struct inode
*ip
)
67 zpl_put_super(struct super_block
*sb
)
71 error
= -zfs_umount(sb
);
72 ASSERT3S(error
, <=, 0);
76 zpl_statfs(struct dentry
*dentry
, struct kstatfs
*statp
)
80 error
= -zfs_statvfs(dentry
, statp
);
81 ASSERT3S(error
, <=, 0);
87 zpl_show_options(struct seq_file
*seq
, struct vfsmount
*vfsp
)
89 struct super_block
*sb
= vfsp
->mnt_sb
;
90 zfs_sb_t
*zsb
= sb
->s_fs_info
;
93 * The Linux VFS automatically handles the following flags:
94 * MNT_NOSUID, MNT_NODEV, MNT_NOEXEC, MNT_NOATIME, MNT_READONLY
97 if (zsb
->z_flags
& ZSB_XATTR_USER
)
98 seq_printf(seq
, ",%s", "xattr");
104 zpl_fill_super(struct super_block
*sb
, void *data
, int silent
)
108 error
= -zfs_domount(sb
, data
, silent
);
109 ASSERT3S(error
, <=, 0);
115 zpl_get_sb(struct file_system_type
*fs_type
, int flags
,
116 const char *osname
, void *data
, struct vfsmount
*mnt
)
118 zpl_mount_data_t zmd
= { osname
, data
, mnt
};
120 return get_sb_nodev(fs_type
, flags
, &zmd
, zpl_fill_super
, mnt
);
124 zpl_kill_sb(struct super_block
*sb
)
127 zfs_sb_t
*zsb
= sb
->s_fs_info
;
129 if (zsb
&& dmu_objset_is_snapshot(zsb
->z_os
))
130 zfs_snap_destroy(zsb
);
131 #endif /* HAVE_SNAPSHOT */
136 const struct super_operations zpl_super_operations
= {
137 .alloc_inode
= zpl_inode_alloc
,
138 .destroy_inode
= zpl_inode_destroy
,
139 .delete_inode
= zpl_inode_delete
,
143 .clear_inode
= zpl_evict_inode
,
144 .put_super
= zpl_put_super
,
149 .statfs
= zpl_statfs
,
151 .show_options
= zpl_show_options
,
156 const struct export_operations zpl_export_operations
= {
157 .fh_to_dentry
= NULL
,
158 .fh_to_parent
= NULL
,
163 struct file_system_type zpl_fs_type
= {
164 .owner
= THIS_MODULE
,
166 .get_sb
= zpl_get_sb
,
167 .kill_sb
= zpl_kill_sb
,