Compare commits
17 Commits
master
...
zfs-0.6.3-
Author | SHA1 | Date |
---|---|---|
|
ae18e03625 | |
|
fa2a39dbab | |
|
e5adebbb0f | |
|
4374e65bd9 | |
|
157f14abf8 | |
|
1817cb6dc6 | |
|
7b13354d55 | |
|
c3db49aedd | |
|
73fd1f4656 | |
|
a85804ecb5 | |
|
5b2926547f | |
|
107077a193 | |
|
c69e727898 | |
|
92428b6d56 | |
|
908a0c2822 | |
|
46bf86a963 | |
|
83a3269f59 |
2
META
2
META
|
@ -2,7 +2,7 @@ Meta: 1
|
|||
Name: zfs
|
||||
Branch: 1.0
|
||||
Version: 0.6.3
|
||||
Release: 1
|
||||
Release: 1.3
|
||||
Release-Tags: relext
|
||||
License: CDDL
|
||||
Author: Sun Microsystems/Oracle, Lawrence Livermore National Laboratory
|
||||
|
|
|
@ -1,22 +1,38 @@
|
|||
dnl #
|
||||
dnl # 2.6.34 API change
|
||||
dnl # The bdi_setup_and_register() helper function is avaliable and
|
||||
dnl # exported by the kernel. This is a trivial helper function but
|
||||
dnl # using it significantly simplifies the code surrounding setting
|
||||
dnl # up and tearing down the bdi structure.
|
||||
dnl # 2.6.32 - 2.6.33, bdi_setup_and_register() is not exported.
|
||||
dnl # 2.6.34 - 3.19, bdi_setup_and_register() takes 3 arguments.
|
||||
dnl # 4.0 - x.y, bdi_setup_and_register() takes 2 arguments.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER],
|
||||
[AC_MSG_CHECKING([whether bdi_setup_and_register() is available])
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER], [
|
||||
AC_MSG_CHECKING([whether bdi_setup_and_register() wants 2 args])
|
||||
ZFS_LINUX_TRY_COMPILE_SYMBOL([
|
||||
#include <linux/backing-dev.h>
|
||||
], [
|
||||
int r = bdi_setup_and_register(NULL, NULL, 0);
|
||||
r = *(&r);
|
||||
struct backing_dev_info bdi;
|
||||
char *name = "bdi";
|
||||
int error __attribute__((unused)) =
|
||||
bdi_setup_and_register(&bdi, name);
|
||||
], [bdi_setup_and_register], [mm/backing-dev.c], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BDI_SETUP_AND_REGISTER, 1,
|
||||
[bdi_setup_and_register() is available])
|
||||
AC_DEFINE(HAVE_2ARGS_BDI_SETUP_AND_REGISTER, 1,
|
||||
[bdi_setup_and_register() wants 2 args])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([whether bdi_setup_and_register() wants 3 args])
|
||||
ZFS_LINUX_TRY_COMPILE_SYMBOL([
|
||||
#include <linux/backing-dev.h>
|
||||
], [
|
||||
struct backing_dev_info bdi;
|
||||
char *name = "bdi";
|
||||
unsigned int cap = BDI_CAP_MAP_COPY;
|
||||
int error __attribute__((unused)) =
|
||||
bdi_setup_and_register(&bdi, name, cap);
|
||||
], [bdi_setup_and_register], [mm/backing-dev.c], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_3ARGS_BDI_SETUP_AND_REGISTER, 1,
|
||||
[bdi_setup_and_register() wants 3 args])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
dnl #
|
||||
dnl # 2.6.32 API change
|
||||
dnl # Private backing_device_info interfaces available
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BDI], [
|
||||
AC_MSG_CHECKING([whether super_block has s_bdi])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/fs.h>
|
||||
|
||||
static const struct super_block
|
||||
sb __attribute__ ((unused)) = {
|
||||
.s_bdi = NULL,
|
||||
};
|
||||
],[
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BDI, 1, [struct super_block has s_bdi])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
|
@ -0,0 +1,19 @@
|
|||
dnl #
|
||||
dnl # 3.19 API change
|
||||
dnl # struct access f->f_dentry->d_inode was replaced by accessor function
|
||||
dnl # file_inode(f)
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_FILE_INODE], [
|
||||
AC_MSG_CHECKING([whether file_inode() is available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct file *f = NULL;
|
||||
file_inode(f);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_FILE_INODE, 1, [file_inode() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
|
@ -60,6 +60,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
|||
ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
|
||||
ZFS_AC_KERNEL_CURRENT_UMASK
|
||||
ZFS_AC_KERNEL_SHOW_OPTIONS
|
||||
ZFS_AC_KERNEL_FILE_INODE
|
||||
ZFS_AC_KERNEL_FSYNC
|
||||
ZFS_AC_KERNEL_EVICT_INODE
|
||||
ZFS_AC_KERNEL_DIRTY_INODE_WITH_FLAGS
|
||||
|
@ -88,7 +89,6 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
|||
ZFS_AC_KERNEL_SHRINK
|
||||
ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD
|
||||
ZFS_AC_KERNEL_S_D_OP
|
||||
ZFS_AC_KERNEL_BDI
|
||||
ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER
|
||||
ZFS_AC_KERNEL_SET_NLINK
|
||||
ZFS_AC_KERNEL_ELEVATOR_CHANGE
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
/*
|
||||
* Copyright (C) 2011 Lawrence Livermore National Security, LLC.
|
||||
* Copyright (C) 2015 Jörg Thalheim.
|
||||
*/
|
||||
|
||||
#ifndef _ZFS_VFS_H
|
||||
|
@ -62,25 +63,35 @@ truncate_setsize(struct inode *ip, loff_t new)
|
|||
}
|
||||
#endif /* HAVE_TRUNCATE_SETSIZE */
|
||||
|
||||
#if defined(HAVE_BDI) && !defined(HAVE_BDI_SETUP_AND_REGISTER)
|
||||
/*
|
||||
* 2.6.34 API change,
|
||||
* Add bdi_setup_and_register() function if not yet provided by kernel.
|
||||
* It is used to quickly initialize and register a BDI for the filesystem.
|
||||
* 2.6.32 - 2.6.33, bdi_setup_and_register() is not available.
|
||||
* 2.6.34 - 3.19, bdi_setup_and_register() takes 3 arguments.
|
||||
* 4.0 - x.y, bdi_setup_and_register() takes 2 arguments.
|
||||
*/
|
||||
#if defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER)
|
||||
static inline int
|
||||
zpl_bdi_setup_and_register(struct backing_dev_info *bdi, char *name)
|
||||
{
|
||||
return (bdi_setup_and_register(bdi, name));
|
||||
}
|
||||
#elif defined(HAVE_3ARGS_BDI_SETUP_AND_REGISTER)
|
||||
static inline int
|
||||
zpl_bdi_setup_and_register(struct backing_dev_info *bdi, char *name)
|
||||
{
|
||||
return (bdi_setup_and_register(bdi, name, BDI_CAP_MAP_COPY));
|
||||
}
|
||||
#else
|
||||
extern atomic_long_t zfs_bdi_seq;
|
||||
|
||||
static inline int
|
||||
bdi_setup_and_register(
|
||||
struct backing_dev_info *bdi,
|
||||
char *name,
|
||||
unsigned int cap)
|
||||
zpl_bdi_setup_and_register(struct backing_dev_info *bdi, char *name)
|
||||
{
|
||||
char tmp[32];
|
||||
int error;
|
||||
|
||||
bdi->name = name;
|
||||
bdi->capabilities = cap;
|
||||
bdi->capabilities = BDI_CAP_MAP_COPY;
|
||||
|
||||
error = bdi_init(bdi);
|
||||
if (error)
|
||||
return (error);
|
||||
|
@ -95,7 +106,7 @@ bdi_setup_and_register(
|
|||
|
||||
return (error);
|
||||
}
|
||||
#endif /* HAVE_BDI && !HAVE_BDI_SETUP_AND_REGISTER */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 2.6.38 API change,
|
||||
|
@ -326,4 +337,16 @@ current_umask(void)
|
|||
#define zpl_inode_owner_or_capable(ip) is_owner_or_cap(ip)
|
||||
#endif /* HAVE_INODE_OWNER_OR_CAPABLE */
|
||||
|
||||
/*
|
||||
* 3.19 API change
|
||||
* struct access f->f_dentry->d_inode was replaced by accessor function
|
||||
* file_inode(f)
|
||||
*/
|
||||
#ifndef HAVE_FILE_INODE
|
||||
static inline struct inode *file_inode(const struct file *f)
|
||||
{
|
||||
return (f->f_dentry->d_inode);
|
||||
}
|
||||
#endif /* HAVE_FILE_INODE */
|
||||
|
||||
#endif /* _ZFS_VFS_H */
|
||||
|
|
|
@ -337,6 +337,7 @@ extern void zfs_znode_dmu_fini(znode_t *);
|
|||
extern int zfs_inode_alloc(struct super_block *, struct inode **ip);
|
||||
extern void zfs_inode_destroy(struct inode *);
|
||||
extern void zfs_inode_update(znode_t *);
|
||||
extern void zfs_mark_inode_dirty(struct inode *);
|
||||
|
||||
extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
|
||||
znode_t *dzp, znode_t *zp, char *name, vsecattr_t *, zfs_fuid_info_t *,
|
||||
|
|
|
@ -459,7 +459,6 @@ extern void zil_replay(objset_t *os, void *arg,
|
|||
extern boolean_t zil_replaying(zilog_t *zilog, dmu_tx_t *tx);
|
||||
extern void zil_destroy(zilog_t *zilog, boolean_t keep_first);
|
||||
extern void zil_destroy_sync(zilog_t *zilog, dmu_tx_t *tx);
|
||||
extern void zil_rollback_destroy(zilog_t *zilog, dmu_tx_t *tx);
|
||||
|
||||
extern itx_t *zil_itx_create(uint64_t txtype, size_t lrsize);
|
||||
extern void zil_itx_destroy(itx_t *itx);
|
||||
|
|
|
@ -42,8 +42,6 @@
|
|||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define ZPIOS_MAJOR 232 /* XXX - Arbitrary */
|
||||
#define ZPIOS_MINORS 1
|
||||
#define ZPIOS_NAME "zpios"
|
||||
#define ZPIOS_DEV "/dev/zpios"
|
||||
|
||||
|
|
|
@ -2590,27 +2590,39 @@ arc_evictable_memory(void) {
|
|||
return (ghost_clean + MAX((int64_t)arc_size - (int64_t)arc_c_min, 0));
|
||||
}
|
||||
|
||||
static int
|
||||
/*
|
||||
* If sc->nr_to_scan is zero, the caller is requesting a query of the
|
||||
* number of objects which can potentially be freed. If it is nonzero,
|
||||
* the request is to free that many objects.
|
||||
*
|
||||
* Linux kernels >= 3.12 have the count_objects and scan_objects callbacks
|
||||
* in struct shrinker and also require the shrinker to return the number
|
||||
* of objects freed.
|
||||
*
|
||||
* Older kernels require the shrinker to return the number of freeable
|
||||
* objects following the freeing of nr_to_free.
|
||||
*/
|
||||
static spl_shrinker_t
|
||||
__arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc)
|
||||
{
|
||||
uint64_t pages;
|
||||
int64_t pages;
|
||||
|
||||
/* The arc is considered warm once reclaim has occurred */
|
||||
if (unlikely(arc_warm == B_FALSE))
|
||||
arc_warm = B_TRUE;
|
||||
|
||||
/* Return the potential number of reclaimable pages */
|
||||
pages = btop(arc_evictable_memory());
|
||||
pages = btop((int64_t)arc_evictable_memory());
|
||||
if (sc->nr_to_scan == 0)
|
||||
return (pages);
|
||||
|
||||
/* Not allowed to perform filesystem reclaim */
|
||||
if (!(sc->gfp_mask & __GFP_FS))
|
||||
return (-1);
|
||||
return (SHRINK_STOP);
|
||||
|
||||
/* Reclaim in progress */
|
||||
if (mutex_tryenter(&arc_reclaim_thr_lock) == 0)
|
||||
return (-1);
|
||||
return (SHRINK_STOP);
|
||||
|
||||
/*
|
||||
* Evict the requested number of pages by shrinking arc_c the
|
||||
|
@ -2619,10 +2631,15 @@ __arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc)
|
|||
*/
|
||||
if (pages > 0) {
|
||||
arc_kmem_reap_now(ARC_RECLAIM_AGGR, ptob(sc->nr_to_scan));
|
||||
|
||||
#ifdef HAVE_SPLIT_SHRINKER_CALLBACK
|
||||
pages = MAX(pages - btop(arc_evictable_memory()), 0);
|
||||
#else
|
||||
pages = btop(arc_evictable_memory());
|
||||
#endif
|
||||
} else {
|
||||
arc_kmem_reap_now(ARC_RECLAIM_CONS, ptob(sc->nr_to_scan));
|
||||
pages = -1;
|
||||
pages = SHRINK_STOP;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5602,6 +5619,8 @@ l2arc_stop(void)
|
|||
}
|
||||
|
||||
#if defined(_KERNEL) && defined(HAVE_SPL)
|
||||
EXPORT_SYMBOL(arc_buf_size);
|
||||
EXPORT_SYMBOL(arc_write);
|
||||
EXPORT_SYMBOL(arc_read);
|
||||
EXPORT_SYMBOL(arc_buf_remove_ref);
|
||||
EXPORT_SYMBOL(arc_buf_info);
|
||||
|
|
|
@ -875,15 +875,18 @@ dbuf_free_range(dnode_t *dn, uint64_t start, uint64_t end, dmu_tx_t *tx)
|
|||
int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT;
|
||||
uint64_t first_l1 = start >> epbs;
|
||||
uint64_t last_l1 = end >> epbs;
|
||||
boolean_t freespill =
|
||||
(start == DMU_SPILL_BLKID || end == DMU_SPILL_BLKID);
|
||||
|
||||
if (end > dn->dn_maxblkid && (end != DMU_SPILL_BLKID)) {
|
||||
if (end > dn->dn_maxblkid && !freespill) {
|
||||
end = dn->dn_maxblkid;
|
||||
last_l1 = end >> epbs;
|
||||
}
|
||||
dprintf_dnode(dn, "start=%llu end=%llu\n", start, end);
|
||||
|
||||
mutex_enter(&dn->dn_dbufs_mtx);
|
||||
if (start >= dn->dn_unlisted_l0_blkid * dn->dn_datablksz) {
|
||||
if (start >= dn->dn_unlisted_l0_blkid * dn->dn_datablksz &&
|
||||
!freespill) {
|
||||
/* There can't be any dbufs in this range; no need to search. */
|
||||
mutex_exit(&dn->dn_dbufs_mtx);
|
||||
return;
|
||||
|
@ -919,7 +922,7 @@ dbuf_free_range(dnode_t *dn, uint64_t start, uint64_t end, dmu_tx_t *tx)
|
|||
if (db->db_level != 0)
|
||||
continue;
|
||||
dprintf_dbuf(db, "found buf %s\n", "");
|
||||
if (db->db_blkid < start || db->db_blkid > end)
|
||||
if ((db->db_blkid < start || db->db_blkid > end) && !freespill)
|
||||
continue;
|
||||
|
||||
/* found a level 0 buffer in the range */
|
||||
|
@ -2968,4 +2971,5 @@ EXPORT_SYMBOL(dmu_buf_set_user_ie);
|
|||
EXPORT_SYMBOL(dmu_buf_update_user);
|
||||
EXPORT_SYMBOL(dmu_buf_get_user);
|
||||
EXPORT_SYMBOL(dmu_buf_freeable);
|
||||
EXPORT_SYMBOL(dmu_buf_get_blkptr);
|
||||
#endif
|
||||
|
|
|
@ -1162,7 +1162,8 @@ zfs_acl_chown_setattr(znode_t *zp)
|
|||
ASSERT(MUTEX_HELD(&zp->z_lock));
|
||||
ASSERT(MUTEX_HELD(&zp->z_acl_lock));
|
||||
|
||||
if ((error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE)) == 0)
|
||||
error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE);
|
||||
if (error == 0 && aclp->z_acl_count > 0)
|
||||
zp->z_mode = zfs_mode_compute(zp->z_mode, aclp,
|
||||
&zp->z_pflags, zp->z_uid, zp->z_gid);
|
||||
|
||||
|
|
|
@ -1073,7 +1073,7 @@ zfs_root(zfs_sb_t *zsb, struct inode **ipp)
|
|||
}
|
||||
EXPORT_SYMBOL(zfs_root);
|
||||
|
||||
#ifdef HAVE_SHRINK
|
||||
#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK)
|
||||
int
|
||||
zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects)
|
||||
{
|
||||
|
@ -1085,13 +1085,17 @@ zfs_sb_prune(struct super_block *sb, unsigned long nr_to_scan, int *objects)
|
|||
};
|
||||
|
||||
ZFS_ENTER(zsb);
|
||||
#ifdef HAVE_SPLIT_SHRINKER_CALLBACK
|
||||
*objects = (*shrinker->scan_objects)(shrinker, &sc);
|
||||
#else
|
||||
*objects = (*shrinker->shrink)(shrinker, &sc);
|
||||
#endif
|
||||
ZFS_EXIT(zsb);
|
||||
|
||||
return (0);
|
||||
}
|
||||
EXPORT_SYMBOL(zfs_sb_prune);
|
||||
#endif /* HAVE_SHRINK */
|
||||
#endif /* defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK) */
|
||||
|
||||
/*
|
||||
* Teardown the zfs_sb_t.
|
||||
|
@ -1199,9 +1203,10 @@ zfs_sb_teardown(zfs_sb_t *zsb, boolean_t unmounting)
|
|||
}
|
||||
EXPORT_SYMBOL(zfs_sb_teardown);
|
||||
|
||||
#if defined(HAVE_BDI) && !defined(HAVE_BDI_SETUP_AND_REGISTER)
|
||||
#if !defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER) && \
|
||||
!defined(HAVE_3ARGS_BDI_SETUP_AND_REGISTER)
|
||||
atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0);
|
||||
#endif /* HAVE_BDI && !HAVE_BDI_SETUP_AND_REGISTER */
|
||||
#endif
|
||||
|
||||
int
|
||||
zfs_domount(struct super_block *sb, void *data, int silent)
|
||||
|
@ -1228,23 +1233,12 @@ zfs_domount(struct super_block *sb, void *data, int silent)
|
|||
sb->s_time_gran = 1;
|
||||
sb->s_blocksize = recordsize;
|
||||
sb->s_blocksize_bits = ilog2(recordsize);
|
||||
|
||||
#ifdef HAVE_BDI
|
||||
/*
|
||||
* 2.6.32 API change,
|
||||
* Added backing_device_info (BDI) per super block interfaces. A BDI
|
||||
* must be configured when using a non-device backed filesystem for
|
||||
* proper writeback. This is not required for older pdflush kernels.
|
||||
*
|
||||
* NOTE: Linux read-ahead is disabled in favor of zfs read-ahead.
|
||||
*/
|
||||
zsb->z_bdi.ra_pages = 0;
|
||||
sb->s_bdi = &zsb->z_bdi;
|
||||
|
||||
error = -bdi_setup_and_register(&zsb->z_bdi, "zfs", BDI_CAP_MAP_COPY);
|
||||
error = -zpl_bdi_setup_and_register(&zsb->z_bdi, "zfs");
|
||||
if (error)
|
||||
goto out;
|
||||
#endif /* HAVE_BDI */
|
||||
|
||||
/* Set callback operations for the file system. */
|
||||
sb->s_op = &zpl_super_operations;
|
||||
|
@ -1337,10 +1331,7 @@ zfs_umount(struct super_block *sb)
|
|||
|
||||
VERIFY(zfs_sb_teardown(zsb, B_TRUE) == 0);
|
||||
os = zsb->z_os;
|
||||
|
||||
#ifdef HAVE_BDI
|
||||
bdi_destroy(sb->s_bdi);
|
||||
#endif /* HAVE_BDI */
|
||||
|
||||
/*
|
||||
* z_os will be NULL if there was an error in
|
||||
|
|
|
@ -470,15 +470,6 @@ zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
|
|||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for mandatory locks
|
||||
*/
|
||||
if (mandatory_lock(ip) &&
|
||||
!lock_may_read(ip, uio->uio_loffset, uio->uio_resid)) {
|
||||
ZFS_EXIT(zsb);
|
||||
return (SET_ERROR(EAGAIN));
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're in FRSYNC mode, sync out this znode before reading it.
|
||||
*/
|
||||
|
@ -647,15 +638,6 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
|
|||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for mandatory locks before calling zfs_range_lock()
|
||||
* in order to prevent a deadlock with locks set via fcntl().
|
||||
*/
|
||||
if (mandatory_lock(ip) && !lock_may_write(ip, woff, n)) {
|
||||
ZFS_EXIT(zsb);
|
||||
return (SET_ERROR(EAGAIN));
|
||||
}
|
||||
|
||||
/*
|
||||
* Pre-fault the pages to ensure slow (eg NFS) pages
|
||||
* don't hold up txg.
|
||||
|
@ -3965,7 +3947,8 @@ zfs_putpage(struct inode *ip, struct page *pp, struct writeback_control *wbc)
|
|||
* writepages() normally handles the entire commit for
|
||||
* performance reasons.
|
||||
*/
|
||||
zil_commit(zsb->z_log, zp->z_id);
|
||||
if (zsb->z_log != NULL)
|
||||
zil_commit(zsb->z_log, zp->z_id);
|
||||
}
|
||||
|
||||
ZFS_EXIT(zsb);
|
||||
|
|
|
@ -511,6 +511,21 @@ zfs_inode_update(znode_t *zp)
|
|||
spin_unlock(&ip->i_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Safely mark an inode dirty. Inodes which are part of a read-only
|
||||
* file system or snapshot may not be dirtied.
|
||||
*/
|
||||
void
|
||||
zfs_mark_inode_dirty(struct inode *ip)
|
||||
{
|
||||
zfs_sb_t *zsb = ITOZSB(ip);
|
||||
|
||||
if (zfs_is_readonly(zsb) || dmu_objset_is_snapshot(zsb->z_os))
|
||||
return;
|
||||
|
||||
mark_inode_dirty(ip);
|
||||
}
|
||||
|
||||
static uint64_t empty_xattr;
|
||||
static uint64_t pad[4];
|
||||
static zfs_acl_phys_t acl_phys;
|
||||
|
@ -1456,7 +1471,6 @@ top:
|
|||
int
|
||||
zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
|
||||
{
|
||||
struct inode *ip = ZTOI(zp);
|
||||
dmu_tx_t *tx;
|
||||
zfs_sb_t *zsb = ZTOZSB(zp);
|
||||
zilog_t *zilog = zsb->z_log;
|
||||
|
@ -1478,15 +1492,6 @@ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
|
|||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for any locks in the region to be freed.
|
||||
*/
|
||||
if (ip->i_flock && mandatory_lock(ip)) {
|
||||
uint64_t length = (len ? len : zp->z_size - off);
|
||||
if (!lock_may_write(ip, off, length))
|
||||
return (SET_ERROR(EAGAIN));
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
error = zfs_trunc(zp, off);
|
||||
} else {
|
||||
|
|
|
@ -2237,6 +2237,30 @@ zil_vdev_offline(const char *osname, void *arg)
|
|||
}
|
||||
|
||||
#if defined(_KERNEL) && defined(HAVE_SPL)
|
||||
EXPORT_SYMBOL(zil_alloc);
|
||||
EXPORT_SYMBOL(zil_free);
|
||||
EXPORT_SYMBOL(zil_open);
|
||||
EXPORT_SYMBOL(zil_close);
|
||||
EXPORT_SYMBOL(zil_replay);
|
||||
EXPORT_SYMBOL(zil_replaying);
|
||||
EXPORT_SYMBOL(zil_destroy);
|
||||
EXPORT_SYMBOL(zil_destroy_sync);
|
||||
EXPORT_SYMBOL(zil_itx_create);
|
||||
EXPORT_SYMBOL(zil_itx_destroy);
|
||||
EXPORT_SYMBOL(zil_itx_assign);
|
||||
EXPORT_SYMBOL(zil_commit);
|
||||
EXPORT_SYMBOL(zil_vdev_offline);
|
||||
EXPORT_SYMBOL(zil_claim);
|
||||
EXPORT_SYMBOL(zil_check_log_chain);
|
||||
EXPORT_SYMBOL(zil_sync);
|
||||
EXPORT_SYMBOL(zil_clean);
|
||||
EXPORT_SYMBOL(zil_suspend);
|
||||
EXPORT_SYMBOL(zil_resume);
|
||||
EXPORT_SYMBOL(zil_add_block);
|
||||
EXPORT_SYMBOL(zil_bp_tree_add);
|
||||
EXPORT_SYMBOL(zil_set_sync);
|
||||
EXPORT_SYMBOL(zil_set_logbias);
|
||||
|
||||
module_param(zil_replay_disable, int, 0644);
|
||||
MODULE_PARM_DESC(zil_replay_disable, "Disable intent logging replay");
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ zpl_release(struct inode *ip, struct file *filp)
|
|||
int error;
|
||||
|
||||
if (ITOZ(ip)->z_atime_dirty)
|
||||
mark_inode_dirty(ip);
|
||||
zfs_mark_inode_dirty(ip);
|
||||
|
||||
crhold(cr);
|
||||
error = -zfs_close(ip, filp->f_flags, cr);
|
||||
|
@ -445,7 +445,8 @@ zpl_writepages(struct address_space *mapping, struct writeback_control *wbc)
|
|||
if (sync_mode != wbc->sync_mode) {
|
||||
ZFS_ENTER(zsb);
|
||||
ZFS_VERIFY_ZP(zp);
|
||||
zil_commit(zsb->z_log, zp->z_id);
|
||||
if (zsb->z_log != NULL)
|
||||
zil_commit(zsb->z_log, zp->z_id);
|
||||
ZFS_EXIT(zsb);
|
||||
|
||||
/*
|
||||
|
@ -527,7 +528,7 @@ zpl_fallocate(struct file *filp, int mode, loff_t offset, loff_t len)
|
|||
static int
|
||||
zpl_ioctl_getflags(struct file *filp, void __user *arg)
|
||||
{
|
||||
struct inode *ip = filp->f_dentry->d_inode;
|
||||
struct inode *ip = file_inode(filp);
|
||||
unsigned int ioctl_flags = 0;
|
||||
uint64_t zfs_flags = ITOZ(ip)->z_pflags;
|
||||
int error;
|
||||
|
@ -563,7 +564,7 @@ zpl_ioctl_getflags(struct file *filp, void __user *arg)
|
|||
static int
|
||||
zpl_ioctl_setflags(struct file *filp, void __user *arg)
|
||||
{
|
||||
struct inode *ip = filp->f_dentry->d_inode;
|
||||
struct inode *ip = file_inode(filp);
|
||||
uint64_t zfs_flags = ITOZ(ip)->z_pflags;
|
||||
unsigned int ioctl_flags;
|
||||
cred_t *cr = CRED();
|
||||
|
|
|
@ -268,7 +268,7 @@ zpl_kill_sb(struct super_block *sb)
|
|||
#endif /* HAVE_S_INSTANCES_LIST_HEAD */
|
||||
}
|
||||
|
||||
#ifdef HAVE_SHRINK
|
||||
#if defined(HAVE_SHRINK) || defined(HAVE_SPLIT_SHRINKER_CALLBACK)
|
||||
/*
|
||||
* Linux 3.1 - 3.x API
|
||||
*
|
||||
|
|
|
@ -751,7 +751,7 @@ zpl_set_acl(struct inode *ip, int type, struct posix_acl *acl)
|
|||
if (ip->i_mode != mode) {
|
||||
ip->i_mode = mode;
|
||||
ip->i_ctime = current_fs_time(sb);
|
||||
mark_inode_dirty(ip);
|
||||
zfs_mark_inode_dirty(ip);
|
||||
}
|
||||
|
||||
if (error == 0)
|
||||
|
@ -909,7 +909,7 @@ zpl_init_acl(struct inode *ip, struct inode *dir)
|
|||
if (!acl) {
|
||||
ip->i_mode &= ~current_umask();
|
||||
ip->i_ctime = current_fs_time(ITOZSB(ip)->z_sb);
|
||||
mark_inode_dirty(ip);
|
||||
zfs_mark_inode_dirty(ip);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
@ -927,7 +927,7 @@ zpl_init_acl(struct inode *ip, struct inode *dir)
|
|||
error = __posix_acl_create(&acl, GFP_KERNEL, &mode);
|
||||
if (error >= 0) {
|
||||
ip->i_mode = mode;
|
||||
mark_inode_dirty(ip);
|
||||
zfs_mark_inode_dirty(ip);
|
||||
if (error > 0)
|
||||
error = zpl_set_acl(ip, ACL_TYPE_ACCESS, acl);
|
||||
}
|
||||
|
|
|
@ -35,12 +35,10 @@
|
|||
#include <sys/dmu.h>
|
||||
#include <sys/txg.h>
|
||||
#include <sys/dsl_destroy.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include "zpios-internal.h"
|
||||
|
||||
|
||||
static spl_class *zpios_class;
|
||||
static spl_device *zpios_device;
|
||||
static char *zpios_tag = "zpios_tag";
|
||||
|
||||
static int
|
||||
|
@ -928,12 +926,8 @@ cleanup:
|
|||
static int
|
||||
zpios_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
unsigned int minor = iminor(inode);
|
||||
zpios_info_t *info;
|
||||
|
||||
if (minor >= ZPIOS_MINORS)
|
||||
return (-ENXIO);
|
||||
|
||||
info = (zpios_info_t *)kmem_alloc(sizeof (*info), KM_SLEEP);
|
||||
if (info == NULL)
|
||||
return (-ENOMEM);
|
||||
|
@ -956,12 +950,8 @@ zpios_open(struct inode *inode, struct file *file)
|
|||
static int
|
||||
zpios_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
unsigned int minor = iminor(inode);
|
||||
zpios_info_t *info = (zpios_info_t *)file->private_data;
|
||||
|
||||
if (minor >= ZPIOS_MINORS)
|
||||
return (-ENXIO);
|
||||
|
||||
ASSERT(info);
|
||||
ASSERT(info->info_buffer);
|
||||
|
||||
|
@ -1143,16 +1133,12 @@ out_cmd:
|
|||
static long
|
||||
zpios_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
unsigned int minor = iminor(file->f_dentry->d_inode);
|
||||
int rc = 0;
|
||||
|
||||
/* Ignore tty ioctls */
|
||||
if ((cmd & 0xffffff00) == ((int)'T') << 8)
|
||||
return (-ENOTTY);
|
||||
|
||||
if (minor >= ZPIOS_MINORS)
|
||||
return (-ENXIO);
|
||||
|
||||
switch (cmd) {
|
||||
case ZPIOS_CFG:
|
||||
rc = zpios_ioctl_cfg(file, arg);
|
||||
|
@ -1187,13 +1173,9 @@ static ssize_t
|
|||
zpios_write(struct file *file, const char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
unsigned int minor = iminor(file->f_dentry->d_inode);
|
||||
zpios_info_t *info = (zpios_info_t *)file->private_data;
|
||||
int rc = 0;
|
||||
|
||||
if (minor >= ZPIOS_MINORS)
|
||||
return (-ENXIO);
|
||||
|
||||
ASSERT(info);
|
||||
ASSERT(info->info_buffer);
|
||||
|
||||
|
@ -1224,13 +1206,9 @@ out:
|
|||
static ssize_t
|
||||
zpios_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
unsigned int minor = iminor(file->f_dentry->d_inode);
|
||||
zpios_info_t *info = (zpios_info_t *)file->private_data;
|
||||
int rc = 0;
|
||||
|
||||
if (minor >= ZPIOS_MINORS)
|
||||
return (-ENXIO);
|
||||
|
||||
ASSERT(info);
|
||||
ASSERT(info->info_buffer);
|
||||
|
||||
|
@ -1258,13 +1236,9 @@ out:
|
|||
|
||||
static loff_t zpios_seek(struct file *file, loff_t offset, int origin)
|
||||
{
|
||||
unsigned int minor = iminor(file->f_dentry->d_inode);
|
||||
zpios_info_t *info = (zpios_info_t *)file->private_data;
|
||||
int rc = -EINVAL;
|
||||
|
||||
if (minor >= ZPIOS_MINORS)
|
||||
return (-ENXIO);
|
||||
|
||||
ASSERT(info);
|
||||
ASSERT(info->info_buffer);
|
||||
|
||||
|
@ -1292,7 +1266,6 @@ static loff_t zpios_seek(struct file *file, loff_t offset, int origin)
|
|||
return (rc);
|
||||
}
|
||||
|
||||
static struct cdev zpios_cdev;
|
||||
static struct file_operations zpios_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = zpios_open,
|
||||
|
@ -1306,55 +1279,45 @@ static struct file_operations zpios_fops = {
|
|||
.llseek = zpios_seek,
|
||||
};
|
||||
|
||||
static struct miscdevice zpios_misc = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = ZPIOS_NAME,
|
||||
.fops = &zpios_fops,
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ZFS_DEBUG_STR " (DEBUG mode)"
|
||||
#else
|
||||
#define ZFS_DEBUG_STR ""
|
||||
#endif
|
||||
|
||||
static int
|
||||
zpios_init(void)
|
||||
{
|
||||
dev_t dev;
|
||||
int rc;
|
||||
int error;
|
||||
|
||||
dev = MKDEV(ZPIOS_MAJOR, 0);
|
||||
if ((rc = register_chrdev_region(dev, ZPIOS_MINORS, ZPIOS_NAME)))
|
||||
goto error;
|
||||
|
||||
/* Support for registering a character driver */
|
||||
cdev_init(&zpios_cdev, &zpios_fops);
|
||||
zpios_cdev.owner = THIS_MODULE;
|
||||
kobject_set_name(&zpios_cdev.kobj, ZPIOS_NAME);
|
||||
if ((rc = cdev_add(&zpios_cdev, dev, ZPIOS_MINORS))) {
|
||||
printk(KERN_ERR "ZPIOS: Error adding cdev, %d\n", rc);
|
||||
kobject_put(&zpios_cdev.kobj);
|
||||
unregister_chrdev_region(dev, ZPIOS_MINORS);
|
||||
goto error;
|
||||
error = misc_register(&zpios_misc);
|
||||
if (error) {
|
||||
printk(KERN_INFO "ZPIOS: misc_register() failed %d\n", error);
|
||||
} else {
|
||||
printk(KERN_INFO "ZPIOS: Loaded module v%s-%s%s\n",
|
||||
ZFS_META_VERSION, ZFS_META_RELEASE, ZFS_DEBUG_STR);
|
||||
}
|
||||
|
||||
/* Support for udev make driver info available in sysfs */
|
||||
zpios_class = spl_class_create(THIS_MODULE, ZPIOS_NAME);
|
||||
if (IS_ERR(zpios_class)) {
|
||||
rc = PTR_ERR(zpios_class);
|
||||
printk(KERN_ERR "ZPIOS: Error creating zpios class, %d\n", rc);
|
||||
cdev_del(&zpios_cdev);
|
||||
unregister_chrdev_region(dev, ZPIOS_MINORS);
|
||||
goto error;
|
||||
}
|
||||
|
||||
zpios_device = spl_device_create(zpios_class, NULL,
|
||||
dev, NULL, ZPIOS_NAME);
|
||||
|
||||
return (0);
|
||||
error:
|
||||
printk(KERN_ERR "ZPIOS: Error registering zpios device, %d\n", rc);
|
||||
return (rc);
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
zpios_fini(void)
|
||||
{
|
||||
dev_t dev = MKDEV(ZPIOS_MAJOR, 0);
|
||||
int error;
|
||||
|
||||
spl_device_destroy(zpios_class, zpios_device, dev);
|
||||
spl_class_destroy(zpios_class);
|
||||
cdev_del(&zpios_cdev);
|
||||
unregister_chrdev_region(dev, ZPIOS_MINORS);
|
||||
error = misc_deregister(&zpios_misc);
|
||||
if (error)
|
||||
printk(KERN_INFO "ZPIOS: misc_deregister() failed %d\n", error);
|
||||
|
||||
printk(KERN_INFO "ZPIOS: Unloaded module v%s-%s%s\n",
|
||||
ZFS_META_VERSION, ZFS_META_RELEASE, ZFS_DEBUG_STR);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ Group: System Environment/Kernel
|
|||
This package contains the zpool library, which provides support
|
||||
for managing zpools
|
||||
|
||||
%post-n libzpool2 -p /sbin/ldconfig
|
||||
%post -n libzpool2 -p /sbin/ldconfig
|
||||
%postun -n libzpool2 -p /sbin/ldconfig
|
||||
|
||||
%package -n libnvpair1
|
||||
|
@ -119,7 +119,7 @@ pairs. This functionality is used to portably transport data across
|
|||
process boundaries, between kernel and user space, and can be used
|
||||
to write self describing data structures on disk.
|
||||
|
||||
%post-n libnvpair1 -p /sbin/ldconfig
|
||||
%post -n libnvpair1 -p /sbin/ldconfig
|
||||
%postun -n libnvpair1 -p /sbin/ldconfig
|
||||
|
||||
%package -n libuutil1
|
||||
|
@ -137,7 +137,7 @@ This library provides a variety of compatibility functions for ZFS on Linux:
|
|||
partitioning.
|
||||
* libshare: NFS, SMB, and iSCSI service integration for ZFS.
|
||||
|
||||
%post-n libuutil1 -p /sbin/ldconfig
|
||||
%post -n libuutil1 -p /sbin/ldconfig
|
||||
%postun -n libuutil1 -p /sbin/ldconfig
|
||||
|
||||
%package -n libzfs2
|
||||
|
@ -147,7 +147,7 @@ Group: System Environment/Kernel
|
|||
%description -n libzfs2
|
||||
This package provides support for managing ZFS filesystems
|
||||
|
||||
%post-n libzfs2 -p /sbin/ldconfig
|
||||
%post -n libzfs2 -p /sbin/ldconfig
|
||||
%postun -n libzfs2 -p /sbin/ldconfig
|
||||
|
||||
%package -n libzfs2-devel
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SUBDIRS = zpool-config zpios-test zpios-profile
|
||||
|
||||
EXTRA_DIST = dkms.mkconf dkms.postinst kmodtool zfs2zol-patch.sed cstyle.pl
|
||||
EXTRA_DIST = dkms.mkconf dkms.postbuild kmodtool zfs2zol-patch.sed cstyle.pl
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
dist_pkgdata_SCRIPTS = \
|
||||
|
|
|
@ -27,7 +27,7 @@ PRE_BUILD="configure
|
|||
--with-config=kernel
|
||||
--with-linux=\${kernel_source_dir}
|
||||
--with-linux-obj=\${kernel_source_dir}
|
||||
--with-spl=\${dkms_tree}/spl/\${PACKAGE_VERSION}/build
|
||||
--with-spl=\${source_tree}/spl-\${PACKAGE_VERSION}
|
||||
--with-spl-obj=\${dkms_tree}/spl/\${PACKAGE_VERSION}/\${kernelver}/\${arch}
|
||||
--with-spl-timeout=300
|
||||
\$(
|
||||
|
@ -47,7 +47,7 @@ PRE_BUILD="configure
|
|||
}
|
||||
)
|
||||
"
|
||||
POST_INSTALL="scripts/dkms.postinst
|
||||
POST_BUILD="scripts/dkms.postbuild
|
||||
-n \${PACKAGE_NAME}
|
||||
-v \${PACKAGE_VERSION}
|
||||
-a \${arch}
|
||||
|
|
Loading…
Reference in New Issue