Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b1f55b0 authored by Chris Mason's avatar Chris Mason
Browse files

Remove Btrfs compat code for older kernels



Btrfs had compatibility code for kernels back to 2.6.18.  These have
been removed, and will be maintained in a separate backport
git tree from now on.

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 9b49c9b9
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -20,13 +20,7 @@
#include <linux/kthread.h>
#include <linux/kthread.h>
#include <linux/list.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/spinlock.h>

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
# include <linux/freezer.h>
# include <linux/freezer.h>
#else
# include <linux/sched.h>
#endif

#include "async-thread.h"
#include "async-thread.h"


/*
/*
+2 −38
Original line number Original line Diff line number Diff line
#ifndef _COMPAT_H_
#ifndef _COMPAT_H_
#define _COMPAT_H_
#define _COMPAT_H_


#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,26)
#define btrfs_drop_nlink(inode) drop_nlink(inode)
#define trylock_page(page) (!TestSetPageLocked(page))
#define btrfs_inc_nlink(inode)	inc_nlink(inode)
#endif


#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27)
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27)
static inline struct dentry *d_obtain_alias(struct inode *inode)
static inline struct dentry *d_obtain_alias(struct inode *inode)
@@ -22,39 +21,4 @@ static inline struct dentry *d_obtain_alias(struct inode *inode)
}
}
#endif
#endif


#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
static inline void btrfs_drop_nlink(struct inode *inode)
{
	inode->i_nlink--;
}

static inline void btrfs_inc_nlink(struct inode *inode)
{
	inode->i_nlink++;
}
#else
# define btrfs_drop_nlink(inode) drop_nlink(inode)
# define btrfs_inc_nlink(inode)	inc_nlink(inode)
#endif

/*
 * Even if AppArmor isn't enabled, it still has different prototypes.
 * Add more distro/version pairs here to declare which has AppArmor applied.
 */
#if defined(CONFIG_SUSE_KERNEL)
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
# define REMOVE_SUID_PATH 1
# endif
#endif

/*
 * catch any other distros that have patched in apparmor.  This isn't
 * 100% reliable because it won't catch people that hand compile their
 * own distro kernels without apparmor compiled in.  But, it is better
 * than nothing.
 */
#ifdef CONFIG_SECURITY_APPARMOR
# define REMOVE_SUID_PATH 1
#endif

#endif /* _COMPAT_H_ */
#endif /* _COMPAT_H_ */
+0 −6
Original line number Original line Diff line number Diff line
@@ -96,13 +96,7 @@ static inline u32 __btrfs_crc32c(u32 crc, unsigned char const *address,
 * We must workaround older implementations of crc32c_le()
 * We must workaround older implementations of crc32c_le()
 * found on older kernel versions.
 * found on older kernel versions.
 */
 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
#define btrfs_crc32c(seed, data, length) \
	__cpu_to_le32( __btrfs_crc32c( __le32_to_cpu(seed), \
		                      (unsigned char const *)data, length) )
#else
#define btrfs_crc32c(seed, data, length) \
#define btrfs_crc32c(seed, data, length) \
	__btrfs_crc32c(seed, (unsigned char const *)data, length)
	__btrfs_crc32c(seed, (unsigned char const *)data, length)
#endif
#endif
#endif
+2 −5
Original line number Original line Diff line number Diff line
@@ -1472,12 +1472,9 @@ static inline u32 btrfs_level_size(struct btrfs_root *root, int level) {
	((unsigned long)(btrfs_leaf_data(leaf) + \
	((unsigned long)(btrfs_leaf_data(leaf) + \
	btrfs_item_offset_nr(leaf, slot)))
	btrfs_item_offset_nr(leaf, slot)))


static inline struct dentry *fdentry(struct file *file) {
static inline struct dentry *fdentry(struct file *file)
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
{
	return file->f_dentry;
#else
	return file->f_path.dentry;
	return file->f_path.dentry;
#endif
}
}


/* extent-tree.c */
/* extent-tree.c */
+0 −28
Original line number Original line Diff line number Diff line
@@ -26,11 +26,7 @@
#include <linux/buffer_head.h> // for block_sync_page
#include <linux/buffer_head.h> // for block_sync_page
#include <linux/workqueue.h>
#include <linux/workqueue.h>
#include <linux/kthread.h>
#include <linux/kthread.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
# include <linux/freezer.h>
# include <linux/freezer.h>
#else
# include <linux/sched.h>
#endif
#include "crc32c.h"
#include "crc32c.h"
#include "ctree.h"
#include "ctree.h"
#include "disk-io.h"
#include "disk-io.h"
@@ -373,21 +369,11 @@ int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
	return ret;
	return ret;
}
}


#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
static void end_workqueue_bio(struct bio *bio, int err)
static void end_workqueue_bio(struct bio *bio, int err)
#else
static int end_workqueue_bio(struct bio *bio,
				   unsigned int bytes_done, int err)
#endif
{
{
	struct end_io_wq *end_io_wq = bio->bi_private;
	struct end_io_wq *end_io_wq = bio->bi_private;
	struct btrfs_fs_info *fs_info;
	struct btrfs_fs_info *fs_info;


#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
	if (bio->bi_size)
		return 1;
#endif

	fs_info = end_io_wq->info;
	fs_info = end_io_wq->info;
	end_io_wq->error = err;
	end_io_wq->error = err;
	end_io_wq->work.func = end_workqueue_fn;
	end_io_wq->work.func = end_workqueue_fn;
@@ -397,10 +383,6 @@ static int end_workqueue_bio(struct bio *bio,
				   &end_io_wq->work);
				   &end_io_wq->work);
	else
	else
		btrfs_queue_worker(&fs_info->endio_workers, &end_io_wq->work);
		btrfs_queue_worker(&fs_info->endio_workers, &end_io_wq->work);

#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
	return 0;
#endif
}
}


int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
@@ -1161,9 +1143,7 @@ void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)


static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
{
{
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
	bdi_init(bdi);
	bdi_init(bdi);
#endif
	bdi->ra_pages	= default_backing_dev_info.ra_pages;
	bdi->ra_pages	= default_backing_dev_info.ra_pages;
	bdi->state		= 0;
	bdi->state		= 0;
	bdi->capabilities	= default_backing_dev_info.capabilities;
	bdi->capabilities	= default_backing_dev_info.capabilities;
@@ -1242,11 +1222,7 @@ static void end_workqueue_fn(struct btrfs_work *work)
	bio->bi_private = end_io_wq->private;
	bio->bi_private = end_io_wq->private;
	bio->bi_end_io = end_io_wq->end_io;
	bio->bi_end_io = end_io_wq->end_io;
	kfree(end_io_wq);
	kfree(end_io_wq);
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
	bio_endio(bio, bio->bi_size, error);
#else
	bio_endio(bio, error);
	bio_endio(bio, error);
#endif
}
}


static int cleaner_kthread(void *arg)
static int cleaner_kthread(void *arg)
@@ -1673,9 +1649,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,


	kfree(extent_root);
	kfree(extent_root);
	kfree(tree_root);
	kfree(tree_root);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
	bdi_destroy(&fs_info->bdi);
	bdi_destroy(&fs_info->bdi);
#endif
	kfree(fs_info);
	kfree(fs_info);
	return ERR_PTR(err);
	return ERR_PTR(err);
}
}
@@ -1936,9 +1910,7 @@ int close_ctree(struct btrfs_root *root)
	btrfs_close_devices(fs_info->fs_devices);
	btrfs_close_devices(fs_info->fs_devices);
	btrfs_mapping_tree_free(&fs_info->mapping_tree);
	btrfs_mapping_tree_free(&fs_info->mapping_tree);


#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
	bdi_destroy(&fs_info->bdi);
	bdi_destroy(&fs_info->bdi);
#endif


	kfree(fs_info->extent_root);
	kfree(fs_info->extent_root);
	kfree(fs_info->tree_root);
	kfree(fs_info->tree_root);
Loading