Skip to content

Commit

Permalink
Merge branch 'zfs_master_03.03.2015' into zfs_kOT_03.03.2015
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelOfTruth committed Mar 3, 2015
2 parents e3c68e3 + 989fd51 commit c8d7193
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 69 deletions.
36 changes: 25 additions & 11 deletions config/kernel-bdi-setup-and-register.m4
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
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";
(void) 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;
(void) 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)
])
])
])
21 changes: 0 additions & 21 deletions config/kernel-bdi.m4

This file was deleted.

1 change: 0 additions & 1 deletion config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,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
Expand Down
30 changes: 20 additions & 10 deletions include/linux/vfs_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,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);
Expand All @@ -98,7 +108,7 @@ bdi_setup_and_register(

return (error);
}
#endif /* HAVE_BDI && !HAVE_BDI_SETUP_AND_REGISTER */
#endif

/*
* 2.6.38 API change,
Expand Down
1 change: 1 addition & 0 deletions include/sys/zfs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ typedef struct kmutex {
} kmutex_t;

#define MUTEX_DEFAULT 0
#define MUTEX_FSTRANS MUTEX_DEFAULT
#define MUTEX_HELD(m) ((m)->m_owner == curthread)
#define MUTEX_NOT_HELD(m) (!MUTEX_HELD(m))

Expand Down
2 changes: 1 addition & 1 deletion module/zcommon/zfs_deleg.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type,
ZFS_DELEG_FIELD_SEP_CHR);
break;
default:
ASSERT(!"bad zfs_deleg_who_type_t");
cmn_err(CE_PANIC, "bad zfs_deleg_who_type_t %d", type);
}
}

Expand Down
4 changes: 2 additions & 2 deletions module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ buf_init(void)

for (i = 0; i < BUF_LOCKS; i++) {
mutex_init(&buf_hash_table.ht_locks[i].ht_lock,
NULL, MUTEX_DEFAULT, NULL);
NULL, MUTEX_FSTRANS, NULL);
}
}

Expand Down Expand Up @@ -2956,7 +2956,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
arc_change_state(arc_mfu, buf, hash_lock);
} else {
ASSERT(!"invalid arc state");
cmn_err(CE_PANIC, "invalid arc state 0x%p", buf->b_state);
}
}

Expand Down
2 changes: 1 addition & 1 deletion module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ dbuf_init(void)
0, dbuf_cons, dbuf_dest, NULL, NULL, NULL, 0);

for (i = 0; i < DBUF_MUTEXES; i++)
mutex_init(&h->hash_mutexes[i], NULL, MUTEX_DEFAULT, NULL);
mutex_init(&h->hash_mutexes[i], NULL, MUTEX_FSTRANS, NULL);

dbuf_stats_init(h);
}
Expand Down
3 changes: 2 additions & 1 deletion module/zfs/dmu_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,8 @@ dmu_tx_dirty_buf(dmu_tx_t *tx, dmu_buf_impl_t *db)
match_object = TRUE;
break;
default:
ASSERT(!"bad txh_type");
cmn_err(CE_PANIC, "bad txh_type %d",
txh->txh_type);
}
}
if (match_object && match_offset) {
Expand Down
9 changes: 6 additions & 3 deletions module/zfs/zap_leaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ stv(int len, void *addr, uint64_t value)
case 8:
*(uint64_t *)addr = value;
return;
default:
cmn_err(CE_PANIC, "bad int len %d", len);
}
ASSERT(!"bad int len");
}

static uint64_t
Expand All @@ -95,8 +96,9 @@ ldv(int len, const void *addr)
return (*(uint32_t *)addr);
case 8:
return (*(uint64_t *)addr);
default:
cmn_err(CE_PANIC, "bad int len %d", len);
}
ASSERT(!"bad int len");
return (0xFEEDFACEDEADBEEFULL);
}

Expand Down Expand Up @@ -147,7 +149,8 @@ zap_leaf_byteswap(zap_leaf_phys_t *buf, int size)
/* la_array doesn't need swapping */
break;
default:
ASSERT(!"bad leaf type");
cmn_err(CE_PANIC, "bad leaf type %d",
lc->l_free.lf_type);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/zap_micro.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ mzap_addent(zap_name_t *zn, uint64_t value)
start = 0;
goto again;
}
ASSERT(!"out of entries!");
cmn_err(CE_PANIC, "out of entries!");
}

int
Expand Down
21 changes: 4 additions & 17 deletions module/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1198,9 +1198,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)
Expand All @@ -1227,23 +1228,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;
Expand Down Expand Up @@ -1336,10 +1326,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
Expand Down

0 comments on commit c8d7193

Please sign in to comment.