From: Jeff Mahoney <jeffm@suse.com>
To: Linux Btrfs List <linux-btrfs@vger.kernel.org>
Cc: David Sterba <dsterba@suse.com>
Subject: [patch 17/35] btrfs: split extent_state ops
Date: Wed, 21 Mar 2012 21:11:21 -0400 [thread overview]
Message-ID: <20120322011135.373316482@suse.com> (raw)
In-Reply-To: 20120322011104.212214639@suse.com
set_extent_bit can do exclusive locking but only when called by lock_extent*,
Drop the exclusive bits argument except when called by lock_extent.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/btrfs/extent_io.c | 36 +++++++++++++++++++++++-------------
fs/btrfs/extent_io.h | 2 +-
fs/btrfs/inode.c | 2 +-
3 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 0112c02..ffa7cc3 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -721,9 +721,10 @@ static void uncache_state(struct extent_state **cached_ptr)
* [start, end] is inclusive This takes the tree lock.
*/
-int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
- int bits, int exclusive_bits, u64 *failed_start,
- struct extent_state **cached_state, gfp_t mask)
+static int __must_check
+__set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
+ int bits, int exclusive_bits, u64 *failed_start,
+ struct extent_state **cached_state, gfp_t mask)
{
struct extent_state *state;
struct extent_state *prealloc = NULL;
@@ -917,6 +918,15 @@ search_again:
goto again;
}
+int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits,
+ u64 *failed_start, struct extent_state **cached_state,
+ gfp_t mask)
+{
+ return __set_extent_bit(tree, start, end, bits, 0, failed_start,
+ cached_state, mask);
+}
+
+
/**
* convert_extent - convert all bits in a given range from one bit to another
* @tree: the io tree to search
@@ -1111,14 +1121,14 @@ search_again:
int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
gfp_t mask)
{
- return set_extent_bit(tree, start, end, EXTENT_DIRTY, 0, NULL,
+ return set_extent_bit(tree, start, end, EXTENT_DIRTY, NULL,
NULL, mask);
}
int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, gfp_t mask)
{
- return set_extent_bit(tree, start, end, bits, 0, NULL,
+ return set_extent_bit(tree, start, end, bits, NULL,
NULL, mask);
}
@@ -1133,7 +1143,7 @@ int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end,
{
return set_extent_bit(tree, start, end,
EXTENT_DELALLOC | EXTENT_UPTODATE,
- 0, NULL, cached_state, mask);
+ NULL, cached_state, mask);
}
int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
@@ -1147,7 +1157,7 @@ int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
int set_extent_new(struct extent_io_tree *tree, u64 start, u64 end,
gfp_t mask)
{
- return set_extent_bit(tree, start, end, EXTENT_NEW, 0, NULL,
+ return set_extent_bit(tree, start, end, EXTENT_NEW, NULL,
NULL, mask);
}
@@ -1155,7 +1165,7 @@ int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached_state, gfp_t mask)
{
return set_extent_bit(tree, start, end, EXTENT_UPTODATE, 0,
- NULL, cached_state, mask);
+ cached_state, mask);
}
static int clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
@@ -1176,9 +1186,9 @@ int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int err;
u64 failed_start;
while (1) {
- err = set_extent_bit(tree, start, end, EXTENT_LOCKED | bits,
- EXTENT_LOCKED, &failed_start,
- cached_state, GFP_NOFS);
+ err = __set_extent_bit(tree, start, end, EXTENT_LOCKED | bits,
+ EXTENT_LOCKED, &failed_start,
+ cached_state, GFP_NOFS);
if (err == -EEXIST) {
wait_extent_bit(tree, failed_start, end, EXTENT_LOCKED);
start = failed_start;
@@ -1199,8 +1209,8 @@ int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end)
int err;
u64 failed_start;
- err = set_extent_bit(tree, start, end, EXTENT_LOCKED, EXTENT_LOCKED,
- &failed_start, NULL, GFP_NOFS);
+ err = __set_extent_bit(tree, start, end, EXTENT_LOCKED, EXTENT_LOCKED,
+ &failed_start, NULL, GFP_NOFS);
if (err == -EEXIST) {
if (failed_start > start)
clear_extent_bit(tree, start, failed_start - 1,
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 439e183..3a171c2 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -209,7 +209,7 @@ int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, gfp_t mask);
int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
- int bits, int exclusive_bits, u64 *failed_start,
+ int bits, u64 *failed_start,
struct extent_state **cached_state, gfp_t mask);
int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached_state, gfp_t mask);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d16bf3f..593a2c3 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6233,7 +6233,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
if (writing) {
write_bits = EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING;
ret = set_extent_bit(&BTRFS_I(inode)->io_tree, lockstart, lockend,
- EXTENT_DELALLOC, 0, NULL, &cached_state,
+ EXTENT_DELALLOC, NULL, &cached_state,
GFP_NOFS);
if (ret) {
clear_extent_bit(&BTRFS_I(inode)->io_tree, lockstart,
--
1.7.9
next prev parent reply other threads:[~2012-03-22 1:11 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-22 1:11 [patch 00/35] btrfs: Error Handling Patchset Jeff Mahoney
2012-03-22 1:11 ` [patch 01/35] btrfs: Add btrfs_panic() Jeff Mahoney
2012-03-22 1:11 ` [patch 02/35] btrfs: Catch locking failures in {set,clear,convert}_extent_bit Jeff Mahoney
2012-03-22 1:11 ` [patch 03/35] btrfs: Panic on bad rbtree operations Jeff Mahoney
2012-03-22 1:11 ` [patch 04/35] btrfs: Fix kfree of member instead of structure Jeff Mahoney
2012-03-22 1:11 ` [patch 05/35] btrfs: Simplify btrfs_insert_root Jeff Mahoney
2012-03-22 1:11 ` [patch 06/35] btrfs: clean_tree_block should panic on observed memory corruption and return void Jeff Mahoney
2012-03-22 1:11 ` [patch 07/35] btrfs: avoid NULL deref in btrfs_reserve_extent with DEBUG_ENOSPC Jeff Mahoney
2012-03-22 1:11 ` [patch 08/35] btrfs: Remove set bits return from clear_extent_bit Jeff Mahoney
2012-03-22 2:03 ` Liu Bo
2012-03-22 2:34 ` Jeff Mahoney
2012-03-22 1:11 ` [patch 09/35] btrfs: find_and_setup_root error push-up Jeff Mahoney
2012-03-22 1:11 ` [patch 10/35] btrfs: btrfs_update_root " Jeff Mahoney
2012-03-22 1:11 ` [patch 11/35] btrfs: Simplify btrfs_submit_bio_hook Jeff Mahoney
2012-03-22 1:11 ` [patch 12/35] btrfs: Factor out tree->ops->merge_bio_hook call Jeff Mahoney
2012-03-22 1:11 ` [patch 13/35] btrfs: ->submit_bio_hook error push-up Jeff Mahoney
2012-03-22 1:11 ` [patch 14/35] btrfs: __add_reloc_root " Jeff Mahoney
2012-03-22 1:11 ` [patch 15/35] btrfs: return void in functions without error conditions Jeff Mahoney
2012-03-22 1:11 ` [patch 16/35] btrfs: drop gfp_t from lock_extent Jeff Mahoney
2012-03-22 1:11 ` Jeff Mahoney [this message]
2012-03-22 1:56 ` [patch 17/35] btrfs: split extent_state ops Liu Bo
2012-03-22 2:35 ` Jeff Mahoney
2012-03-22 1:11 ` [patch 18/35] btrfs: btrfs_drop_snapshot should return int Jeff Mahoney
2012-03-22 1:11 ` [patch 19/35] btrfs: Dont BUG_ON errors from btrfs_create_subvol_root() Jeff Mahoney
2012-03-22 1:11 ` [patch 20/35] btrfs: Dont BUG_ON() errors in update_ref_for_cow() Jeff Mahoney
2012-03-22 1:11 ` [patch 21/35] btrfs: Dont BUG_ON kzalloc error in btrfs_lookup_csums_range() Jeff Mahoney
2012-03-22 1:11 ` [patch 22/35] btrfs: Dont BUG_ON errors in __finish_chunk_alloc() Jeff Mahoney
2012-03-22 1:11 ` [patch 23/35] btrfs: Go readonly on bad extent refs in update_ref_for_cow() Jeff Mahoney
2012-03-22 1:11 ` [patch 24/35] btrfs: Dont BUG_ON errors from update_ref_for_cow() Jeff Mahoney
2012-03-22 1:11 ` [patch 25/35] btrfs: Go readonly on tree errors in balance_level Jeff Mahoney
2012-03-22 1:11 ` [patch 26/35] btrfs: Dont BUG_ON insert errors in btrfs_alloc_dev_extent() Jeff Mahoney
2012-03-22 1:11 ` [patch 27/35] btrfs: Remove BUG_ON from __btrfs_alloc_chunk() Jeff Mahoney
2012-03-22 1:11 ` [patch 28/35] btrfs: Remove BUG_ON from __finish_chunk_alloc() Jeff Mahoney
2012-03-22 1:11 ` [patch 29/35] btrfs: add varargs to btrfs_error Jeff Mahoney
2012-03-22 1:11 ` [patch 30/35] btrfs: enhance transaction abort infrastructure Jeff Mahoney
2012-03-22 1:11 ` [patch 32/35] btrfs: Fix busyloop in transaction_kthread() Jeff Mahoney
2012-03-22 1:11 ` [patch 33/35] btrfs: handle errors when excluding super extents Jeff Mahoney
2012-03-23 17:21 ` David Sterba
2012-03-22 1:11 ` [patch 34/35] btrfs: enhance superblock sanity checks Jeff Mahoney
2012-03-22 1:11 ` [patch 35/35] btrfs: disallow unequal data/metadata blocksize for mixed block groups Jeff Mahoney
2012-03-22 16:02 ` Stefan Behrens
2012-03-23 17:13 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120322011135.373316482@suse.com \
--to=jeffm@suse.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).