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

Commit 15916de8 authored by Chris Mason's avatar Chris Mason
Browse files

Btrfs: Fixes for 2.6.28-rc API changes



* open/close_bdev_excl -> open/close_bdev_exclusive
* blkdev_issue_discard takes a GFP mask now
* Fix blkdev_issue_discard usage now that it is enabled

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent ae20a6af
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -21,4 +21,11 @@ static inline struct dentry *d_obtain_alias(struct inode *inode)
}
}
#endif
#endif


#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
# define  __pagevec_lru_add_file __pagevec_lru_add
# define open_bdev_exclusive open_bdev_excl
# define close_bdev_exclusive(bdev, mode) close_bdev_excl(bdev)
#endif


#endif /* _COMPAT_H_ */
#endif /* _COMPAT_H_ */
+2 −2
Original line number Original line Diff line number Diff line
@@ -419,7 +419,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
		/* open coding of lru_cache_add, also not exported */
		/* open coding of lru_cache_add, also not exported */
		page_cache_get(page);
		page_cache_get(page);
		if (!pagevec_add(&pvec, page))
		if (!pagevec_add(&pvec, page))
			__pagevec_lru_add(&pvec);
			__pagevec_lru_add_file(&pvec);


		end = last_offset + PAGE_CACHE_SIZE - 1;
		end = last_offset + PAGE_CACHE_SIZE - 1;
		/*
		/*
@@ -475,7 +475,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
		last_offset += PAGE_CACHE_SIZE;
		last_offset += PAGE_CACHE_SIZE;
	}
	}
	if (pagevec_count(&pvec))
	if (pagevec_count(&pvec))
		__pagevec_lru_add(&pvec);
		__pagevec_lru_add_file(&pvec);
	return 0;
	return 0;
}
}


+20 −7
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@
#include "volumes.h"
#include "volumes.h"
#include "locking.h"
#include "locking.h"
#include "ref-cache.h"
#include "ref-cache.h"
#include "compat.h"


#define PENDING_EXTENT_INSERT 0
#define PENDING_EXTENT_INSERT 0
#define PENDING_EXTENT_DELETE 1
#define PENDING_EXTENT_DELETE 1
@@ -899,6 +900,17 @@ static int noinline remove_extent_backref(struct btrfs_trans_handle *trans,
	return ret;
	return ret;
}
}


static void btrfs_issue_discard(struct block_device *bdev,
				u64 start, u64 len)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
	blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL);
#else
	blkdev_issue_discard(bdev, start >> 9, len >> 9);
#endif
}


static int noinline free_extents(struct btrfs_trans_handle *trans,
static int noinline free_extents(struct btrfs_trans_handle *trans,
				 struct btrfs_root *extent_root,
				 struct btrfs_root *extent_root,
				 struct list_head *del_list)
				 struct list_head *del_list)
@@ -1108,6 +1120,7 @@ static int noinline free_extents(struct btrfs_trans_handle *trans,
			BUG_ON(ret);
			BUG_ON(ret);


#ifdef BIO_RW_DISCARD
#ifdef BIO_RW_DISCARD
			map_length = tmp->num_bytes;
			ret = btrfs_map_block(&info->mapping_tree, READ,
			ret = btrfs_map_block(&info->mapping_tree, READ,
					      tmp->bytenr, &map_length, &multi,
					      tmp->bytenr, &map_length, &multi,
					      0);
					      0);
@@ -1115,16 +1128,16 @@ static int noinline free_extents(struct btrfs_trans_handle *trans,
				struct btrfs_bio_stripe *stripe;
				struct btrfs_bio_stripe *stripe;
				int i;
				int i;


				stripe = multi->stripe;
				stripe = multi->stripes;


				if (map_length > tmp->num_bytes)
				if (map_length > tmp->num_bytes)
					map_length = tmp->num_bytes;
					map_length = tmp->num_bytes;


				for (i = 0; i < multi->num_stripes;
				for (i = 0; i < multi->num_stripes;
				     i++, stripe++)
				     i++, stripe++)
					blkdev_issue_discard(stripe->dev->bdev,
					btrfs_issue_discard(stripe->dev->bdev,
							stripe->physical >> 9,
							    stripe->physical,
							map_length >> 9);
							    map_length);
				kfree(multi);
				kfree(multi);
			}
			}
#endif
#endif
@@ -2498,9 +2511,9 @@ static int __free_extent(struct btrfs_trans_handle *trans,
				map_length = num_bytes;
				map_length = num_bytes;


			for (i = 0; i < multi->num_stripes; i++, stripe++) {
			for (i = 0; i < multi->num_stripes; i++, stripe++) {
				blkdev_issue_discard(stripe->dev->bdev,
				btrfs_issue_discard(stripe->dev->bdev,
						     stripe->physical >> 9,
						    stripe->physical,
						     map_length >> 9);
						     map_length);
			}
			}
			kfree(multi);
			kfree(multi);
		}
		}
+2 −2
Original line number Original line Diff line number Diff line
@@ -2639,14 +2639,14 @@ int extent_readpages(struct extent_io_tree *tree,
			/* open coding of lru_cache_add, also not exported */
			/* open coding of lru_cache_add, also not exported */
			page_cache_get(page);
			page_cache_get(page);
			if (!pagevec_add(&pvec, page))
			if (!pagevec_add(&pvec, page))
				__pagevec_lru_add(&pvec);
				__pagevec_lru_add_file(&pvec);
			__extent_read_full_page(tree, page, get_extent,
			__extent_read_full_page(tree, page, get_extent,
						&bio, 0, &bio_flags);
						&bio, 0, &bio_flags);
		}
		}
		page_cache_release(page);
		page_cache_release(page);
	}
	}
	if (pagevec_count(&pvec))
	if (pagevec_count(&pvec))
		__pagevec_lru_add(&pvec);
		__pagevec_lru_add_file(&pvec);
	BUG_ON(!list_empty(pages));
	BUG_ON(!list_empty(pages));
	if (bio)
	if (bio)
		submit_one_bio(READ, bio, 0, bio_flags);
		submit_one_bio(READ, bio, 0, bio_flags);
+17 −17
Original line number Original line Diff line number Diff line
@@ -8,23 +8,23 @@
 
 
v="v0.16"
v="v0.16"


which hg > /dev/null
which git &> /dev/null
if [ -d .hg ] && [ $? == 0 ]; then
if [ $? == 0 ]; then
	last=$(hg tags | grep -m1 -o '^v[0-9.]\+')
    git branch >& /dev/null
    if [ $? == 0 ]; then
	    if head=`git rev-parse --verify HEAD 2>/dev/null`; then
		if tag=`git describe --tags 2>/dev/null`; then
		    v="$tag"
		fi


	# now check if the repo has commits since then...
		# Are there uncommitted changes?
	if [[ $(hg id -t) == $last || \
		git update-index --refresh --unmerged > /dev/null
	    $(hg di -r "$last:." | awk '/^diff/{print $NF}' | sort -u) == .hgtags ]]
		if git diff-index --name-only HEAD | \
	then
		    grep -v "^scripts/package" \
	    # check if it's dirty
		    | read dummy; then
	    if [[ $(hg id | cut -d' ' -f1) == *+ ]]; then
		    v="$v"-dirty
		v=$last+
		fi
	    else
		v=$last
	    fi
	    fi
	else
	    # includes dirty flag
	    v=$last+$(hg id -i)
    fi
    fi
fi
fi
 
 
Loading