Linux compat: Minimum kernel version 3.10

Increase the minimum supported kernel version from 2.6.32 to 3.10.
This removes support for the following Linux enterprise distributions.

    Distribution     | Kernel | End of Life
    ---------------- | ------ | -------------
    Ubuntu 12.04 LTS | 3.2    | Apr 28, 2017
    SLES 11          | 3.0    | Mar 32, 2019
    RHEL / CentOS 6  | 2.6.32 | Nov 30, 2020

The following changes were made as part of removing support.

* Updated `configure` to enforce a minimum kernel version as
  specified in the META file (Linux-Minimum: 3.10).

    configure: error:
        *** Cannot build against kernel version 2.6.32.
        *** The minimum supported kernel version is 3.10.

* Removed all `configure` kABI checks and matching C code for
  interfaces which solely predate the Linux 3.10 kernel.

* Updated all `configure` kABI checks to fail when an interface is
  missing which was in the 3.10 kernel up to the latest 5.1 kernel.
  Removed the HAVE_* preprocessor defines for these checks and
  updated the code to unconditionally use the verified interface.

* Inverted the detection logic in several kABI checks to match
  the new interface as it appears in 3.10 and newer and not the
  legacy interface.

* Consolidated the following checks in to individual files. Due
  the large number of changes in the checks it made sense to handle
  this now.  It would be desirable to group other related checks in
  the same fashion, but this as left as future work.

  - config/kernel-blkdev.m4 - Block device kABI checks
  - config/kernel-blk-queue.m4 - Block queue kABI checks
  - config/kernel-bio.m4 - Bio interface kABI checks

* Removed the kABI checks for sops->nr_cached_objects() and
  sops->free_cached_objects().  These interfaces are currently unused.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9566
This commit is contained in:
Brian Behlendorf
2019-11-12 08:59:06 -08:00
committed by GitHub
parent 035ebb3653
commit 066e825221
102 changed files with 1136 additions and 2965 deletions
+13 -195
View File
@@ -35,10 +35,6 @@
#include <linux/hdreg.h>
#include <linux/msdos_fs.h> /* for SECTOR_* */
#ifndef HAVE_FMODE_T
typedef unsigned __bitwise__ fmode_t;
#endif /* HAVE_FMODE_T */
#ifndef HAVE_BLK_QUEUE_FLAG_SET
static inline void
blk_queue_flag_set(unsigned int flag, struct request_queue *q)
@@ -66,9 +62,6 @@ blk_queue_flag_clear(unsigned int flag, struct request_queue *q)
* interface. However, while the old interface was available to all the
* new one is GPL-only. Thus if the GPL-only version is detected we
* implement our own trivial helper.
*
* 2.6.x - 2.6.35
* Legacy blk_queue_ordered() interface.
*/
static inline void
blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua)
@@ -92,48 +85,10 @@ blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua)
#elif defined(HAVE_BLK_QUEUE_FLUSH)
blk_queue_flush(q, (wc ? REQ_FLUSH : 0) | (fua ? REQ_FUA : 0));
#else
blk_queue_ordered(q, QUEUE_ORDERED_DRAIN, NULL);
#error "Unsupported kernel"
#endif
}
/*
* Most of the blk_* macros were removed in 2.6.36. Ostensibly this was
* done to improve readability and allow easier grepping. However, from
* a portability stand point the macros are helpful. Therefore the needed
* macros are redefined here if they are missing from the kernel.
*/
#ifndef blk_fs_request
#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
#endif
/*
* 2.6.34 API change,
* The blk_queue_max_hw_sectors() function replaces blk_queue_max_sectors().
*/
#ifndef HAVE_BLK_QUEUE_MAX_HW_SECTORS
#define blk_queue_max_hw_sectors __blk_queue_max_hw_sectors
static inline void
__blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors)
{
blk_queue_max_sectors(q, max_hw_sectors);
}
#endif
/*
* 2.6.34 API change,
* The blk_queue_max_segments() function consolidates
* blk_queue_max_hw_segments() and blk_queue_max_phys_segments().
*/
#ifndef HAVE_BLK_QUEUE_MAX_SEGMENTS
#define blk_queue_max_segments __blk_queue_max_segments
static inline void
__blk_queue_max_segments(struct request_queue *q, unsigned short max_segments)
{
blk_queue_max_phys_segments(q, max_segments);
blk_queue_max_hw_segments(q, max_segments);
}
#endif
static inline void
blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages)
{
@@ -144,7 +99,7 @@ blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages)
#endif
}
#ifndef HAVE_GET_DISK_AND_MODULE
#if !defined(HAVE_GET_DISK_AND_MODULE)
static inline struct kobject *
get_disk_and_module(struct gendisk *disk)
{
@@ -152,19 +107,6 @@ get_disk_and_module(struct gendisk *disk)
}
#endif
#ifndef HAVE_GET_DISK_RO
static inline int
get_disk_ro(struct gendisk *disk)
{
int policy = 0;
if (disk->part[0])
policy = disk->part[0]->policy;
return (policy);
}
#endif /* HAVE_GET_DISK_RO */
#ifdef HAVE_BIO_BVEC_ITER
#define BIO_BI_SECTOR(bio) (bio)->bi_iter.bi_sector
#define BIO_BI_SIZE(bio) (bio)->bi_iter.bi_size
@@ -183,10 +125,6 @@ typedef struct bvec_iter bvec_iterator_t;
typedef int bvec_iterator_t;
#endif
/*
* Portable helper for correctly setting the FAILFAST flags. The
* correct usage has changed 3 times from 2.6.12 to 2.6.38.
*/
static inline void
bio_set_flags_failfast(struct block_device *bdev, int *flags)
{
@@ -210,27 +148,13 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags)
#endif /* BLOCK_EXT_MAJOR */
#endif /* CONFIG_BUG */
#if defined(HAVE_BIO_RW_FAILFAST_DTD)
/* BIO_RW_FAILFAST_* preferred interface from 2.6.28 - 2.6.35 */
*flags |= (
(1 << BIO_RW_FAILFAST_DEV) |
(1 << BIO_RW_FAILFAST_TRANSPORT) |
(1 << BIO_RW_FAILFAST_DRIVER));
#elif defined(HAVE_REQ_FAILFAST_MASK)
/*
* REQ_FAILFAST_* preferred interface from 2.6.36 - 2.6.xx,
* the BIO_* and REQ_* flags were unified under REQ_* flags.
*/
*flags |= REQ_FAILFAST_MASK;
#else
#error "Undefined block IO FAILFAST interface."
#endif
}
/*
* Maximum disk label length, it may be undefined for some kernels.
*/
#ifndef DISK_NAME_LEN
#if !defined(DISK_NAME_LEN)
#define DISK_NAME_LEN 32
#endif /* DISK_NAME_LEN */
@@ -337,33 +261,6 @@ bio_set_bi_error(struct bio *bio, int error)
#define BIO_END_IO(bio, error) bio_endio(bio, error);
#endif /* HAVE_1ARG_BIO_END_IO_T */
/*
* 2.6.38 - 2.6.x API,
* blkdev_get_by_path()
* blkdev_put()
*
* 2.6.28 - 2.6.37 API,
* open_bdev_exclusive()
* close_bdev_exclusive()
*
* 2.6.12 - 2.6.27 API,
* open_bdev_excl()
* close_bdev_excl()
*
* Used to exclusively open a block device from within the kernel.
*/
#if defined(HAVE_BLKDEV_GET_BY_PATH)
#define vdev_bdev_open(path, md, hld) blkdev_get_by_path(path, \
(md) | FMODE_EXCL, hld)
#define vdev_bdev_close(bdev, md) blkdev_put(bdev, (md) | FMODE_EXCL)
#elif defined(HAVE_OPEN_BDEV_EXCLUSIVE)
#define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld)
#define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md)
#else
#define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld)
#define vdev_bdev_close(bdev, md) close_bdev_excl(bdev)
#endif /* HAVE_BLKDEV_GET_BY_PATH | HAVE_OPEN_BDEV_EXCLUSIVE */
/*
* 4.1 - x.y.z API,
* 3.10.0 CentOS 7.x API,
@@ -378,17 +275,6 @@ bio_set_bi_error(struct bio *bio, int error)
#define vdev_bdev_reread_part(bdev) check_disk_change(bdev)
#endif /* HAVE_BLKDEV_REREAD_PART */
/*
* 2.6.22 API change
* The function invalidate_bdev() lost it's second argument because
* it was unused.
*/
#ifdef HAVE_1ARG_INVALIDATE_BDEV
#define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev)
#else
#define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1)
#endif /* HAVE_1ARG_INVALIDATE_BDEV */
/*
* 2.6.27 API change
* The function was exported for use, prior to this it existed but the
@@ -403,38 +289,14 @@ bio_set_bi_error(struct bio *bio, int error)
#ifdef HAVE_2ARGS_LOOKUP_BDEV
#define vdev_lookup_bdev(path) lookup_bdev(path, 0)
#else
#define vdev_lookup_bdev(path) ERR_PTR(-ENOTSUP)
#error "Unsupported kernel"
#endif /* HAVE_2ARGS_LOOKUP_BDEV */
#endif /* HAVE_1ARG_LOOKUP_BDEV */
/*
* 2.6.30 API change
* To ensure good performance preferentially use the physical block size
* for proper alignment. The physical size is supposed to be the internal
* sector size used by the device. This is often 4096 byte for AF devices,
* while a smaller 512 byte logical size is supported for compatibility.
*
* Unfortunately, many drives still misreport their physical sector size.
* For devices which are known to lie you may need to manually set this
* at pool creation time with 'zpool create -o ashift=12 ...'.
*
* When the physical block size interface isn't available, we fall back to
* the logical block size interface and then the older hard sector size.
*/
#ifdef HAVE_BDEV_PHYSICAL_BLOCK_SIZE
#define vdev_bdev_block_size(bdev) bdev_physical_block_size(bdev)
#else
#ifdef HAVE_BDEV_LOGICAL_BLOCK_SIZE
#define vdev_bdev_block_size(bdev) bdev_logical_block_size(bdev)
#else
#define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev)
#endif /* HAVE_BDEV_LOGICAL_BLOCK_SIZE */
#endif /* HAVE_BDEV_PHYSICAL_BLOCK_SIZE */
#ifndef HAVE_BIO_SET_OP_ATTRS
/*
* Kernels without bio_set_op_attrs use bi_rw for the bio flags.
*/
#if !defined(HAVE_BIO_SET_OP_ATTRS)
static inline void
bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags)
{
@@ -446,14 +308,8 @@ bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags)
* bio_set_flush - Set the appropriate flags in a bio to guarantee
* data are on non-volatile media on completion.
*
* 2.6.X - 2.6.36 API,
* WRITE_BARRIER - Tells the block layer to commit all previously submitted
* writes to stable storage before this one is started and that the current
* write is on stable storage upon completion. Also prevents reordering
* on both sides of the current operation.
*
* 2.6.37 - 4.8 API,
* Introduce WRITE_FLUSH, WRITE_FUA, and WRITE_FLUSH_FUA flags as a
* Introduce WRITE_FLUSH, WRITE_FUA, and WRITE_FLUSH_FUA flags as a
* replacement for WRITE_BARRIER to allow expressing richer semantics
* to the block layer. It's up to the block layer to implement the
* semantics correctly. Use the WRITE_FLUSH_FUA flag combination.
@@ -471,12 +327,10 @@ bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags)
static inline void
bio_set_flush(struct bio *bio)
{
#if defined(REQ_PREFLUSH) /* >= 4.10 */
#if defined(HAVE_REQ_PREFLUSH) /* >= 4.10 */
bio_set_op_attrs(bio, 0, REQ_PREFLUSH);
#elif defined(WRITE_FLUSH_FUA) /* >= 2.6.37 and <= 4.9 */
bio_set_op_attrs(bio, 0, WRITE_FLUSH_FUA);
#elif defined(WRITE_BARRIER) /* < 2.6.37 */
bio_set_op_attrs(bio, 0, WRITE_BARRIER);
#else
#error "Allowing the build will cause bio_set_flush requests to be ignored."
#endif
@@ -492,12 +346,6 @@ bio_set_flush(struct bio *bio)
* 2.6.36 - 4.7 API,
* REQ_FLUSH
*
* 2.6.x - 2.6.35 API,
* HAVE_BIO_RW_BARRIER
*
* Used to determine if a cache flush has been requested. This check has
* been left intentionally broad in order to cover both a legacy flush
* and the new preflush behavior introduced in Linux 4.8. This is correct
* in all cases but may have a performance impact for some kernels. It
* has the advantage of minimizing kernel specific changes in the zvol code.
*
@@ -507,16 +355,14 @@ bio_is_flush(struct bio *bio)
{
#if defined(HAVE_REQ_OP_FLUSH) && defined(HAVE_BIO_BI_OPF)
return ((bio_op(bio) == REQ_OP_FLUSH) || (bio->bi_opf & REQ_PREFLUSH));
#elif defined(REQ_PREFLUSH) && defined(HAVE_BIO_BI_OPF)
#elif defined(HAVE_REQ_PREFLUSH) && defined(HAVE_BIO_BI_OPF)
return (bio->bi_opf & REQ_PREFLUSH);
#elif defined(REQ_PREFLUSH) && !defined(HAVE_BIO_BI_OPF)
#elif defined(HAVE_REQ_PREFLUSH) && !defined(HAVE_BIO_BI_OPF)
return (bio->bi_rw & REQ_PREFLUSH);
#elif defined(REQ_FLUSH)
#elif defined(HAVE_REQ_FLUSH)
return (bio->bi_rw & REQ_FLUSH);
#elif defined(HAVE_BIO_RW_BARRIER)
return (bio->bi_rw & (1 << BIO_RW_BARRIER));
#else
#error "Allowing the build will cause flush requests to be ignored."
#error "Unsupported kernel"
#endif
}
@@ -546,28 +392,18 @@ bio_is_fua(struct bio *bio)
* 2.6.36 - 4.7 API,
* REQ_DISCARD
*
* 2.6.28 - 2.6.35 API,
* BIO_RW_DISCARD
*
* In all cases the normal I/O path is used for discards. The only
* difference is how the kernel tags individual I/Os as discards.
*
* Note that 2.6.32 era kernels provide both BIO_RW_DISCARD and REQ_DISCARD,
* where BIO_RW_DISCARD is the correct interface. Therefore, it is important
* that the HAVE_BIO_RW_DISCARD check occur before the REQ_DISCARD check.
*/
static inline boolean_t
bio_is_discard(struct bio *bio)
{
#if defined(HAVE_REQ_OP_DISCARD)
return (bio_op(bio) == REQ_OP_DISCARD);
#elif defined(HAVE_BIO_RW_DISCARD)
return (bio->bi_rw & (1 << BIO_RW_DISCARD));
#elif defined(REQ_DISCARD)
#elif defined(HAVE_REQ_DISCARD)
return (bio->bi_rw & REQ_DISCARD);
#else
/* potentially triggering the DMU_MAX_ACCESS assertion. */
#error "Allowing the build will cause discard requests to become writes."
#error "Unsupported kernel"
#endif
}
@@ -577,9 +413,6 @@ bio_is_discard(struct bio *bio)
*
* 2.6.36 - 4.7 API,
* REQ_SECURE
*
* 2.6.x - 2.6.35 API,
* Unsupported by kernel
*/
static inline boolean_t
bio_is_secure_erase(struct bio *bio)
@@ -598,23 +431,11 @@ bio_is_secure_erase(struct bio *bio)
* Discard granularity and alignment restrictions may now be set. For
* older kernels which do not support this it is safe to skip it.
*/
#ifdef HAVE_DISCARD_GRANULARITY
static inline void
blk_queue_discard_granularity(struct request_queue *q, unsigned int dg)
{
q->limits.discard_granularity = dg;
}
#else
#define blk_queue_discard_granularity(x, dg) ((void)0)
#endif /* HAVE_DISCARD_GRANULARITY */
/*
* 2.6.32 - 4.x API,
* blk_queue_discard()
*/
#if !defined(HAVE_BLK_QUEUE_DISCARD)
#define blk_queue_discard(q) (0);
#endif
/*
* 4.8 - 4.x API,
@@ -622,9 +443,6 @@ blk_queue_discard_granularity(struct request_queue *q, unsigned int dg)
*
* 2.6.36 - 4.7 API,
* blk_queue_secdiscard()
*
* 2.6.x - 2.6.35 API,
* Unsupported by kernel
*/
static inline int
blk_queue_discard_secure(struct request_queue *q)
@@ -41,24 +41,7 @@
* the dentry structure. To handle this we define an appropriate
* dentry_operations_t typedef which can be used.
*/
#ifdef HAVE_CONST_DENTRY_OPERATIONS
typedef const struct dentry_operations dentry_operations_t;
#else
typedef struct dentry_operations dentry_operations_t;
#endif
/*
* 2.6.38 API change,
* Added d_set_d_op() helper function which sets some flags in
* dentry->d_flags based on which operations are defined.
*/
#ifndef HAVE_D_SET_D_OP
static inline void
d_set_d_op(struct dentry *dentry, dentry_operations_t *op)
{
dentry->d_op = op;
}
#endif /* HAVE_D_SET_D_OP */
/*
* 2.6.38 API addition,
@@ -72,12 +55,10 @@ d_set_d_op(struct dentry *dentry, dentry_operations_t *op)
static inline void
d_clear_d_op(struct dentry *dentry)
{
#ifdef HAVE_D_SET_D_OP
dentry->d_op = NULL;
dentry->d_flags &= ~(
DCACHE_OP_HASH | DCACHE_OP_COMPARE |
DCACHE_OP_REVALIDATE | DCACHE_OP_DELETE);
#endif /* HAVE_D_SET_D_OP */
}
#endif /* _ZFS_DCACHE_H */
@@ -29,14 +29,9 @@
#include <linux/highmem.h>
#include <linux/uaccess.h>
#ifdef HAVE_1ARG_KMAP_ATOMIC
/* 2.6.37 API change */
#define zfs_kmap_atomic(page, km_type) kmap_atomic(page)
#define zfs_kunmap_atomic(addr, km_type) kunmap_atomic(addr)
#else
#define zfs_kmap_atomic(page, km_type) kmap_atomic(page, km_type)
#define zfs_kunmap_atomic(addr, km_type) kunmap_atomic(addr, km_type)
#endif
/* 5.0 API change - no more 'type' argument for access_ok() */
#ifdef HAVE_ACCESS_OK_TYPE
+9 -216
View File
@@ -33,43 +33,6 @@
#include <linux/compat.h>
/*
* 2.6.28 API change,
* Added insert_inode_locked() helper function, prior to this most callers
* used insert_inode_hash(). The older method doesn't check for collisions
* in the inode_hashtable but it still acceptable for use.
*/
#ifndef HAVE_INSERT_INODE_LOCKED
static inline int
insert_inode_locked(struct inode *ip)
{
insert_inode_hash(ip);
return (0);
}
#endif /* HAVE_INSERT_INODE_LOCKED */
/*
* 2.6.35 API change,
* Add truncate_setsize() if it is not exported by the Linux kernel.
*
* Truncate the inode and pages associated with the inode. The pages are
* unmapped and removed from cache.
*/
#ifndef HAVE_TRUNCATE_SETSIZE
static inline void
truncate_setsize(struct inode *ip, loff_t new)
{
struct address_space *mapping = ip->i_mapping;
i_size_write(ip, new);
unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
truncate_inode_pages(mapping, new);
unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
}
#endif /* HAVE_TRUNCATE_SETSIZE */
/*
* 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 - 4.11, bdi_setup_and_register() takes 2 arguments.
* 4.12 - x.y, super_setup_bdi_name() new interface.
@@ -142,45 +105,7 @@ zpl_bdi_destroy(struct super_block *sb)
sb->s_bdi = NULL;
}
#else
extern atomic_long_t zfs_bdi_seq;
static inline int
zpl_bdi_setup(struct super_block *sb, char *name)
{
struct backing_dev_info *bdi;
int error;
bdi = kmem_zalloc(sizeof (struct backing_dev_info), KM_SLEEP);
bdi->name = name;
bdi->capabilities = BDI_CAP_MAP_COPY;
error = bdi_init(bdi);
if (error) {
kmem_free(bdi, sizeof (struct backing_dev_info));
return (error);
}
error = bdi_register(bdi, NULL, "%.28s-%ld", name,
atomic_long_inc_return(&zfs_bdi_seq));
if (error) {
bdi_destroy(bdi);
kmem_free(bdi, sizeof (struct backing_dev_info));
return (error);
}
sb->s_bdi = bdi;
return (0);
}
static inline void
zpl_bdi_destroy(struct super_block *sb)
{
struct backing_dev_info *bdi = sb->s_bdi;
bdi_destroy(bdi);
kmem_free(bdi, sizeof (struct backing_dev_info));
sb->s_bdi = NULL;
}
#error "Unsupported kernel"
#endif
/*
@@ -211,41 +136,6 @@ zpl_bdi_destroy(struct super_block *sb)
#define SB_NOATIME MS_NOATIME
#endif
/*
* 2.6.38 API change,
* LOOKUP_RCU flag introduced to distinguish rcu-walk from ref-walk cases.
*/
#ifndef LOOKUP_RCU
#define LOOKUP_RCU 0x0
#endif /* LOOKUP_RCU */
/*
* 3.2-rc1 API change,
* Add set_nlink() if it is not exported by the Linux kernel.
*
* i_nlink is read-only in Linux 3.2, but it can be set directly in
* earlier kernels.
*/
#ifndef HAVE_SET_NLINK
static inline void
set_nlink(struct inode *inode, unsigned int nlink)
{
inode->i_nlink = nlink;
}
#endif /* HAVE_SET_NLINK */
/*
* 3.3 API change,
* The VFS .create, .mkdir and .mknod callbacks were updated to take a
* umode_t type rather than an int. To cleanly handle both definitions
* the zpl_umode_t type is introduced and set accordingly.
*/
#ifdef HAVE_MKDIR_UMODE_T
typedef umode_t zpl_umode_t;
#else
typedef int zpl_umode_t;
#endif
/*
* 3.5 API change,
* The clear_inode() function replaces end_writeback() and introduces an
@@ -256,16 +146,6 @@ typedef int zpl_umode_t;
#define clear_inode(ip) end_writeback(ip)
#endif /* HAVE_EVICT_INODE && !HAVE_CLEAR_INODE */
/*
* 3.6 API change,
* The sget() helper function now takes the mount flags as an argument.
*/
#ifdef HAVE_5ARG_SGET
#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, fl, mtd)
#else
#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, mtd)
#endif /* HAVE_5ARG_SGET */
#if defined(SEEK_HOLE) && defined(SEEK_DATA) && !defined(HAVE_LSEEK_EXECUTE)
static inline loff_t
lseek_execute(
@@ -361,65 +241,22 @@ zpl_forget_cached_acl(struct inode *ip, int type)
}
#endif /* HAVE_SET_CACHED_ACL_USABLE */
/*
* 3.1 API change,
* posix_acl_chmod() was added as the preferred interface.
*
* 3.14 API change,
* posix_acl_chmod() was changed to __posix_acl_chmod()
*/
#ifndef HAVE___POSIX_ACL_CHMOD
#ifdef HAVE_POSIX_ACL_CHMOD
#define __posix_acl_chmod(acl, gfp, mode) posix_acl_chmod(acl, gfp, mode)
#define __posix_acl_create(acl, gfp, mode) posix_acl_create(acl, gfp, mode)
#else
static inline int
__posix_acl_chmod(struct posix_acl **acl, int flags, umode_t umode)
{
struct posix_acl *oldacl = *acl;
mode_t mode = umode;
int error;
*acl = posix_acl_clone(*acl, flags);
zpl_posix_acl_release(oldacl);
if (!(*acl))
return (-ENOMEM);
error = posix_acl_chmod_masq(*acl, mode);
if (error) {
zpl_posix_acl_release(*acl);
*acl = NULL;
}
return (error);
}
static inline int
__posix_acl_create(struct posix_acl **acl, int flags, umode_t *umodep)
{
struct posix_acl *oldacl = *acl;
mode_t mode = *umodep;
int error;
*acl = posix_acl_clone(*acl, flags);
zpl_posix_acl_release(oldacl);
if (!(*acl))
return (-ENOMEM);
error = posix_acl_create_masq(*acl, &mode);
*umodep = mode;
if (error < 0) {
zpl_posix_acl_release(*acl);
*acl = NULL;
}
return (error);
}
#error "Unsupported kernel"
#endif /* HAVE_POSIX_ACL_CHMOD */
#endif /* HAVE___POSIX_ACL_CHMOD */
#ifdef HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T
typedef umode_t zpl_equivmode_t;
#else
typedef mode_t zpl_equivmode_t;
#endif /* HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T */
/*
* 4.8 API change,
* posix_acl_valid() now must be passed a namespace, the namespace from
@@ -433,16 +270,6 @@ typedef mode_t zpl_equivmode_t;
#endif /* CONFIG_FS_POSIX_ACL */
/*
* 2.6.38 API change,
* The is_owner_or_cap() function was renamed to inode_owner_or_capable().
*/
#ifdef HAVE_INODE_OWNER_OR_CAPABLE
#define zpl_inode_owner_or_capable(ip) inode_owner_or_capable(ip)
#else
#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
@@ -467,7 +294,6 @@ static inline struct dentry *file_dentry(const struct file *f)
}
#endif /* HAVE_FILE_DENTRY */
#ifdef HAVE_KUID_HELPERS
static inline uid_t zfs_uid_read_impl(struct inode *ip)
{
#ifdef HAVE_SUPER_USER_NS
@@ -514,39 +340,6 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid)
#endif
}
#else
static inline uid_t zfs_uid_read(struct inode *ip)
{
return (ip->i_uid);
}
static inline gid_t zfs_gid_read(struct inode *ip)
{
return (ip->i_gid);
}
static inline void zfs_uid_write(struct inode *ip, uid_t uid)
{
ip->i_uid = uid;
}
static inline void zfs_gid_write(struct inode *ip, gid_t gid)
{
ip->i_gid = gid;
}
#endif
/*
* 2.6.38 API change
*/
#ifdef HAVE_FOLLOW_DOWN_ONE
#define zpl_follow_down_one(path) follow_down_one(path)
#define zpl_follow_up(path) follow_up(path)
#else
#define zpl_follow_down_one(path) follow_down(path)
#define zpl_follow_up(path) follow_up(path)
#endif
/*
* 4.9 API change
*/
+6 -73
View File
@@ -35,24 +35,7 @@
* appropriate xattr_handler_t typedef which can be used. This was
* the preferred solution because it keeps the code clean and readable.
*/
#ifdef HAVE_CONST_XATTR_HANDLER
typedef const struct xattr_handler xattr_handler_t;
#else
typedef struct xattr_handler xattr_handler_t;
#endif
/*
* 3.7 API change,
* Preferred XATTR_NAME_* definitions introduced, these are mapped to
* the previous definitions for older kernels.
*/
#ifndef XATTR_NAME_POSIX_ACL_DEFAULT
#define XATTR_NAME_POSIX_ACL_DEFAULT POSIX_ACL_XATTR_DEFAULT
#endif
#ifndef XATTR_NAME_POSIX_ACL_ACCESS
#define XATTR_NAME_POSIX_ACL_ACCESS POSIX_ACL_XATTR_ACCESS
#endif
/*
* 4.5 API change,
@@ -88,17 +71,8 @@ fn(const struct xattr_handler *handler, struct dentry *dentry, \
return (__ ## fn(dentry->d_inode, \
list, list_size, name, name_len)); \
}
/*
* 2.6.32 API
*/
#elif defined(HAVE_XATTR_LIST_INODE)
#define ZPL_XATTR_LIST_WRAPPER(fn) \
static size_t \
fn(struct inode *ip, char *list, size_t list_size, \
const char *name, size_t name_len) \
{ \
return (__ ## fn(ip, list, list_size, name, name_len)); \
}
#else
#error "Unsupported kernel"
#endif
/*
@@ -141,16 +115,8 @@ fn(struct dentry *dentry, const char *name, void *buffer, size_t size, \
{ \
return (__ ## fn(dentry->d_inode, name, buffer, size)); \
}
/*
* 2.6.32 API
*/
#elif defined(HAVE_XATTR_GET_INODE)
#define ZPL_XATTR_GET_WRAPPER(fn) \
static int \
fn(struct inode *ip, const char *name, void *buffer, size_t size) \
{ \
return (__ ## fn(ip, name, buffer, size)); \
}
#else
#error "Unsupported kernel"
#endif
/*
@@ -194,33 +160,15 @@ fn(struct dentry *dentry, const char *name, const void *buffer, \
{ \
return (__ ## fn(dentry->d_inode, name, buffer, size, flags)); \
}
/*
* 2.6.32 API
*/
#elif defined(HAVE_XATTR_SET_INODE)
#define ZPL_XATTR_SET_WRAPPER(fn) \
static int \
fn(struct inode *ip, const char *name, const void *buffer, \
size_t size, int flags) \
{ \
return (__ ## fn(ip, name, buffer, size, flags)); \
}
#endif
#ifdef HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY
#define zpl_security_inode_init_security(ip, dip, qstr, nm, val, len) \
security_inode_init_security(ip, dip, qstr, nm, val, len)
#else
#define zpl_security_inode_init_security(ip, dip, qstr, nm, val, len) \
security_inode_init_security(ip, dip, nm, val, len)
#endif /* HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY */
#error "Unsupported kernel"
#endif
/*
* Linux 3.7 API change. posix_acl_{from,to}_xattr gained the user_ns
* parameter. All callers are expected to pass the &init_user_ns which
* is available through the init credential (kcred).
*/
#ifdef HAVE_POSIX_ACL_FROM_XATTR_USERNS
static inline struct posix_acl *
zpl_acl_from_xattr(const void *value, int size)
{
@@ -233,19 +181,4 @@ zpl_acl_to_xattr(struct posix_acl *acl, void *value, int size)
return (posix_acl_to_xattr(kcred->user_ns, acl, value, size));
}
#else
static inline struct posix_acl *
zpl_acl_from_xattr(const void *value, int size)
{
return (posix_acl_from_xattr(value, size));
}
static inline int
zpl_acl_to_xattr(struct posix_acl *acl, void *value, int size)
{
return (posix_acl_to_xattr(acl, value, size));
}
#endif /* HAVE_POSIX_ACL_FROM_XATTR_USERNS */
#endif /* _ZFS_XATTR_H */
-12
View File
@@ -40,24 +40,12 @@ typedef struct cred cred_t;
#define GROUP_AT(gi, i) ((gi)->gid[i])
#endif
#ifdef HAVE_KUIDGID_T
#define KUID_TO_SUID(x) (__kuid_val(x))
#define KGID_TO_SGID(x) (__kgid_val(x))
#define SUID_TO_KUID(x) (KUIDT_INIT(x))
#define SGID_TO_KGID(x) (KGIDT_INIT(x))
#define KGIDP_TO_SGIDP(x) (&(x)->val)
#else /* HAVE_KUIDGID_T */
#define KUID_TO_SUID(x) (x)
#define KGID_TO_SGID(x) (x)
#define SUID_TO_KUID(x) (x)
#define SGID_TO_KGID(x) (x)
#define KGIDP_TO_SGIDP(x) (x)
#endif /* HAVE_KUIDGID_T */
extern void crhold(cred_t *cr);
extern void crfree(cred_t *cr);
extern uid_t crgetuid(const cred_t *cr);
-4
View File
@@ -27,10 +27,6 @@
#include <linux/proc_fs.h>
#ifndef HAVE_PDE_DATA
#define PDE_DATA(x) (PDE(x)->data)
#endif
extern struct proc_dir_entry *proc_spl_kstat;
int spl_proc_init(void);
+1 -58
View File
@@ -28,13 +28,6 @@
#include <linux/mm.h>
#include <linux/fs.h>
#if !defined(HAVE_SHRINK_CONTROL_STRUCT)
struct shrink_control {
gfp_t gfp_mask;
unsigned long nr_to_scan;
};
#endif /* HAVE_SHRINK_CONTROL_STRUCT */
/*
* Due to frequent changes in the shrinker API the following
* compatibility wrappers should be used. They are as follows:
@@ -84,60 +77,10 @@ struct shrink_control {
#define spl_register_shrinker(x) register_shrinker(x)
#define spl_unregister_shrinker(x) unregister_shrinker(x)
/*
* Linux 2.6.23 - 2.6.34 Shrinker API Compatibility.
*/
#if defined(HAVE_2ARGS_OLD_SHRINKER_CALLBACK)
#define SPL_SHRINKER_DECLARE(s, x, y) \
static struct shrinker s = { \
.shrink = x, \
.seeks = y \
}
#define SPL_SHRINKER_CALLBACK_FWD_DECLARE(fn) \
static int fn(int nr_to_scan, unsigned int gfp_mask)
#define SPL_SHRINKER_CALLBACK_WRAPPER(fn) \
static int \
fn(int nr_to_scan, unsigned int gfp_mask) \
{ \
struct shrink_control sc; \
\
sc.nr_to_scan = nr_to_scan; \
sc.gfp_mask = gfp_mask; \
\
return (__ ## fn(NULL, &sc)); \
}
/*
* Linux 2.6.35 to 2.6.39 Shrinker API Compatibility.
*/
#elif defined(HAVE_3ARGS_SHRINKER_CALLBACK)
#define SPL_SHRINKER_DECLARE(s, x, y) \
static struct shrinker s = { \
.shrink = x, \
.seeks = y \
}
#define SPL_SHRINKER_CALLBACK_FWD_DECLARE(fn) \
static int fn(struct shrinker *, int, unsigned int)
#define SPL_SHRINKER_CALLBACK_WRAPPER(fn) \
static int \
fn(struct shrinker *shrink, int nr_to_scan, unsigned int gfp_mask) \
{ \
struct shrink_control sc; \
\
sc.nr_to_scan = nr_to_scan; \
sc.gfp_mask = gfp_mask; \
\
return (__ ## fn(shrink, &sc)); \
}
/*
* Linux 3.0 to 3.11 Shrinker API Compatibility.
*/
#elif defined(HAVE_2ARGS_NEW_SHRINKER_CALLBACK)
#if defined(HAVE_SINGLE_SHRINKER_CALLBACK)
#define SPL_SHRINKER_DECLARE(s, x, y) \
static struct shrinker s = { \
.shrink = x, \
-4
View File
@@ -28,8 +28,4 @@
#define bcopy(src, dest, size) memmove(dest, src, size)
#define bcmp(src, dest, size) memcmp((src), (dest), (size_t)(size))
#ifndef HAVE_KSTRTOUL
#define kstrtoul strict_strtoul
#endif
#endif /* _SPL_SYS_STRINGS_H */
+1 -3
View File
@@ -27,15 +27,13 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/sched/rt.h>
#include <linux/cpumask.h>
#include <sys/debug.h>
#include <sys/zone.h>
#include <sys/signal.h>
#include <asm/page.h>
#ifdef HAVE_SCHED_RT_HEADER
#include <linux/sched/rt.h>
#endif
#ifndef _KERNEL
#define _KERNEL __KERNEL__
-14
View File
@@ -53,20 +53,6 @@
#define delay(ticks) schedule_timeout_uninterruptible(ticks)
/* usleep_range() introduced in 2.6.36 */
#ifndef HAVE_USLEEP_RANGE
static inline void
usleep_range(unsigned long min, unsigned long max)
{
unsigned int min_ms = min / USEC_PER_MSEC;
if (min >= MAX_UDELAY_MS)
msleep(min_ms);
else
udelay(min);
}
#endif /* HAVE_USLEEP_RANGE */
#define SEC_TO_TICK(sec) ((sec) * HZ)
#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms)
#define USEC_TO_TICK(us) usecs_to_jiffies(us)
-8
View File
@@ -59,14 +59,6 @@
#include <sys/types.h>
#include <linux/zlib.h>
#ifdef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
#define spl_zlib_deflate_workspacesize(wb, ml) \
zlib_deflate_workspacesize(wb, ml)
#else
#define spl_zlib_deflate_workspacesize(wb, ml) \
zlib_deflate_workspacesize()
#endif /* HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */
extern int z_compress_level(void *dest, size_t *destLen, const void *source,
size_t sourceLen, int level);
extern int z_uncompress(void *dest, size_t *destLen, const void *source,
+3 -21
View File
@@ -39,7 +39,7 @@
/* zpl_inode.c */
extern void zpl_vap_init(vattr_t *vap, struct inode *dir,
zpl_umode_t mode, cred_t *cr);
umode_t mode, cred_t *cr);
extern const struct inode_operations zpl_inode_operations;
extern const struct inode_operations zpl_dir_inode_operations;
@@ -53,10 +53,6 @@ extern ssize_t zpl_read_common(struct inode *ip, const char *buf,
extern ssize_t zpl_write_common(struct inode *ip, const char *buf,
size_t len, loff_t *ppos, uio_seg_t segment, int flags,
cred_t *cr);
#if defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE)
extern long zpl_fallocate_common(struct inode *ip, int mode,
loff_t offset, loff_t len);
#endif /* defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) */
extern const struct address_space_operations zpl_address_space_operations;
extern const struct file_operations zpl_file_operations;
@@ -74,20 +70,10 @@ extern ssize_t zpl_xattr_list(struct dentry *dentry, char *buf, size_t size);
extern int zpl_xattr_security_init(struct inode *ip, struct inode *dip,
const struct qstr *qstr);
#if defined(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_SET_ACL)
extern int zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type);
#endif /* HAVE_SET_ACL */
extern struct posix_acl *zpl_get_acl(struct inode *ip, int type);
#if !defined(HAVE_GET_ACL)
#if defined(HAVE_CHECK_ACL_WITH_FLAGS)
extern int zpl_check_acl(struct inode *inode, int mask, unsigned int flags);
#elif defined(HAVE_CHECK_ACL)
extern int zpl_check_acl(struct inode *inode, int mask);
#elif defined(HAVE_PERMISSION_WITH_NAMEIDATA)
extern int zpl_permission(struct inode *ip, int mask, struct nameidata *nd);
#elif defined(HAVE_PERMISSION)
extern int zpl_permission(struct inode *ip, int mask);
#endif /* HAVE_CHECK_ACL | HAVE_PERMISSION */
#endif /* HAVE_GET_ACL */
extern int zpl_init_acl(struct inode *ip, struct inode *dir);
extern int zpl_chmod_acl(struct inode *ip);
#else
@@ -112,11 +98,7 @@ extern const struct inode_operations zpl_ops_root;
extern const struct file_operations zpl_fops_snapdir;
extern const struct inode_operations zpl_ops_snapdir;
#ifdef HAVE_AUTOMOUNT
extern const struct dentry_operations zpl_dops_snapdirs;
#else
extern const struct inode_operations zpl_ops_snapdirs;
#endif /* HAVE_AUTOMOUNT */
extern const struct file_operations zpl_fops_shares;
extern const struct inode_operations zpl_ops_shares;