btrfs encryption problems

2011-11-23 Thread 810d4rk
Hi to all, I have a hard drive encrypted using the gnome disk utility
and it is formated with with btrfs and GUID, the problem started when
moving a 4gb file to other disk it stooped saying input output error I
think, then when I tried to access it I entered the password to
decrypt and it now says that I must specify filesystem type so it
doesn't recognize the filesystem, I used 3.0 kernel, meanwhile I
upgraded to 3.1, I have a backup of important files in other disk the
problem is that it is also encrypted and it has btrfs so I don't touch
it for now, can anyone help here?

-- 
Thanks
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs encryption problems

2011-11-23 Thread Sander
810d4rk wrote (ao):
 Hi to all, I have a hard drive encrypted using the gnome disk utility
 and it is formated with with btrfs and GUID, the problem started when
 moving a 4gb file to other disk it stooped saying input output error I
 think, then when I tried to access it I entered the password to
 decrypt and it now says that I must specify filesystem type so it
 doesn't recognize the filesystem, I used 3.0 kernel, meanwhile I
 upgraded to 3.1, I have a backup of important files in other disk the
 problem is that it is also encrypted and it has btrfs so I don't touch
 it for now, can anyone help here?

dd that backup disk to another disk, so you have a backup of your
backup, and work with that.

You can also post the dmesg output you get when you mount the broken
filesystem, and ask the experts if it might be worth to try experimental
btrfs.fsck on it.

Sander

fwiw, I backup to gpg encrypted files stored on ext4 to cope with
regressions in both btrfs and disk encryption.

-- 
Humilis IT Services and Solutions
http://www.humilis.net
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Announcing btrfs-gui

2011-11-23 Thread Hugo Mills
On Sat, Nov 12, 2011 at 01:24:57AM +0100, Amedee Van Gasse wrote:
 On 02-06-11 01:20, Hugo Mills wrote:
 Unless the traffic gets too high-volume, or unless someone
 important objects, I'm going to suggest that bug reports should go to
 this list for now (cc'd me, if you like). Note that this isn't an
 offical btrfs project -- it's just something I knocked together on
 my own.
 
 
 I seem to have stumbled upon a bug.
 During install, Ubuntu gives the user the option to use btrfs as the
 root filesystem. It automatically creates two subvolumes, @ (for /)
 and @home (for /home, only if no other partition is used for /home),
 like this:
 
 mount | grep btrfs
 /dev/sda6 on / type btrfs (rw,subvol=@)
 /dev/sda6 on /home type btrfs (rw,subvol=@home)
 /dev/sda6 on
 /tmp/btrfs-gui-kl6zx1/12624/eba4f1e9-5b55-4e14-abb8-5a3cf3625c56
 type btrfs (rw,subvolid=0)
 
 When gtrfs-gui scans for filesystems, it gives the error
 Root helper exception: b'@' is not JSON serializable
[snip]

   Mmm... That could be fun. :)

   Thanks for the bug report. I hope I'll have time to look into this
next week.

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
   --- The English language has the mot juste for every occasion. ---


signature.asc
Description: Digital signature


Re: [PATCH 0/3] Show Chunks by position

2011-11-23 Thread Hugo Mills
On Tue, Nov 22, 2011 at 08:12:43PM -0500, Phillip Susi wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 11/18/2011 10:50 AM, Phillip Susi wrote:
  This is a nice little tool.  The one suggestion that I have is that
  it display the actual chunks and where they are located.  It seems
  that right now it uses the same ioctl that btrfs fi df uses, and that
  just gets the total combined size for all chunks of a given type.  It
  would be nice if the gui actually parsed the chunk tree and showed
  each individual chunk with lines showing how they are mapped to the
  physical disks.
 
 I managed to cobble together the following patches to implement this.
 The one thing that I still don't like is that the radio knob is in the
 data replication and allocation box, instead of the volumes box.  My
 python and tkinter skills are too lacking to figure out how to move it
 down there.

   Thanks for this. I hope I'll have time to look at it next week.

   Hugo.

 
 Phillip Susi (3):
   Changed volume_df() to return all chunks with their offsets
   Update UsageDisplay to be capable of displaying all chunks by
 position
   Add radio knob to show space by position or combined
 
  btrfsgui/gui/usagedisplay.py |   98
 --
  btrfsgui/hlp/size.py |   18 +++
  2 files changed, 73 insertions(+), 43 deletions(-)
 
 - -- 
 1.7.5.4
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iEYEARECAAYFAk7MSIoACgkQJ4UciIs+XuLyjQCeI4m7+u75R863B2RY3hkFELbP
 iJ8AoJwzVdiYZqgE1tXvHEOHz+gciDgj
 =dfd1
 -END PGP SIGNATURE-

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
   --- The English language has the mot juste for every occasion. ---


signature.asc
Description: Digital signature


btrfs and load (sys)

2011-11-23 Thread krz...@gmail.com
I've been using btrfs for two months now. Every day between 02:00 and
08:00 I rsync some 300GB data (milions of files) to btrfs device and
then make snapshot. Next day i rsync again 300GG little changed (rsync
in place). First days it worked perfectly. Then loadavg (sys load)
started to rise. Now, after 60 days of rsync+shapshots sys load is so
high that whole server becames quite unresponsive betweend 02:00 and
08:00. I never deleted any shapshot (yet) to its not rebalancing
thing.
What all those btrfs benchmark does not tell you that its performance
decreases (sys load increases) with growing size of btree. Creating
btrfs filesystem is instantaneous because initial tree is just
nothing...
I tried using btrfs and nilfs2 for a half year now and I would never
trust a byte of production data to it.
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and load (sys)

2011-11-23 Thread krz...@gmail.com
Yes, yesterday I've umouted partition and re-mounted it. Nothing has
changed this night.

You can look at my load graphs here:
http://img42.imageshack.us/img42/4661/33737291.png
http://img210.imageshack.us/img210/2742/46527625.png

On the second one blue is SYS load. I bet you can reasily spot time
when backup to btrfs partition was running :)

I doubt its a bug in btrfs. It is just broken concept :(


# uname -a
Linux sv15.vipserv.org 3.0.4--std-ipv6-64 #1 SMP Mon Oct 10
01:07:40 CEST 2011 x86_64 x86_64 x86_64 GNU/Linux
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: rewrite btrfs_trim_block_group()

2011-11-23 Thread David Sterba
On Thu, Nov 17, 2011 at 03:26:17PM +0800, Li Zefan wrote:
 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
 index 8c32434..89cc54e 100644
 --- a/fs/btrfs/free-space-cache.c
 +++ b/fs/btrfs/free-space-cache.c
 +static int trim_no_bitmap(struct btrfs_block_group_cache *block_group,
 +   u64 *total_trimmed, u64 start, u64 end, u64 minlen)
 +{
 + struct btrfs_free_space_ctl *ctl = block_group-free_space_ctl;
 + struct btrfs_free_space *entry;
 + struct rb_node *node;
 + int ret;
int ret = 0;

  CC [M]  fs/btrfs/free-space-cache.o
fs/btrfs/free-space-cache.c: In function trim_no_bitmap:
fs/btrfs/free-space-cache.c:2636: warning: ret may be used uninitialized in 
this function

Although it seems the uninitialized value could never be returned.


david
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


mounting btrfs FS on zfs zvol hangs

2011-11-23 Thread Stephane Chazelas
Hiya,

yes, you'll probably think that is crazy, but after observing
better performance with btrfs in some work loads on md RAID5
than btrfs builtin RAID10, I thought I'd try btrfs on zfs
(in-kernel, not fuse) zvol (on raidz) just for a laugh.

While this procedure worked for ext4 and xfs, for btrfs, the
mount hangs suggesting there might be something wrong with btrfs
and/or zfs.

Here's what I'm doing:

zpool create X raidz /dev/sd{a,b,c,d,e,f}
zfs create -V 6T -o refreservation=0 X/Y
mkfs.btrfs /dev/zvol/X/Y
mount /dev/zvol/X/Y /mnt

backtrace for mount:

mount   D 0009 0  2193   1761 0x
 880401b4d9a8 0082 0001 
 880401b4dfd8 880401b4dfd8 880401b4dfd8 00012a40
 8802092f 88040ef7dc80 880401b4d988 88041fa732c0
Call Trace:
 [81109af0] ? __lock_page+0x70/0x70
 [81056e9f] schedule+0x3f/0x60
 [815e85af] io_schedule+0x8f/0xd0
 [81109afe] sleep_on_page+0xe/0x20
 [815e8dcf] __wait_on_bit+0x5f/0x90
 [81109c68] wait_on_page_bit+0x78/0x80
 [81081d80] ? autoremove_wake_function+0x40/0x40
 [a041ab7a] read_extent_buffer_pages+0x3ca/0x430 [btrfs]
 [a03eec40] ? btrfs_destroy_pinned_extent+0xb0/0xb0 [btrfs]
 [a03f0daa] btree_read_extent_buffer_pages.isra.62+0x8a/0xc0 [btrfs]
 [a03f2021] read_tree_block+0x41/0x60 [btrfs]
 [a03f4735] open_ctree+0xe75/0x1760 [btrfs]
 [812f2f64] ? snprintf+0x34/0x40
 [a03d1438] btrfs_fill_super.isra.38+0x78/0x150 [btrfs]
 [811cf55a] ? disk_name+0xba/0xc0
 [812efbd7] ? strlcpy+0x47/0x60
 [a03d2806] btrfs_mount+0x3c6/0x470 [btrfs]
 [8116ae13] mount_fs+0x43/0x1b0
 [8118565a] vfs_kern_mount+0x6a/0xc0
 [81186a54] do_kern_mount+0x54/0x110
 [811884f4] do_mount+0x1a4/0x260
 [81188990] sys_mount+0x90/0xe0
 [815f27c2] system_call_fastpath+0x16/0x1b

3.0.0-13-generic #22-Ubuntu SMP Wed Nov 2 13:27:26 UTC 2011
x86_64

Best regards,
Stephane
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: fsck with err is 1

2011-11-23 Thread Blair Zajac

On Nov 22, 2011, at 10:02 PM, Fajar A. Nugraha wrote:

 On Wed, Nov 23, 2011 at 12:33 PM, Blair Zajac bl...@orcaware.com wrote:
 Hello,
 
 I'm trying btrfs in a VirtualBox VM running Ubuntu 11.10 with kernel 3.0.0.  
 Running fsck I get a message with err is 1.
 
 Does this mean there's an error?  Is err either always 0 or 1, or does err 
 increment beyond 1?
 
 I can't answer that, but I can tell you that fsck for btrfs right now
 is almost useless. It can't fix anyting.

Thank you, I've read that fsck doesn't fix anything.  I was curious if doing 
the scrub would resolve it.

Blair

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and load (sys)

2011-11-23 Thread Phillip Susi

On 11/23/2011 9:43 AM, krz...@gmail.com wrote:

What all those btrfs benchmark does not tell you that its performance
decreases (sys load increases) with growing size of btree. Creating
btrfs filesystem is instantaneous because initial tree is just
nothing...


While something is clearly wrong, this isn't it.  Each snapshot is its 
own btree, and you said there is little churn each day, so they aren't 
getting significantly larger over time.  Each snapshot is tracked in the 
tree of tree roots, so technically it is growing each time you take a 
snapshot, but 60 items is nothing.


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


stripe alignment consideration for btrfs on RAID5

2011-11-23 Thread Stephane CHAZELAS
Hiya,

is there any recommendation out there to setup a btrfs FS on top
of hardware or software raid5 or raid6 wrt stripe/stride alignment?

From mkfs.btrfs, it doesn't look like there's much that can be
adjusted that would help, and what I'm asking might not even
make sense for btrfs but I thought I'd just ask.

Thanks,
Stephane

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: stripe alignment consideration for btrfs on RAID5

2011-11-23 Thread Blair Zajac

On Nov 23, 2011, at 9:04 AM, Stephane CHAZELAS wrote:

 Hiya,
 
 is there any recommendation out there to setup a btrfs FS on top
 of hardware or software raid5 or raid6 wrt stripe/stride alignment?

Isn't the advantage of having btrfs do all the raiding itself so one gets the 
checksums?  If one puts btrfs on top of software or hardware raid, then if 
there is a checksum error, you don't have another copy of the data to fall back 
to.  If one uses btrfs' raid1 or above for data and metadata, then you can 
suffer a checksum failure and get a good copy from another drive?

Blair

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: fsck with err is 1

2011-11-23 Thread Helmut Hullen
Hallo, Blair,

Du meintest am 23.11.11:

 I can't answer that, but I can tell you that fsck for btrfs right
 now is almost useless. It can't fix anyting.

 Thank you, I've read that fsck doesn't fix anything.  I was curious
 if doing the scrub would resolve it.

I had tried ... about 4 Tbyte data have gone.

3 disks bundled with data=raid0, metadata=raid1.

One disk had problems, before I run scrub I could read most files,  
Running scrub: all had gone.

One big problem of btrfs seems to be: you can't see on which partition/ 
disk the defect sector (or something else) may be, if there is 1 error  
in 1 partition you have to restore the complete bundle of disks/ 
partitions.

Yes - I know: btrfs is still under construction.

In my special case: the 4 TByte are a kind of video archive. No  
valuable data, only nice to have. And old people still know the  
behaviour of old 35 mm film and/or VHS cassettes: they have errors. But  
these errors don't damage the whole archive.

Viele Gruesse!
Helmut
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Announcing btrfs-gui

2011-11-23 Thread cwillu
On Wed, Nov 23, 2011 at 6:33 AM, Hugo Mills h...@carfax.org.uk wrote:
 On Sat, Nov 12, 2011 at 01:24:57AM +0100, Amedee Van Gasse wrote:
 On 02-06-11 01:20, Hugo Mills wrote:
     Unless the traffic gets too high-volume, or unless someone
 important objects, I'm going to suggest that bug reports should go to
 this list for now (cc'd me, if you like). Note that this isn't an
 offical btrfs project -- it's just something I knocked together on
 my own.


 I seem to have stumbled upon a bug.
 During install, Ubuntu gives the user the option to use btrfs as the
 root filesystem. It automatically creates two subvolumes, @ (for /)
 and @home (for /home, only if no other partition is used for /home),
 like this:

 mount | grep btrfs
 /dev/sda6 on / type btrfs (rw,subvol=@)
 /dev/sda6 on /home type btrfs (rw,subvol=@home)
 /dev/sda6 on
 /tmp/btrfs-gui-kl6zx1/12624/eba4f1e9-5b55-4e14-abb8-5a3cf3625c56
 type btrfs (rw,subvolid=0)

 When gtrfs-gui scans for filesystems, it gives the error
 Root helper exception: b'@' is not JSON serializable
 [snip]

   Mmm... That could be fun. :)

   Thanks for the bug report. I hope I'll have time to look into this
 next week.

Looks like a unicode screwup; python 3 doesn't do implicit unicode
conversions anymore, so passing a bytestring to the json module isn't
supported.  The solution will be something along the lines of
subvol.decode('ascii') (or possibly utf-8 if you're willing to
silently break on the admittedly obscure case of a non-ascii subvolume
name in an installation using an encoding other than utf-8).
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: fsck with err is 1

2011-11-23 Thread Jan Schmidt
On 23.11.2011 18:32, Helmut Hullen wrote:
 One big problem of btrfs seems to be: you can't see on which partition/ 
 disk the defect sector (or something else) may be

A recent kernel (3.2, still rc) will tell you the byte number when an
error occurs, and also give the the opportunity to resolve this address
to all files affected.

-Jan
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: stripe alignment consideration for btrfs on RAID5

2011-11-23 Thread Stephane CHAZELAS
2011-11-23, 09:08(-08), Blair Zajac:

 On Nov 23, 2011, at 9:04 AM, Stephane CHAZELAS wrote:

 Hiya,
 
 is there any recommendation out there to setup a btrfs FS on top
 of hardware or software raid5 or raid6 wrt stripe/stride alignment?

 Isn't the advantage of having btrfs do all the raiding itself
 so one gets the checksums?  If one puts btrfs on top of
 software or hardware raid, then if there is a checksum error,
 you don't have another copy of the data to fall back to.  If
 one uses btrfs' raid1 or above for data and metadata, then you
 can suffer a checksum failure and get a good copy from another
 drive?
[...]

Yes, but btrfs doesn't support raid5 yet and I have a limited
number of drives I can connect to that system, and storage
capacity is more important for me than the odd chance of
corruptions of odd sectors (which can be mitigated by running
regular RAID checks).

Also, my tests of btrfs raid10 didn't indicate it was reliable
enough yet (when a drive disappears and reappears, btrfs seems
to get quite confused).

-- 
Stephane

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: fsck with err is 1

2011-11-23 Thread Helmut Hullen
Hallo, Jan,

Du meintest am 23.11.11:

 One big problem of btrfs seems to be: you can't see on which
 partition/ disk the defect sector (or something else) may be

 A recent kernel (3.2, still rc) will tell you the byte number when an
 error occurs, and also give the the opportunity to resolve this
 address to all files affected.

May be. I had used the brand new kernel 3.1.

btrfs may be fine when it works as proposed. It's still under heavy  
construction.

I had to rebuild my 4-TByte archive the second time within 1 year -  
that's no reliable system.

May be the situation for really big bundles of disk gets better when  
something like raid 5 does work. I'll wait.

Viele Gruesse!
Helmut
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs encryption problems

2011-11-23 Thread 810d4rk
 dd that backup disk to another disk, so you have a backup of your
 backup, and work with that.

OK.

 You can also post the dmesg output you get when you mount the broken
 filesystem, and ask the experts if it might be worth to try experimental
 btrfs.fsck on it.

dmesg does not output anything of value since the file system is not
detectable, here is the kernel output:

[ 4834.149123] usb 2-1.1: new high speed USB device number 12 using ehci_hcd
[ 4834.245114] scsi20 : usb-storage 2-1.1:1.0
[ 4835.246193] scsi 20:0:0:0: Direct-Access WDC WD75
00BPVT-22HXZT1   1A01 PQ: 0 ANSI: 2 CCS
[ 4835.317195] sd 20:0:0:0: Attached scsi generic sg4 type 0
[ 4835.317889] sd 20:0:0:0: [sdc] 1465149168 512-byte logical blocks:
(750 GB/698 GiB)
[ 4835.318944] sd 20:0:0:0: [sdc] Write Protect is off
[ 4835.318956] sd 20:0:0:0: [sdc] Mode Sense: 00 38 00 00
[ 4835.320603] sd 20:0:0:0: [sdc] Asking for cache data failed
[ 4835.320619] sd 20:0:0:0: [sdc] Assuming drive cache: write through
[ 4835.324143] sd 20:0:0:0: [sdc] Asking for cache data failed
[ 4835.324153] sd 20:0:0:0: [sdc] Assuming drive cache: write through
[ 4836.894263]  sdc: sdc1
[ 4836.897190] sd 20:0:0:0: [sdc] Asking for cache data failed
[ 4836.897200] sd 20:0:0:0: [sdc] Assuming drive cache: write through
[ 4836.897206] sd 20:0:0:0: [sdc] Attached SCSI disk
[ 4844.803652] EXT3-fs (dm-1): error: can't find ext3 filesystem on dev dm-1.
[ 4844.856054] EXT2-fs (dm-1): error: can't find an ext2 filesystem on dev dm-1.
[ 4844.902679] EXT4-fs (dm-1): VFS: Can't find ext4 filesystem
[ 4932.637108] EXT3-fs (dm-1): error: can't find ext3 filesystem on dev dm-1.
[ 4932.686841] EXT2-fs (dm-1): error: can't find an ext2 filesystem on dev dm-1.
[ 4932.738999] EXT4-fs (dm-1): VFS: Can't find ext4 filesystem
[ 4949.142867] EXT3-fs (dm-1): error: can't find ext3 filesystem on dev dm-1.
[ 4949.197596] EXT2-fs (dm-1): error: can't find an ext2 filesystem on dev dm-1.
[ 4949.241721] EXT4-fs (dm-1): VFS: Can't find ext4 filesystem

 fwiw, I backup to gpg encrypted files stored on ext4 to cope with
 regressions in both btrfs and disk encryption.


In my experience btrfs + encryption eats the data, this is not the
first time I had this problem with btrfs so I am considering switching
to ext4, but can I still get the other data back on the broken btrfs??

-- 
Thanks
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] Removed extraneous whitespace from mkfs man page

2011-11-23 Thread Phillip Susi

There were extra spaces around some of the arguments in the man
page for mkfs.
---
 man/mkfs.btrfs.8.in |   19 ++-
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/man/mkfs.btrfs.8.in b/man/mkfs.btrfs.8.in
index 432db1b..542e6cf 100644
--- a/man/mkfs.btrfs.8.in
+++ b/man/mkfs.btrfs.8.in
@@ -5,15 +5,16 @@ mkfs.btrfs \- create an btrfs filesystem
 .B mkfs.btrfs
 [ \fB\-A\fP\fI alloc-start\fP ]
 [ \fB\-b\fP\fI byte-count\fP ]
-[ \fB \-d\fP\fI data-profile\fP ]
-[ \fB \-l\fP\fI leafsize\fP ]
-[ \fB \-L\fP\fI label\fP ]
-[ \fB \-m\fP\fI metadata profile\fP ]
-[ \fB \-M\fP\fI mixed data+metadata\fP ]
-[ \fB \-n\fP\fI nodesize\fP ]
-[ \fB \-s\fP\fI sectorsize\fP ]
-[ \fB \-h\fP ]
-[ \fB \-V\fP ] \fI device\fP [ \fI device ...\fP ]
+[ \fB\-d\fP\fI data-profile\fP ]
+[ \fB\-l\fP\fI leafsize\fP ]
+[ \fB\-L\fP\fI label\fP ]
+[ \fB\-m\fP\fI metadata profile\fP ]
+[ \fB\-M\fP\fI mixed data+metadata\fP ]
+[ \fB\-n\fP\fI nodesize\fP ]
+[ \fB\-s\fP\fI sectorsize\fP ]
+[ \fB\-h\fP ]
+[ \fB\-V\fP ]
+\fI device\fP [ \fIdevice ...\fP ]
 .SH DESCRIPTION
 .B mkfs.btrfs
 is used to create an btrfs filesystem (usually in a disk partition, or an array
--
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Document --rootdir mkfs switch

2011-11-23 Thread Phillip Susi

---
 man/mkfs.btrfs.8.in |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/man/mkfs.btrfs.8.in b/man/mkfs.btrfs.8.in
index 542e6cf..25e817b 100644
--- a/man/mkfs.btrfs.8.in
+++ b/man/mkfs.btrfs.8.in
@@ -12,6 +12,7 @@ mkfs.btrfs \- create an btrfs filesystem
 [ \fB\-M\fP\fI mixed data+metadata\fP ]
 [ \fB\-n\fP\fI nodesize\fP ]
 [ \fB\-s\fP\fI sectorsize\fP ]
+[ \fB\-r\fP\fI rootdir\fP ]
 [ \fB\-h\fP ]
 [ \fB\-V\fP ]
 \fI device\fP [ \fIdevice ...\fP ]
@@ -59,6 +60,9 @@ Specify the nodesize. By default the value is set to the 
pagesize.
 \fB\-s\fR, \fB\-\-sectorsize \fIsize\fR
 Specify the sectorsize, the minimum block allocation.
 .TP
+\fB\-r\fR, \fB\-\-rootdir \fIrootdir\fR
+Specify a directory to copy into the newly created fs.
+.TP
 \fB\-V\fR, \fB\-\-version\fR
 Print the \fBmkfs.btrfs\fP version and exit.
 .SH AVAILABILITY
--
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] Removed extraneous whitespace from mkfs man page

2011-11-23 Thread David Sterba
On Wed, Nov 23, 2011 at 04:25:30PM -0500, Phillip Susi wrote:
 There were extra spaces around some of the arguments in the man
 page for mkfs.

Please resend with Signed-off-by: tag, and it would be helpful to
prepend the subject with eg. btrfs-progs.

thanks,
david
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and load (sys)

2011-11-23 Thread krz...@gmail.com
I've rebooted server and run backup to btrfs partition again. It seems
that problem is gone, high sys load does not occur now. So it is some
bug in btrfs... Before reboot server had 30 days uptime so its really
not much.
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 04/99] btrfs: Simplify btrfs_insert_root

2011-11-23 Thread Jeff Mahoney
 btrfs_insert_root is just a wrapper for btrfs_insert_item. Just return
 the error directly.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/root-tree.c |9 +++--
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index f409990..1fd93d6 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -116,13 +116,10 @@ out:
return ret;
 }
 
-int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root
- *root, struct btrfs_key *key, struct btrfs_root_item
- *item)
+int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root 
*root,
+ struct btrfs_key *key, struct btrfs_root_item *item)
 {
-   int ret;
-   ret = btrfs_insert_item(trans, root, key, item, sizeof(*item));
-   return ret;
+   return btrfs_insert_item(trans, root, key, item, sizeof(*item));
 }
 
 /*



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 45/99] btrfs: run_scheduled_bios should return void

2011-11-23 Thread Jeff Mahoney
 run_scheduled_bios has no error conditions and should return void.
 Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/volumes.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -127,7 +127,7 @@ static void requeue_list(struct btrfs_pe
  * the list if the block device is congested.  This way, multiple devices
  * can make progress from a single worker thread.
  */
-static noinline int run_scheduled_bios(struct btrfs_device *device)
+static noinline void run_scheduled_bios(struct btrfs_device *device)
 {
struct bio *pending;
struct backing_dev_info *bdi;
@@ -307,7 +307,6 @@ loop_lock:
 
 done:
blk_finish_plug(plug);
-   return 0;
 }
 
 static void pending_bios_fn(struct btrfs_work *work)



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 98/99] btrfs: btrfs_destroy_pending_snapshots should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_destroy_pending_snapshots has no error conditions and should
 return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/disk-io.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -53,7 +53,7 @@ static void btrfs_destroy_ordered_operat
 static void btrfs_destroy_ordered_extents(struct btrfs_root *root);
 static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
  struct btrfs_root *root);
-static int btrfs_destroy_pending_snapshots(struct btrfs_transaction *t);
+static void btrfs_destroy_pending_snapshots(struct btrfs_transaction *t);
 static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root);
 static int btrfs_destroy_marked_extents(struct btrfs_root *root,
struct extent_io_tree *dirty_pages,
@@ -3239,7 +3239,7 @@ static int btrfs_destroy_delayed_refs(st
return ret;
 }
 
-static int btrfs_destroy_pending_snapshots(struct btrfs_transaction *t)
+static void btrfs_destroy_pending_snapshots(struct btrfs_transaction *t)
 {
struct btrfs_pending_snapshot *snapshot;
struct list_head splice;
@@ -3257,8 +3257,6 @@ static int btrfs_destroy_pending_snapsho
 
kfree(snapshot);
}
-
-   return 0;
 }
 
 static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root)


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 99/99] btrfs: add_excluded_extent should return void

2011-11-23 Thread Jeff Mahoney
 add_excluded_extent has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent-tree.c |   19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -206,15 +206,14 @@ block_group_cache_tree_search(struct btr
return ret;
 }
 
-static int add_excluded_extent(struct btrfs_root *root,
-  u64 start, u64 num_bytes)
+static void add_excluded_extent(struct btrfs_root *root,
+   u64 start, u64 num_bytes)
 {
u64 end = start + num_bytes - 1;
set_extent_bits(root-fs_info-freed_extents[0],
start, end, EXTENT_UPTODATE);
set_extent_bits(root-fs_info-freed_extents[1],
start, end, EXTENT_UPTODATE);
-   return 0;
 }
 
 static void free_excluded_extents(struct btrfs_root *root,
@@ -242,9 +241,7 @@ static int exclude_super_stripes(struct
if (cache-key.objectid  BTRFS_SUPER_INFO_OFFSET) {
stripe_len = BTRFS_SUPER_INFO_OFFSET - cache-key.objectid;
cache-bytes_super += stripe_len;
-   ret = add_excluded_extent(root, cache-key.objectid,
- stripe_len);
-   BUG_ON(ret);
+   add_excluded_extent(root, cache-key.objectid, stripe_len);
}
 
for (i = 0; i  BTRFS_SUPER_MIRROR_MAX; i++) {
@@ -256,9 +253,7 @@ static int exclude_super_stripes(struct
 
while (nr--) {
cache-bytes_super += stripe_len;
-   ret = add_excluded_extent(root, logical[nr],
- stripe_len);
-   BUG_ON(ret);
+   add_excluded_extent(root, logical[nr], stripe_len);
}
 
kfree(logical);
@@ -5789,8 +5784,7 @@ int btrfs_alloc_logged_file_extent(struc
mutex_lock(caching_ctl-mutex);
 
if (start = caching_ctl-progress) {
-   ret = add_excluded_extent(root, start, num_bytes);
-   BUG_ON(ret);
+   add_excluded_extent(root, start, num_bytes);
} else if (start + num_bytes = caching_ctl-progress) {
ret = btrfs_remove_free_space(block_group,
  start, num_bytes);
@@ -5804,8 +5798,7 @@ int btrfs_alloc_logged_file_extent(struc
start = caching_ctl-progress;
num_bytes = ins-objectid + ins-offset -
caching_ctl-progress;
-   ret = add_excluded_extent(root, start, num_bytes);
-   BUG_ON(ret);
+   add_excluded_extent(root, start, num_bytes);
}
 
mutex_unlock(caching_ctl-mutex);


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 94/99] btrfs: btrfs_free_fs_root should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_free_fs_root has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/disk-io.c |3 +--
 fs/btrfs/disk-io.h |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2733,7 +2733,7 @@ int write_ctree_super(struct btrfs_trans
return ret;
 }
 
-int btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root)
+void btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root)
 {
spin_lock(fs_info-fs_roots_radix_lock);
radix_tree_delete(fs_info-fs_roots_radix,
@@ -2746,7 +2746,6 @@ int btrfs_free_fs_root(struct btrfs_fs_i
__btrfs_remove_free_space_cache(root-free_ino_pinned);
__btrfs_remove_free_space_cache(root-free_ino_ctl);
free_fs_root(root);
-   return 0;
 }
 
 static void free_fs_root(struct btrfs_root *root)
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -64,7 +64,7 @@ struct btrfs_root *btrfs_read_fs_root_no
 int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info);
 void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr);
 void __btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr);
-int btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root);
+void btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root 
*root);
 void btrfs_mark_buffer_dirty(struct extent_buffer *buf);
 int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid);
 void btrfs_set_buffer_uptodate(struct extent_buffer *buf);


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 92/99] btrfs: btrfs_add_ordered_operation should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_add_ordered_operation has no error conditions and should return void

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ordered-data.c |   11 ---
 fs/btrfs/ordered-data.h |6 +++---
 2 files changed, 7 insertions(+), 10 deletions(-)

--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -946,9 +946,8 @@ out:
  * If trans is not null, we'll do a friendly check for a transaction that
  * is already flushing things and force the IO down ourselves.
  */
-int btrfs_add_ordered_operation(struct btrfs_trans_handle *trans,
-   struct btrfs_root *root,
-   struct inode *inode)
+void btrfs_add_ordered_operation(struct btrfs_trans_handle *trans,
+struct btrfs_root *root, struct inode *inode)
 {
u64 last_mod;
 
@@ -959,7 +958,7 @@ int btrfs_add_ordered_operation(struct b
 * commit, we can safely return without doing anything
 */
if (last_mod  root-fs_info-last_trans_committed)
-   return 0;
+   return;
 
/*
 * the transaction is already committing.  Just start the IO and
@@ -967,7 +966,7 @@ int btrfs_add_ordered_operation(struct b
 */
if (trans  root-fs_info-running_transaction-blocked) {
btrfs_wait_ordered_range(inode, 0, (u64)-1);
-   return 0;
+   return;
}
 
spin_lock(root-fs_info-ordered_extent_lock);
@@ -976,6 +975,4 @@ int btrfs_add_ordered_operation(struct b
  root-fs_info-ordered_operations);
}
spin_unlock(root-fs_info-ordered_extent_lock);
-
-   return 0;
 }
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -171,9 +171,9 @@ int btrfs_ordered_update_i_size(struct i
struct btrfs_ordered_extent *ordered);
 int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr, 
u32 *sum);
 void btrfs_run_ordered_operations(struct btrfs_root *root, int wait);
-int btrfs_add_ordered_operation(struct btrfs_trans_handle *trans,
-   struct btrfs_root *root,
-   struct inode *inode);
+void btrfs_add_ordered_operation(struct btrfs_trans_handle *trans,
+struct btrfs_root *root,
+struct inode *inode);
 void btrfs_wait_ordered_extents(struct btrfs_root *root,
int nocow_only, int delay_iput);
 #endif


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 97/99] btrfs: btrfs_destroy_ordered_extents should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_destroy_ordered_extents has no error conditions and should return
 void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/disk-io.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -50,7 +50,7 @@ static void free_fs_root(struct btrfs_ro
 static void btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
int read_only);
 static void btrfs_destroy_ordered_operations(struct btrfs_root *root);
-static int btrfs_destroy_ordered_extents(struct btrfs_root *root);
+static void btrfs_destroy_ordered_extents(struct btrfs_root *root);
 static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
  struct btrfs_root *root);
 static int btrfs_destroy_pending_snapshots(struct btrfs_transaction *t);
@@ -3153,7 +3153,7 @@ static void btrfs_destroy_ordered_operat
mutex_unlock(root-fs_info-ordered_operations_mutex);
 }
 
-static int btrfs_destroy_ordered_extents(struct btrfs_root *root)
+static void btrfs_destroy_ordered_extents(struct btrfs_root *root)
 {
struct list_head splice;
struct btrfs_ordered_extent *ordered;
@@ -3185,8 +3185,6 @@ static int btrfs_destroy_ordered_extents
}
 
spin_unlock(root-fs_info-ordered_extent_lock);
-
-   return 0;
 }
 
 static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 95/99] btrfs: del_fs_roots should return void

2011-11-23 Thread Jeff Mahoney
 del_fs_roots has no error conditions and should return void

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/disk-io.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2764,7 +2764,7 @@ static void free_fs_root(struct btrfs_ro
kfree(root);
 }
 
-static int del_fs_roots(struct btrfs_fs_info *fs_info)
+static void del_fs_roots(struct btrfs_fs_info *fs_info)
 {
int ret;
struct btrfs_root *gang[8];
@@ -2793,7 +2793,6 @@ static int del_fs_roots(struct btrfs_fs_
for (i = 0; i  ret; i++)
btrfs_free_fs_root(fs_info, gang[i]);
}
-   return 0;
 }
 
 int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info)


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 93/99] btrfs: btrfs_add_ordered_sum should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_add_ordered_sum has no error conditions and should return void

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ordered-data.c |7 +++
 fs/btrfs/ordered-data.h |6 +++---
 2 files changed, 6 insertions(+), 7 deletions(-)

--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -257,9 +257,9 @@ int btrfs_add_ordered_extent_compress(st
  * when an ordered extent is finished.  If the list covers more than one
  * ordered extent, it is split across multiples.
  */
-int btrfs_add_ordered_sum(struct inode *inode,
- struct btrfs_ordered_extent *entry,
- struct btrfs_ordered_sum *sum)
+void btrfs_add_ordered_sum(struct inode *inode,
+  struct btrfs_ordered_extent *entry,
+  struct btrfs_ordered_sum *sum)
 {
struct btrfs_ordered_inode_tree *tree;
 
@@ -267,7 +267,6 @@ int btrfs_add_ordered_sum(struct inode *
spin_lock(tree-lock);
list_add_tail(sum-list, entry-list);
spin_unlock(tree-lock);
-   return 0;
 }
 
 /*
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -154,9 +154,9 @@ int btrfs_add_ordered_extent_dio(struct
 int btrfs_add_ordered_extent_compress(struct inode *inode, u64 file_offset,
  u64 start, u64 len, u64 disk_len,
  int type, int compress_type);
-int btrfs_add_ordered_sum(struct inode *inode,
- struct btrfs_ordered_extent *entry,
- struct btrfs_ordered_sum *sum);
+void btrfs_add_ordered_sum(struct inode *inode,
+  struct btrfs_ordered_extent *entry,
+  struct btrfs_ordered_sum *sum);
 struct btrfs_ordered_extent *btrfs_lookup_ordered_extent(struct inode *inode,
 u64 file_offset);
 void btrfs_start_ordered_extent(struct inode *inode,


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 96/99] btrfs: btrfs_destroy_ordered_operations should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_destroy_ordered_operations has no error conditions and should
 return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/disk-io.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -49,7 +49,7 @@ static void end_workqueue_fn(struct btrf
 static void free_fs_root(struct btrfs_root *root);
 static void btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
int read_only);
-static int btrfs_destroy_ordered_operations(struct btrfs_root *root);
+static void btrfs_destroy_ordered_operations(struct btrfs_root *root);
 static int btrfs_destroy_ordered_extents(struct btrfs_root *root);
 static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
  struct btrfs_root *root);
@@ -3129,7 +3129,7 @@ int btrfs_error_commit_super(struct btrf
return ret;
 }
 
-static int btrfs_destroy_ordered_operations(struct btrfs_root *root)
+static void btrfs_destroy_ordered_operations(struct btrfs_root *root)
 {
struct btrfs_inode *btrfs_inode;
struct list_head splice;
@@ -3151,8 +3151,6 @@ static int btrfs_destroy_ordered_operati
 
spin_unlock(root-fs_info-ordered_extent_lock);
mutex_unlock(root-fs_info-ordered_operations_mutex);
-
-   return 0;
 }
 
 static int btrfs_destroy_ordered_extents(struct btrfs_root *root)


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 91/99] btrfs: btrfs_run_ordered_operations should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_run_ordered_operations has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ordered-data.c |4 +---
 fs/btrfs/ordered-data.h |2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -526,7 +526,7 @@ void btrfs_wait_ordered_extents(struct b
  * extra check to make sure the ordered operation list really is empty
  * before we return
  */
-int btrfs_run_ordered_operations(struct btrfs_root *root, int wait)
+void btrfs_run_ordered_operations(struct btrfs_root *root, int wait)
 {
struct btrfs_inode *btrfs_inode;
struct inode *inode;
@@ -574,8 +574,6 @@ again:
 
spin_unlock(root-fs_info-ordered_extent_lock);
mutex_unlock(root-fs_info-ordered_operations_mutex);
-
-   return 0;
 }
 
 /*
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -170,7 +170,7 @@ struct btrfs_ordered_extent *btrfs_looku
 int btrfs_ordered_update_i_size(struct inode *inode, u64 offset,
struct btrfs_ordered_extent *ordered);
 int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr, 
u32 *sum);
-int btrfs_run_ordered_operations(struct btrfs_root *root, int wait);
+void btrfs_run_ordered_operations(struct btrfs_root *root, int wait);
 int btrfs_add_ordered_operation(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct inode *inode);


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 88/99] btrfs: __btrfs_remove_ordered_extent should return void

2011-11-23 Thread Jeff Mahoney
 __btrfs_remove_ordered_extent has no error conditions and should return
 void. Once that happens, btrfs_remove_ordered_extent has no error
 conditions can can also return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ordered-data.c |   15 +--
 fs/btrfs/ordered-data.h |2 +-
 2 files changed, 6 insertions(+), 11 deletions(-)

--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -415,8 +415,8 @@ void btrfs_put_ordered_extent(struct btr
  * and you must wake_up entry-wait.  You must hold the tree lock
  * while you call this function.
  */
-static int __btrfs_remove_ordered_extent(struct inode *inode,
-   struct btrfs_ordered_extent *entry)
+static void __btrfs_remove_ordered_extent(struct inode *inode,
+ struct btrfs_ordered_extent *entry)
 {
struct btrfs_ordered_inode_tree *tree;
struct btrfs_root *root = BTRFS_I(inode)-root;
@@ -443,27 +443,22 @@ static int __btrfs_remove_ordered_extent
list_del_init(BTRFS_I(inode)-ordered_operations);
}
spin_unlock(root-fs_info-ordered_extent_lock);
-
-   return 0;
 }
 
 /*
  * remove an ordered extent from the tree.  No references are dropped
  * but any waiters are woken.
  */
-int btrfs_remove_ordered_extent(struct inode *inode,
-   struct btrfs_ordered_extent *entry)
+void btrfs_remove_ordered_extent(struct inode *inode,
+struct btrfs_ordered_extent *entry)
 {
struct btrfs_ordered_inode_tree *tree;
-   int ret;
 
tree = BTRFS_I(inode)-ordered_tree;
spin_lock(tree-lock);
-   ret = __btrfs_remove_ordered_extent(inode, entry);
+   __btrfs_remove_ordered_extent(inode, entry);
spin_unlock(tree-lock);
wake_up(entry-wait);
-
-   return ret;
 }
 
 /*
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -139,7 +139,7 @@ btrfs_ordered_inode_tree_init(struct btr
 }
 
 void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry);
-int btrfs_remove_ordered_extent(struct inode *inode,
+void btrfs_remove_ordered_extent(struct inode *inode,
struct btrfs_ordered_extent *entry);
 int btrfs_dec_test_ordered_pending(struct inode *inode,
   struct btrfs_ordered_extent **cached,


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 90/99] btrfs: btrfs_wait_ordered_range should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_wait_ordered_range has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ordered-data.c |3 +--
 fs/btrfs/ordered-data.h |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -610,7 +610,7 @@ void btrfs_start_ordered_extent(struct i
 /*
  * Used to wait on ordered extents across a large range of bytes.
  */
-int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
+void btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
 {
u64 end;
u64 orig_end;
@@ -665,7 +665,6 @@ again:
schedule_timeout(1);
goto again;
}
-   return 0;
 }
 
 /*
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -161,7 +161,7 @@ struct btrfs_ordered_extent *btrfs_looku
 u64 file_offset);
 void btrfs_start_ordered_extent(struct inode *inode,
struct btrfs_ordered_extent *entry, int wait);
-int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len);
+void btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len);
 struct btrfs_ordered_extent *
 btrfs_lookup_first_ordered_extent(struct inode * inode, u64 file_offset);
 struct btrfs_ordered_extent *btrfs_lookup_ordered_range(struct inode *inode,


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 86/99] btrfs: update_inline_extent_backref should return void

2011-11-23 Thread Jeff Mahoney
 Now that btrfs_truncate_item returns void, there are no more error
 conditions in update_inline_extent_backref and it should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent-tree.c |   23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1649,12 +1649,12 @@ static int lookup_extent_backref(struct
  * helper to update/remove inline back ref
  */
 static noinline_for_stack
-int update_inline_extent_backref(struct btrfs_trans_handle *trans,
-struct btrfs_root *root,
-struct btrfs_path *path,
-struct btrfs_extent_inline_ref *iref,
-int refs_to_mod,
-struct btrfs_delayed_extent_op *extent_op)
+void update_inline_extent_backref(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ struct btrfs_path *path,
+ struct btrfs_extent_inline_ref *iref,
+ int refs_to_mod,
+ struct btrfs_delayed_extent_op *extent_op)
 {
struct extent_buffer *leaf;
struct btrfs_extent_item *ei;
@@ -1709,7 +1709,6 @@ int update_inline_extent_backref(struct
btrfs_truncate_item(trans, root, path, item_size, 1);
}
btrfs_mark_buffer_dirty(leaf);
-   return 0;
 }
 
 static noinline_for_stack
@@ -1729,8 +1728,8 @@ int insert_inline_extent_backref(struct
   root_objectid, owner, offset, 1);
if (ret == 0) {
BUG_ON(owner  BTRFS_FIRST_FREE_OBJECTID);
-   ret = update_inline_extent_backref(trans, root, path, iref,
-  refs_to_add, extent_op);
+   update_inline_extent_backref(trans, root, path, iref,
+refs_to_add, extent_op);
} else if (ret == -ENOENT) {
setup_inline_extent_backref(trans, root, path, iref, parent,
root_objectid, owner, offset,
@@ -1765,12 +1764,12 @@ static int remove_extent_backref(struct
 struct btrfs_extent_inline_ref *iref,
 int refs_to_drop, int is_data)
 {
-   int ret;
+   int ret = 0;
 
BUG_ON(!is_data  refs_to_drop != 1);
if (iref) {
-   ret = update_inline_extent_backref(trans, root, path, iref,
-  -refs_to_drop, NULL);
+   update_inline_extent_backref(trans, root, path, iref,
+-refs_to_drop, NULL);
} else if (is_data) {
ret = remove_extent_data_ref(trans, root, path, refs_to_drop);
} else {



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 83/99] btrfs: btrfs_extend_item should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_extend_item has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.c   |7 +++
 fs/btrfs/ctree.h   |5 +++--
 fs/btrfs/dir-item.c|5 ++---
 fs/btrfs/extent-tree.c |5 ++---
 fs/btrfs/file-item.c   |2 +-
 fs/btrfs/inode-item.c  |2 +-
 fs/btrfs/tree-log.c|9 -
 7 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 12c66ea..4c9dc73 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3291,9 +3291,9 @@ void btrfs_truncate_item(struct btrfs_trans_handle *trans,
 /*
  * make the item pointed to by the path bigger, data_size is the new size.
  */
-int btrfs_extend_item(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct btrfs_path *path,
- u32 data_size)
+void btrfs_extend_item(struct btrfs_trans_handle *trans,
+  struct btrfs_root *root, struct btrfs_path *path,
+  u32 data_size)
 {
int slot;
struct extent_buffer *leaf;
@@ -3351,7 +3351,6 @@ int btrfs_extend_item(struct btrfs_trans_handle *trans,
btrfs_print_leaf(root, leaf);
BUG();
}
-   return 0;
 }
 
 /*
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 5d1e06c..5dee97f 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2305,8 +2305,9 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
  struct extent_buffer **cow_ret, u64 new_root_objectid);
 int btrfs_block_can_be_shared(struct btrfs_root *root,
  struct extent_buffer *buf);
-int btrfs_extend_item(struct btrfs_trans_handle *trans, struct btrfs_root
- *root, struct btrfs_path *path, u32 data_size);
+void btrfs_extend_item(struct btrfs_trans_handle *trans,
+  struct btrfs_root *root, struct btrfs_path *path,
+  u32 data_size);
 void btrfs_truncate_item(struct btrfs_trans_handle *trans,
 struct btrfs_root *root,
 struct btrfs_path *path,
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index c95fc70..7674330 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -49,9 +49,8 @@ static struct btrfs_dir_item *insert_with_overflow(struct 
btrfs_trans_handle
di = btrfs_match_dir_item_name(root, path, name, name_len);
if (di)
return ERR_PTR(-EEXIST);
-   ret = btrfs_extend_item(trans, root, path, data_size);
-   }
-   if (ret  0)
+   btrfs_extend_item(trans, root, path, data_size);
+   } else if (ret  0)
return ERR_PTR(ret);
WARN_ON(ret  0);
leaf = path-nodes[0];
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 4ab965d..201822d 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -974,7 +974,7 @@ static int convert_extent_item_v0(struct btrfs_trans_handle 
*trans,
return ret;
BUG_ON(ret);
 
-   ret = btrfs_extend_item(trans, root, path, new_size);
+   btrfs_extend_item(trans, root, path, new_size);
 
leaf = path-nodes[0];
item = btrfs_item_ptr(leaf, path-slots[0], struct btrfs_extent_item);
@@ -1572,7 +1572,6 @@ void setup_inline_extent_backref(struct 
btrfs_trans_handle *trans,
u64 refs;
int size;
int type;
-   int ret;
 
leaf = path-nodes[0];
ei = btrfs_item_ptr(leaf, path-slots[0], struct btrfs_extent_item);
@@ -1581,7 +1580,7 @@ void setup_inline_extent_backref(struct 
btrfs_trans_handle *trans,
type = extent_ref_type(parent, owner);
size = btrfs_extent_inline_ref_size(type);
 
-   ret = btrfs_extend_item(trans, root, path, size);
+   btrfs_extend_item(trans, root, path, size);
 
ei = btrfs_item_ptr(leaf, path-slots[0], struct btrfs_extent_item);
refs = btrfs_extent_refs(leaf, ei);
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 319129e..4a73745 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -778,7 +778,7 @@ again:
if (diff != csum_size)
goto insert;
 
-   ret = btrfs_extend_item(trans, root, path, diff);
+   btrfs_extend_item(trans, root, path, diff);
goto csum;
}
 
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
index c04018c..9f0d038 100644
--- a/fs/btrfs/inode-item.c
+++ b/fs/btrfs/inode-item.c
@@ -164,7 +164,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
goto out;
 
old_size = btrfs_item_size_nr(path-nodes[0], path-slots[0]);
-   ret = btrfs_extend_item(trans, root, path, ins_len);
+   btrfs_extend_item(trans, root, path, ins_len);
ref = btrfs_item_ptr(path-nodes[0], path-slots[0],
 

[patch 82/99] btrfs: btrfs_truncate_item should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_truncate_item has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.c   |   11 +--
 fs/btrfs/ctree.h   |8 
 fs/btrfs/dir-item.c|4 ++--
 fs/btrfs/extent-tree.c |3 +--
 fs/btrfs/file-item.c   |4 ++--
 fs/btrfs/inode-item.c  |3 +--
 fs/btrfs/inode.c   |4 ++--
 7 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index bdaf3ad..12c66ea 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3193,10 +3193,10 @@ int btrfs_duplicate_item(struct btrfs_trans_handle 
*trans,
  * off the end of the item or if we shift the item to chop bytes off
  * the front.
  */
-int btrfs_truncate_item(struct btrfs_trans_handle *trans,
-   struct btrfs_root *root,
-   struct btrfs_path *path,
-   u32 new_size, int from_end)
+void btrfs_truncate_item(struct btrfs_trans_handle *trans,
+struct btrfs_root *root,
+struct btrfs_path *path,
+u32 new_size, int from_end)
 {
int slot;
struct extent_buffer *leaf;
@@ -3213,7 +3213,7 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans,
 
old_size = btrfs_item_size_nr(leaf, slot);
if (old_size == new_size)
-   return 0;
+   return;
 
nritems = btrfs_header_nritems(leaf);
data_end = leaf_data_end(root, leaf);
@@ -3286,7 +3286,6 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans,
btrfs_print_leaf(root, leaf);
BUG();
}
-   return 0;
 }
 
 /*
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 51f2840..5d1e06c 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2307,10 +2307,10 @@ int btrfs_block_can_be_shared(struct btrfs_root *root,
  struct extent_buffer *buf);
 int btrfs_extend_item(struct btrfs_trans_handle *trans, struct btrfs_root
  *root, struct btrfs_path *path, u32 data_size);
-int btrfs_truncate_item(struct btrfs_trans_handle *trans,
-   struct btrfs_root *root,
-   struct btrfs_path *path,
-   u32 new_size, int from_end);
+void btrfs_truncate_item(struct btrfs_trans_handle *trans,
+struct btrfs_root *root,
+struct btrfs_path *path,
+u32 new_size, int from_end);
 int btrfs_split_item(struct btrfs_trans_handle *trans,
 struct btrfs_root *root,
 struct btrfs_path *path,
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 31d84e7..c95fc70 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -383,8 +383,8 @@ int btrfs_delete_one_dir_name(struct btrfs_trans_handle 
*trans,
start = btrfs_item_ptr_offset(leaf, path-slots[0]);
memmove_extent_buffer(leaf, ptr, ptr + sub_item_len,
item_len - (ptr + sub_item_len - start));
-   ret = btrfs_truncate_item(trans, root, path,
- item_len - sub_item_len, 1);
+   btrfs_truncate_item(trans, root, path,
+   item_len - sub_item_len, 1);
}
return ret;
 }
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index fac996d..4ab965d 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1666,7 +1666,6 @@ int update_inline_extent_backref(struct 
btrfs_trans_handle *trans,
u32 item_size;
int size;
int type;
-   int ret;
u64 refs;
 
leaf = path-nodes[0];
@@ -1708,7 +1707,7 @@ int update_inline_extent_backref(struct 
btrfs_trans_handle *trans,
memmove_extent_buffer(leaf, ptr, ptr + size,
  end - ptr - size);
item_size -= size;
-   ret = btrfs_truncate_item(trans, root, path, item_size, 1);
+   btrfs_truncate_item(trans, root, path, item_size, 1);
}
btrfs_mark_buffer_dirty(leaf);
return 0;
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 8d5272d..319129e 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -514,7 +514,7 @@ static noinline int truncate_one_csum(struct 
btrfs_trans_handle *trans,
 */
u32 new_size = (bytenr - key-offset)  blocksize_bits;
new_size *= csum_size;
-   ret = btrfs_truncate_item(trans, root, path, new_size, 1);
+   btrfs_truncate_item(trans, root, path, new_size, 1);
} else if (key-offset = bytenr  csum_end  end_byte 
   end_byte  key-offset) {
/*
@@ -526,7 +526,7 @@ static noinline int truncate_one_csum(struct 
btrfs_trans_handle *trans,
u32 new_size = (csum_end - 

[patch 84/99] btrfs: end_compressed_writeback should return void

2011-11-23 Thread Jeff Mahoney
 end_compressed_writeback has no error conditions and should return
 void. Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/compression.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 0c0e842..6c4d228 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -225,8 +225,8 @@ out:
  * Clear the writeback bits on all of the file
  * pages for a compressed write
  */
-static noinline int end_compressed_writeback(struct inode *inode, u64 start,
-unsigned long ram_size)
+static noinline void end_compressed_writeback(struct inode *inode, u64 start,
+ unsigned long ram_size)
 {
unsigned long index = start  PAGE_CACHE_SHIFT;
unsigned long end_index = (start + ram_size - 1)  PAGE_CACHE_SHIFT;
@@ -252,7 +252,6 @@ static noinline int end_compressed_writeback(struct inode 
*inode, u64 start,
index += ret;
}
/* the inode may be gone now */
-   return 0;
 }
 
 /*



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 87/99] btrfs: btrfs_put_ordered_extent should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_put_ordered_extent has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ordered-data.c |3 +--
 fs/btrfs/ordered-data.h |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -392,7 +392,7 @@ out:
  * used to drop a reference on an ordered extent.  This will free
  * the extent if the last reference is dropped
  */
-int btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry)
+void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry)
 {
struct list_head *cur;
struct btrfs_ordered_sum *sum;
@@ -408,7 +408,6 @@ int btrfs_put_ordered_extent(struct btrf
}
kfree(entry);
}
-   return 0;
 }
 
 /*
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -138,7 +138,7 @@ btrfs_ordered_inode_tree_init(struct btr
t-last = NULL;
 }
 
-int btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry);
+void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry);
 int btrfs_remove_ordered_extent(struct inode *inode,
struct btrfs_ordered_extent *entry);
 int btrfs_dec_test_ordered_pending(struct inode *inode,


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 85/99] btrfs: copy_for_split should return void

2011-11-23 Thread Jeff Mahoney
 copy_for_split has no error conditions and should return void. We
 return 0 from split_leaf instead of ret since ret would have been
 set using the return value from copy_for_split which would have been 0.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.c |   19 ---
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 4c9dc73..263abce 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -2695,12 +2695,12 @@ out:
  *
  * returns 0 if all went well and  0 on failure.
  */
-static noinline int copy_for_split(struct btrfs_trans_handle *trans,
-  struct btrfs_root *root,
-  struct btrfs_path *path,
-  struct extent_buffer *l,
-  struct extent_buffer *right,
-  int slot, int mid, int nritems)
+static noinline void copy_for_split(struct btrfs_trans_handle *trans,
+   struct btrfs_root *root,
+   struct btrfs_path *path,
+   struct extent_buffer *l,
+   struct extent_buffer *right,
+   int slot, int mid, int nritems)
 {
int data_copy_size;
int rt_data_off;
@@ -2752,8 +2752,6 @@ static noinline int copy_for_split(struct 
btrfs_trans_handle *trans,
}
 
BUG_ON(path-slots[0]  0);
-
-   return 0;
 }
 
 /*
@@ -2965,8 +2963,7 @@ again:
return ret;
}
 
-   ret = copy_for_split(trans, root, path, l, right, slot, mid, nritems);
-   BUG_ON(ret);
+   copy_for_split(trans, root, path, l, right, slot, mid, nritems);
 
if (split == 2) {
BUG_ON(num_doubles != 0);
@@ -2974,7 +2971,7 @@ again:
goto again;
}
 
-   return ret;
+   return 0;
 
 push_for_double:
push_for_double_split(trans, root, path, data_size);



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 89/99] btrfs: btrfs_wait_ordered_extents should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_wait_ordered_extents has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ordered-data.c |5 ++---
 fs/btrfs/ordered-data.h |4 ++--
 fs/btrfs/transaction.c  |3 +--
 3 files changed, 5 insertions(+), 7 deletions(-)

--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -465,8 +465,8 @@ void btrfs_remove_ordered_extent(struct
  * wait for all the ordered extents in a root.  This is done when balancing
  * space between drives.
  */
-int btrfs_wait_ordered_extents(struct btrfs_root *root,
-  int nocow_only, int delay_iput)
+void btrfs_wait_ordered_extents(struct btrfs_root *root,
+   int nocow_only, int delay_iput)
 {
struct list_head splice;
struct list_head *cur;
@@ -514,7 +514,6 @@ int btrfs_wait_ordered_extents(struct bt
spin_lock(root-fs_info-ordered_extent_lock);
}
spin_unlock(root-fs_info-ordered_extent_lock);
-   return 0;
 }
 
 /*
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -174,6 +174,6 @@ int btrfs_run_ordered_operations(struct
 int btrfs_add_ordered_operation(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct inode *inode);
-int btrfs_wait_ordered_extents(struct btrfs_root *root,
-  int nocow_only, int delay_iput);
+void btrfs_wait_ordered_extents(struct btrfs_root *root,
+   int nocow_only, int delay_iput);
 #endif
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1207,8 +1207,7 @@ int btrfs_commit_transaction(struct btrf
 
if (flush_on_commit || snap_pending) {
btrfs_start_delalloc_inodes(root, 1);
-   ret = btrfs_wait_ordered_extents(root, 0, 1);
-   BUG_ON(ret);
+   btrfs_wait_ordered_extents(root, 0, 1);
}
 
ret = btrfs_run_delayed_items(trans, root);


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 43/99] btrfs: clear_extent_buffer_dirty should return void

2011-11-23 Thread Jeff Mahoney
 clear_extent_buffer_dirty has no error conditions and should return void.
 Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |3 +--
 fs/btrfs/extent_io.h |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3436,7 +3436,7 @@ void free_extent_buffer(struct extent_bu
WARN_ON(1);
 }
 
-int clear_extent_buffer_dirty(struct extent_io_tree *tree,
+void clear_extent_buffer_dirty(struct extent_io_tree *tree,
  struct extent_buffer *eb)
 {
unsigned long i;
@@ -3467,7 +3467,6 @@ int clear_extent_buffer_dirty(struct ext
ClearPageError(page);
unlock_page(page);
}
-   return 0;
 }
 
 int set_extent_buffer_dirty(struct extent_io_tree *tree,
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -278,7 +278,7 @@ void memmove_extent_buffer(struct extent
 void memset_extent_buffer(struct extent_buffer *eb, char c,
  unsigned long start, unsigned long len);
 void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int 
bits);
-int clear_extent_buffer_dirty(struct extent_io_tree *tree,
+void clear_extent_buffer_dirty(struct extent_io_tree *tree,
  struct extent_buffer *eb);
 int set_extent_buffer_dirty(struct extent_io_tree *tree,
 struct extent_buffer *eb);



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 76/99] btrfs: Delayed ref mempool functions should return void

2011-11-23 Thread Jeff Mahoney
 Now that the delayed ref code uses mempools, allocations can't fail,
 and there are no more error conditions to report.

 This patch makes the following functions return void:
 - btrfs_alloc_reserved_file_extent
 - btrfs_add_delayed_tree_ref
 - btrfs_add_delayed_data_ref
 - btrfs_add_delayed_extent_op

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.h   |8 ++--
 fs/btrfs/delayed-ref.c |   27 +++-
 fs/btrfs/delayed-ref.h |   24 +++---
 fs/btrfs/extent-tree.c |   78 ---
 fs/btrfs/inode.c   |6 +--
 5 files changed, 63 insertions(+), 80 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index ea47c73..f704253 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2179,10 +2179,10 @@ struct extent_buffer *btrfs_init_new_buffer(struct 
btrfs_trans_handle *trans,
struct btrfs_root *root,
u64 bytenr, u32 blocksize,
int level);
-int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
-struct btrfs_root *root,
-u64 root_objectid, u64 owner,
-u64 offset, struct btrfs_key *ins);
+void btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ u64 root_objectid, u64 owner,
+ u64 offset, struct btrfs_key *ins);
 int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans,
   struct btrfs_root *root,
   u64 root_objectid, u64 owner, u64 offset,
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index a70c40d..16aea4e 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -586,10 +586,10 @@ static noinline void add_delayed_data_ref(struct 
btrfs_trans_handle *trans,
  * to make sure the delayed ref is eventually processed before this
  * transaction commits.
  */
-int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle *trans,
-  u64 bytenr, u64 num_bytes, u64 parent,
-  u64 ref_root,  int level, int action,
-  struct btrfs_delayed_extent_op *extent_op)
+void btrfs_add_delayed_tree_ref(struct btrfs_trans_handle *trans,
+   u64 bytenr, u64 num_bytes, u64 parent,
+   u64 ref_root,  int level, int action,
+   struct btrfs_delayed_extent_op *extent_op)
 {
struct btrfs_delayed_tree_ref *ref;
struct btrfs_delayed_ref_head *head_ref;
@@ -613,17 +613,16 @@ int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle 
*trans,
add_delayed_tree_ref(trans, ref-node, bytenr, num_bytes, parent,
 ref_root, level, action);
spin_unlock(delayed_refs-lock);
-   return 0;
 }
 
 /*
  * add a delayed data ref. it's similar to btrfs_add_delayed_tree_ref.
  */
-int btrfs_add_delayed_data_ref(struct btrfs_trans_handle *trans,
-  u64 bytenr, u64 num_bytes,
-  u64 parent, u64 ref_root,
-  u64 owner, u64 offset, int action,
-  struct btrfs_delayed_extent_op *extent_op)
+void btrfs_add_delayed_data_ref(struct btrfs_trans_handle *trans,
+   u64 bytenr, u64 num_bytes,
+   u64 parent, u64 ref_root,
+   u64 owner, u64 offset, int action,
+   struct btrfs_delayed_extent_op *extent_op)
 {
struct btrfs_delayed_data_ref *ref;
struct btrfs_delayed_ref_head *head_ref;
@@ -647,12 +646,11 @@ int btrfs_add_delayed_data_ref(struct btrfs_trans_handle 
*trans,
add_delayed_data_ref(trans, ref-node, bytenr, num_bytes, parent,
 ref_root, owner, offset, action);
spin_unlock(delayed_refs-lock);
-   return 0;
 }
 
-int btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
-   u64 bytenr, u64 num_bytes,
-   struct btrfs_delayed_extent_op *extent_op)
+void btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
+u64 bytenr, u64 num_bytes,
+struct btrfs_delayed_extent_op *extent_op)
 {
struct btrfs_delayed_ref_head *head_ref;
struct btrfs_delayed_ref_root *delayed_refs;
@@ -666,7 +664,6 @@ int btrfs_add_delayed_extent_op(struct btrfs_trans_handle 
*trans,
add_delayed_ref_head(trans, head_ref-node, bytenr, num_bytes,
 BTRFS_UPDATE_DELAYED_HEAD, extent_op-is_data);

[patch 80/99] btrfs: __btrfs_mod_ref should return void

2011-11-23 Thread Jeff Mahoney
 Now that process_func can't return an error, __btrfs_mod_ref has no more
 error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.c   |   30 ++
 fs/btrfs/ctree.h   |8 
 fs/btrfs/extent-tree.c |   34 +++---
 3 files changed, 29 insertions(+), 43 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 2604ec4..bdaf3ad 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -224,7 +224,6 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
  struct extent_buffer **cow_ret, u64 new_root_objectid)
 {
struct extent_buffer *cow;
-   int ret = 0;
int level;
struct btrfs_disk_key disk_key;
 
@@ -261,12 +260,9 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
 
WARN_ON(btrfs_header_generation(buf)  trans-transid);
if (new_root_objectid == BTRFS_TREE_RELOC_OBJECTID)
-   ret = btrfs_inc_ref(trans, root, cow, 1);
+   btrfs_inc_ref(trans, root, cow, 1);
else
-   ret = btrfs_inc_ref(trans, root, cow, 0);
-
-   if (ret)
-   return ret;
+   btrfs_inc_ref(trans, root, cow, 0);
 
btrfs_mark_buffer_dirty(cow);
*cow_ret = cow;
@@ -350,25 +346,21 @@ static noinline int update_ref_for_cow(struct 
btrfs_trans_handle *trans,
if ((owner == root-root_key.objectid ||
 root-root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) 
!(flags  BTRFS_BLOCK_FLAG_FULL_BACKREF)) {
-   ret = btrfs_inc_ref(trans, root, buf, 1);
-   BUG_ON(ret);
+   btrfs_inc_ref(trans, root, buf, 1);
 
if (root-root_key.objectid ==
BTRFS_TREE_RELOC_OBJECTID) {
-   ret = btrfs_dec_ref(trans, root, buf, 0);
-   BUG_ON(ret);
-   ret = btrfs_inc_ref(trans, root, cow, 1);
-   BUG_ON(ret);
+   btrfs_dec_ref(trans, root, buf, 0);
+   btrfs_inc_ref(trans, root, cow, 1);
}
new_flags |= BTRFS_BLOCK_FLAG_FULL_BACKREF;
} else {
 
if (root-root_key.objectid ==
BTRFS_TREE_RELOC_OBJECTID)
-   ret = btrfs_inc_ref(trans, root, cow, 1);
+   btrfs_inc_ref(trans, root, cow, 1);
else
-   ret = btrfs_inc_ref(trans, root, cow, 0);
-   BUG_ON(ret);
+   btrfs_inc_ref(trans, root, cow, 0);
}
if (new_flags != 0) {
ret = btrfs_set_disk_extent_flags(trans, root,
@@ -381,12 +373,10 @@ static noinline int update_ref_for_cow(struct 
btrfs_trans_handle *trans,
if (flags  BTRFS_BLOCK_FLAG_FULL_BACKREF) {
if (root-root_key.objectid ==
BTRFS_TREE_RELOC_OBJECTID)
-   ret = btrfs_inc_ref(trans, root, cow, 1);
+   btrfs_inc_ref(trans, root, cow, 1);
else
-   ret = btrfs_inc_ref(trans, root, cow, 0);
-   BUG_ON(ret);
-   ret = btrfs_dec_ref(trans, root, buf, 1);
-   BUG_ON(ret);
+   btrfs_inc_ref(trans, root, cow, 0);
+   btrfs_dec_ref(trans, root, buf, 1);
}
clean_tree_block(trans, root, buf);
*last_ref = 1;
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b791b8f..51f2840 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2193,10 +2193,10 @@ int btrfs_reserve_extent(struct btrfs_trans_handle 
*trans,
  u64 empty_size, u64 hint_byte,
  u64 search_end, struct btrfs_key *ins,
  u64 data);
-int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
- struct extent_buffer *buf, int full_backref);
-int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
- struct extent_buffer *buf, int full_backref);
+void btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
+  struct extent_buffer *buf, int full_backref);
+void btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
+  struct extent_buffer *buf, int full_backref);
 int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
u64 bytenr, u64 num_bytes, 

[patch 39/99] btrfs: __unlock_for_delalloc should return void

2011-11-23 Thread Jeff Mahoney
 __unlock_for_delalloc has no error conditions and should return void.
 Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1384,9 +1384,9 @@ out:
return found;
 }
 
-static noinline int __unlock_for_delalloc(struct inode *inode,
- struct page *locked_page,
- u64 start, u64 end)
+static noinline void __unlock_for_delalloc(struct inode *inode,
+  struct page *locked_page,
+  u64 start, u64 end)
 {
int ret;
struct page *pages[16];
@@ -1396,7 +1396,7 @@ static noinline int __unlock_for_delallo
int i;
 
if (index == locked_page-index  end_index == index)
-   return 0;
+   return;
 
while (nr_pages  0) {
ret = find_get_pages_contig(inode-i_mapping, index,
@@ -1411,7 +1411,6 @@ static noinline int __unlock_for_delallo
index += ret;
cond_resched();
}
-   return 0;
 }
 
 static noinline int lock_delalloc_pages(struct inode *inode,



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 41/99] btrfs: check_page_locked should return void

2011-11-23 Thread Jeff Mahoney
 check_page_locked has no error conditions and should return void.
 Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1817,14 +1817,12 @@ static void check_page_uptodate(struct e
  * helper function to unlock a page if all the extents in the tree
  * for that page are unlocked
  */
-static int check_page_locked(struct extent_io_tree *tree,
-struct page *page)
+static void check_page_locked(struct extent_io_tree *tree, struct page *page)
 {
u64 start = (u64)page-index  PAGE_CACHE_SHIFT;
u64 end = start + PAGE_CACHE_SIZE - 1;
if (!test_range_bit(tree, start, end, EXTENT_LOCKED, 0, NULL))
unlock_page(page);
-   return 0;
 }
 
 /*



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 44/99] btrfs: btrfs_cleanup_fs_uuids should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_cleanup_fs_uuids has no error conditions and should return void.
 Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/volumes.c |3 +--
 fs/btrfs/volumes.h |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -65,7 +65,7 @@ static void free_fs_devices(struct btrfs
kfree(fs_devices);
 }
 
-int btrfs_cleanup_fs_uuids(void)
+void btrfs_cleanup_fs_uuids(void)
 {
struct btrfs_fs_devices *fs_devices;
 
@@ -75,7 +75,6 @@ int btrfs_cleanup_fs_uuids(void)
list_del(fs_devices-list);
free_fs_devices(fs_devices);
}
-   return 0;
 }
 
 static noinline struct btrfs_device *__find_device(struct list_head *head,
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -202,7 +202,7 @@ int btrfs_add_device(struct btrfs_trans_
 struct btrfs_root *root,
 struct btrfs_device *device);
 int btrfs_rm_device(struct btrfs_root *root, char *device_path);
-int btrfs_cleanup_fs_uuids(void);
+void btrfs_cleanup_fs_uuids(void);
 int btrfs_num_copies(struct btrfs_mapping_tree *map_tree, u64 logical, u64 
len);
 int btrfs_grow_device(struct btrfs_trans_handle *trans,
  struct btrfs_device *device, u64 new_size);



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 79/99] btrfs: __btrfs_mod_refs process_func should return void

2011-11-23 Thread Jeff Mahoney
 __btrfs_mod_ref's process_func function pointer calls btrfs_free_extent
 and btrfs_inc_extent_ref, which now both return only 0. This patches
 makes them return void and eliminates the error condition in
 __btrfs_mod_ref.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.h   |   16 
 fs/btrfs/extent-tree.c |   39 ++-
 2 files changed, 22 insertions(+), 33 deletions(-)

--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2201,22 +2201,22 @@ int btrfs_set_disk_extent_flags(struct b
struct btrfs_root *root,
u64 bytenr, u64 num_bytes, u64 flags,
int is_data);
-int btrfs_free_extent(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- u64 bytenr, u64 num_bytes, u64 parent,
- u64 root_objectid, u64 owner, u64 offset);
+void btrfs_free_extent(struct btrfs_trans_handle *trans,
+  struct btrfs_root *root,
+  u64 bytenr, u64 num_bytes, u64 parent,
+  u64 root_objectid, u64 owner, u64 offset);
 
 int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len);
 int btrfs_free_and_pin_reserved_extent(struct btrfs_root *root,
   u64 start, u64 len);
 void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans,
 struct btrfs_root *root);
 int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
   struct btrfs_root *root);
-int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
-struct btrfs_root *root,
-u64 bytenr, u64 num_bytes, u64 parent,
-u64 root_objectid, u64 owner, u64 offset);
+void btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ u64 bytenr, u64 num_bytes, u64 parent,
+ u64 root_objectid, u64 owner, u64 offset);
 
 int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans,
struct btrfs_root *root);
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1832,10 +1832,10 @@ static int btrfs_discard_extent(struct b
return ret;
 }
 
-int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
-struct btrfs_root *root,
-u64 bytenr, u64 num_bytes, u64 parent,
-u64 root_objectid, u64 owner, u64 offset)
+void btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ u64 bytenr, u64 num_bytes, u64 parent,
+ u64 root_objectid, u64 owner, u64 offset)
 {
BUG_ON(owner  BTRFS_FIRST_FREE_OBJECTID 
   root_objectid == BTRFS_TREE_LOG_OBJECTID);
@@ -1849,7 +1849,6 @@ int btrfs_inc_extent_ref(struct btrfs_tr
   root_objectid, owner, offset,
   BTRFS_ADD_DELAYED_REF, NULL);
}
-   return 0;
 }
 
 static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
@@ -2566,9 +2565,8 @@ static int __btrfs_mod_ref(struct btrfs_
struct btrfs_file_extent_item *fi;
int i;
int level;
-   int ret = 0;
-   int (*process_func)(struct btrfs_trans_handle *, struct btrfs_root *,
-   u64, u64, u64, u64, u64, u64);
+   void (*process_func)(struct btrfs_trans_handle *, struct btrfs_root *,
+u64, u64, u64, u64, u64, u64);
 
ref_root = btrfs_header_owner(buf);
nritems = btrfs_header_nritems(buf);
@@ -2603,24 +2601,16 @@ static int __btrfs_mod_ref(struct btrfs_
 
num_bytes = btrfs_file_extent_disk_num_bytes(buf, fi);
key.offset -= btrfs_file_extent_offset(buf, fi);
-   ret = process_func(trans, root, bytenr, num_bytes,
-  parent, ref_root, key.objectid,
-  key.offset);
-   if (ret)
-   goto fail;
+   process_func(trans, root, bytenr, num_bytes, parent,
+ref_root, key.objectid, key.offset);
} else {
bytenr = btrfs_node_blockptr(buf, i);
num_bytes = btrfs_level_size(root, level - 1);
-   ret = process_func(trans, root, bytenr, num_bytes,
-  parent, ref_root, level - 1, 0);
-   if (ret)
-   goto fail;
+   process_func(trans, root, bytenr, num_bytes, parent,
+ 

[patch 81/99] btrfs: clean_tree_block should return void

2011-11-23 Thread Jeff Mahoney
 clean_tree_block has no error conditions and should return void. Its
 callers already ignore the error codes.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/disk-io.c |5 ++---
 fs/btrfs/disk-io.h |4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index fcb0f7f..e16a3e9 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1033,8 +1033,8 @@ struct extent_buffer *read_tree_block(struct btrfs_root 
*root, u64 bytenr,
 
 }
 
-int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
-struct extent_buffer *buf)
+void clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root 
*root,
+ struct extent_buffer *buf)
 {
struct inode *btree_inode = root-fs_info-btree_inode;
if (btrfs_header_generation(buf) ==
@@ -1055,7 +1055,6 @@ int clean_tree_block(struct btrfs_trans_handle *trans, 
struct btrfs_root *root,
clear_extent_buffer_dirty(BTRFS_I(btree_inode)-io_tree,
  buf);
}
-   return 0;
 }
 
 static void __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index bec3ea4..5a2604a 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -42,8 +42,8 @@ int readahead_tree_block(struct btrfs_root *root, u64 bytenr, 
u32 blocksize,
 int mirror_num, struct extent_buffer **eb);
 struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root,
   u64 bytenr, u32 blocksize);
-int clean_tree_block(struct btrfs_trans_handle *trans,
-struct btrfs_root *root, struct extent_buffer *buf);
+void clean_tree_block(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root, struct extent_buffer *buf);
 struct btrfs_root *open_ctree(struct super_block *sb,
  struct btrfs_fs_devices *fs_devices,
  char *options);



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 78/99] btrfs: btrfs_free_extent void return prep

2011-11-23 Thread Jeff Mahoney
 btrfs_free_extent has no error conditions, but is used via process_func
 in __btrfs_mod_ref which requires it to return an int.

 This patch cleans up the callers to eliminate error handling that will
 never be used. The next patch makes both btrfs_free_extent and the other
 function used via process_func, btrfs_inc_extent_ref, return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent-tree.c |8 +++-
 fs/btrfs/file.c|   23 +--
 fs/btrfs/inode.c   |9 -
 fs/btrfs/relocation.c  |   23 +--
 4 files changed, 25 insertions(+), 38 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index fe95f37..dc91e4d 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4805,13 +4805,12 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans,
  u64 bytenr, u64 num_bytes, u64 parent,
  u64 root_objectid, u64 owner, u64 offset)
 {
-   int ret;
-
/*
 * tree log blocks never actually go into the extent allocation
 * tree, just update pinning info and exit early.
 */
if (root_objectid == BTRFS_TREE_LOG_OBJECTID) {
+   int ret;
WARN_ON(owner = BTRFS_FIRST_FREE_OBJECTID);
/* unlocks the pinned mutex */
ret = btrfs_pin_extent(root, bytenr, num_bytes, 1);
@@ -6142,9 +6141,8 @@ skip:
parent = 0;
}
 
-   ret = btrfs_free_extent(trans, root, bytenr, blocksize, parent,
-   root-root_key.objectid, level - 1, 0);
-   BUG_ON(ret);
+   btrfs_free_extent(trans, root, bytenr, blocksize, parent,
+ root-root_key.objectid, level - 1, 0);
}
btrfs_tree_unlock(next);
free_extent_buffer(next);
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 314c08e..fa8f83e 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -747,12 +747,11 @@ next_slot:
extent_end = ALIGN(extent_end,
   root-sectorsize);
} else if (disk_bytenr  0) {
-   ret = btrfs_free_extent(trans, root,
-   disk_bytenr, num_bytes, 0,
-   root-root_key.objectid,
-   key.objectid, key.offset -
-   extent_offset);
-   BUG_ON(ret);
+   btrfs_free_extent(trans, root,
+ disk_bytenr, num_bytes, 0,
+ root-root_key.objectid,
+ key.objectid, key.offset -
+ extent_offset);
inode_sub_bytes(inode,
extent_end - key.offset);
*hint_byte = disk_bytenr;
@@ -984,10 +983,8 @@ again:
extent_end = other_end;
del_slot = path-slots[0] + 1;
del_nr++;
-   ret = btrfs_free_extent(trans, root, bytenr, num_bytes,
-   0, root-root_key.objectid,
-   ino, orig_offset);
-   BUG_ON(ret);
+   btrfs_free_extent(trans, root, bytenr, num_bytes, 0,
+ root-root_key.objectid, ino, orig_offset);
}
other_start = 0;
other_end = start;
@@ -1001,10 +998,8 @@ again:
key.offset = other_start;
del_slot = path-slots[0];
del_nr++;
-   ret = btrfs_free_extent(trans, root, bytenr, num_bytes,
-   0, root-root_key.objectid,
-   ino, orig_offset);
-   BUG_ON(ret);
+   btrfs_free_extent(trans, root, bytenr, num_bytes, 0,
+ root-root_key.objectid, ino, orig_offset);
}
if (del_nr == 0) {
fi = btrfs_item_ptr(leaf, path-slots[0],
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 46f3d4a..d8bb54e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3270,11 +3270,10 @@ delete:
if (found_extent  (root-ref_cows ||
 root == root-fs_info-tree_root)) {
btrfs_set_path_blocking(path);
-   ret = btrfs_free_extent(trans, root, extent_start,
-   extent_num_bytes, 0,
-   btrfs_header_owner(leaf),
-   ino, 

[patch 75/99] btrfs: Use mempools for delayed refs

2011-11-23 Thread Jeff Mahoney
 This patch converts the delayed ref code to use slab cache-backed mempools
 for allocating its nodes.

 The allocations happen deep in the call path where error recovery is
 impossible.

 By using mempools, we ensure that the allocations can't fail. Each
 mempool keeps a page of structures available for each type.

 This also has an advantage of eliminating the error path from a big
 chunk of code, simplifying the error handling.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/delayed-ref.c |  119 ++--
 fs/btrfs/delayed-ref.h |6 ++-
 fs/btrfs/super.c   |9 +++-
 3 files changed, 107 insertions(+), 27 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index e388ca3..a70c40d 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -18,11 +18,20 @@
 
 #include linux/sched.h
 #include linux/slab.h
+#include linux/mempool.h
 #include linux/sort.h
 #include ctree.h
 #include delayed-ref.h
 #include transaction.h
 
+static struct kmem_cache *ref_head_cache;
+static struct kmem_cache *tree_ref_cache;
+static struct kmem_cache *data_ref_cache;
+
+static mempool_t *ref_head_pool;
+static mempool_t *tree_ref_pool;
+static mempool_t *data_ref_pool;
+
 /*
  * delayed back reference update tracking.  For subvolume trees
  * we queue up extent allocations and backref maintenance for
@@ -455,7 +464,7 @@ static noinline void add_delayed_ref_head(struct 
btrfs_trans_handle *trans,
 * we've updated the existing ref, free the newly
 * allocated ref
 */
-   kfree(head_ref);
+   mempool_free(head_ref, ref_head_pool);
} else {
delayed_refs-num_heads++;
delayed_refs-num_heads_ready++;
@@ -510,7 +519,7 @@ static noinline void add_delayed_tree_ref(struct 
btrfs_trans_handle *trans,
 * we've updated the existing ref, free the newly
 * allocated ref
 */
-   kfree(full_ref);
+   mempool_free(full_ref, tree_ref_pool);
} else {
delayed_refs-num_entries++;
trans-delayed_ref_updates++;
@@ -565,7 +574,7 @@ static noinline void add_delayed_data_ref(struct 
btrfs_trans_handle *trans,
 * we've updated the existing ref, free the newly
 * allocated ref
 */
-   kfree(full_ref);
+   mempool_free(full_ref, data_ref_pool);
} else {
delayed_refs-num_entries++;
trans-delayed_ref_updates++;
@@ -587,15 +596,8 @@ int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle 
*trans,
struct btrfs_delayed_ref_root *delayed_refs;
 
BUG_ON(extent_op  extent_op-is_data);
-   ref = kmalloc(sizeof(*ref), GFP_NOFS);
-   if (!ref)
-   return -ENOMEM;
-
-   head_ref = kmalloc(sizeof(*head_ref), GFP_NOFS);
-   if (!head_ref) {
-   kfree(ref);
-   return -ENOMEM;
-   }
+   ref = mempool_alloc(tree_ref_pool, GFP_NOFS);
+   head_ref = mempool_alloc(ref_head_pool, GFP_NOFS);
 
head_ref-extent_op = extent_op;
 
@@ -628,15 +630,8 @@ int btrfs_add_delayed_data_ref(struct btrfs_trans_handle 
*trans,
struct btrfs_delayed_ref_root *delayed_refs;
 
BUG_ON(extent_op  !extent_op-is_data);
-   ref = kmalloc(sizeof(*ref), GFP_NOFS);
-   if (!ref)
-   return -ENOMEM;
-
-   head_ref = kmalloc(sizeof(*head_ref), GFP_NOFS);
-   if (!head_ref) {
-   kfree(ref);
-   return -ENOMEM;
-   }
+   ref = mempool_alloc(data_ref_pool, GFP_NOFS);
+   head_ref = mempool_alloc(ref_head_pool, GFP_NOFS);
 
head_ref-extent_op = extent_op;
 
@@ -662,10 +657,7 @@ int btrfs_add_delayed_extent_op(struct btrfs_trans_handle 
*trans,
struct btrfs_delayed_ref_head *head_ref;
struct btrfs_delayed_ref_root *delayed_refs;
 
-   head_ref = kmalloc(sizeof(*head_ref), GFP_NOFS);
-   if (!head_ref)
-   return -ENOMEM;
-
+   head_ref = mempool_alloc(ref_head_pool, GFP_NOFS);
head_ref-extent_op = extent_op;
 
delayed_refs = trans-transaction-delayed_refs;
@@ -694,3 +686,80 @@ btrfs_find_delayed_ref_head(struct btrfs_trans_handle 
*trans, u64 bytenr)
return btrfs_delayed_node_to_head(ref);
return NULL;
 }
+
+void btrfs_free_delayed_ref(struct btrfs_delayed_ref_node *ref)
+{
+   if (!ref-type)
+   mempool_free(ref, ref_head_pool);
+   else if (ref-type == BTRFS_SHARED_BLOCK_REF_KEY ||
+ref-type == BTRFS_TREE_BLOCK_REF_KEY)
+   mempool_free(ref, tree_ref_pool);
+   else if (ref-type == BTRFS_SHARED_DATA_REF_KEY ||
+ref-type == BTRFS_EXTENT_DATA_REF_KEY)
+   mempool_free(ref, data_ref_pool);
+   else
+   BUG();
+}
+
+void

[patch 77/99] btrfs: btrfs_inc_extent_ref void return prep

2011-11-23 Thread Jeff Mahoney
 btrfs_inc_extent_ref has no error conditions, but is used via
 process_func in __btrfs_mod_ref which requires it to return an int.

 This patch cleans up the callers to eliminate error handling that will
 never be used. A later patch in this series makes both
 btrfs_inc_extent_ref and the other function used via process_func,
 btrfs_inc_extent_ref, return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/file.c   |   18 --
 fs/btrfs/ioctl.c  |3 +--
 fs/btrfs/relocation.c |   34 ++
 fs/btrfs/tree-log.c   |9 -
 4 files changed, 27 insertions(+), 37 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 74f50ba..314c08e 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -673,12 +673,11 @@ next_slot:
btrfs_mark_buffer_dirty(leaf);
 
if (disk_bytenr  0) {
-   ret = btrfs_inc_extent_ref(trans, root,
-   disk_bytenr, num_bytes, 0,
-   root-root_key.objectid,
-   new_key.objectid,
-   start - extent_offset);
-   BUG_ON(ret);
+   btrfs_inc_extent_ref(trans, root,
+disk_bytenr, num_bytes, 0,
+root-root_key.objectid,
+new_key.objectid,
+start - extent_offset);
*hint_byte = disk_bytenr;
}
key.offset = start;
@@ -959,10 +958,9 @@ again:
extent_end - split);
btrfs_mark_buffer_dirty(leaf);
 
-   ret = btrfs_inc_extent_ref(trans, root, bytenr, num_bytes, 0,
-  root-root_key.objectid,
-  ino, orig_offset);
-   BUG_ON(ret);
+   btrfs_inc_extent_ref(trans, root, bytenr, num_bytes, 0,
+root-root_key.objectid,
+ino, orig_offset);
 
if (split == start) {
key.offset = start;
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index a7450b3..4cef4f1 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2402,12 +2402,11 @@ static noinline long btrfs_ioctl_clone(struct file 
*file, unsigned long srcfd,
datal);
if (disko) {
inode_add_bytes(inode, datal);
-   ret = btrfs_inc_extent_ref(trans, root,
+   btrfs_inc_extent_ref(trans, root,
disko, diskl, 0,
root-root_key.objectid,
btrfs_ino(inode),
new_key.offset - datao);
-   BUG_ON(ret);
}
} else if (type == BTRFS_FILE_EXTENT_INLINE) {
u64 skip = 0;
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index f2ff530..4c65c4e 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1628,11 +1628,10 @@ int replace_file_extents(struct btrfs_trans_handle 
*trans,
dirty = 1;
 
key.offset -= btrfs_file_extent_offset(leaf, fi);
-   ret = btrfs_inc_extent_ref(trans, root, new_bytenr,
-  num_bytes, parent,
-  btrfs_header_owner(leaf),
-  key.objectid, key.offset);
-   BUG_ON(ret);
+   btrfs_inc_extent_ref(trans, root, new_bytenr,
+num_bytes, parent,
+btrfs_header_owner(leaf),
+key.objectid, key.offset);
 
ret = btrfs_free_extent(trans, root, bytenr, num_bytes,
parent, btrfs_header_owner(leaf),
@@ -1803,15 +1802,11 @@ again:
  path-slots[level], old_ptr_gen);
btrfs_mark_buffer_dirty(path-nodes[level]);
 
-   ret = btrfs_inc_extent_ref(trans, src, old_bytenr, blocksize,
-   path-nodes[level]-start,
-   src-root_key.objectid, level - 1, 0);
-   BUG_ON(ret);
-   

[patch 73/99] btrfs: add_delayed_data_ref should return void

2011-11-23 Thread Jeff Mahoney
 add_delayed_data_ref has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/delayed-ref.c |   17 +++--
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 3ae2401..b004960 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -520,11 +520,11 @@ static noinline void add_delayed_tree_ref(struct 
btrfs_trans_handle *trans,
 /*
  * helper to insert a delayed data ref into the rbtree.
  */
-static noinline int add_delayed_data_ref(struct btrfs_trans_handle *trans,
-struct btrfs_delayed_ref_node *ref,
-u64 bytenr, u64 num_bytes, u64 parent,
-u64 ref_root, u64 owner, u64 offset,
-int action)
+static noinline void add_delayed_data_ref(struct btrfs_trans_handle *trans,
+ struct btrfs_delayed_ref_node *ref,
+ u64 bytenr, u64 num_bytes, u64 parent,
+ u64 ref_root, u64 owner, u64 offset,
+ int action)
 {
struct btrfs_delayed_ref_node *existing;
struct btrfs_delayed_data_ref *full_ref;
@@ -570,7 +570,6 @@ static noinline int add_delayed_data_ref(struct 
btrfs_trans_handle *trans,
delayed_refs-num_entries++;
trans-delayed_ref_updates++;
}
-   return 0;
 }
 
 /*
@@ -627,7 +626,6 @@ int btrfs_add_delayed_data_ref(struct btrfs_trans_handle 
*trans,
struct btrfs_delayed_data_ref *ref;
struct btrfs_delayed_ref_head *head_ref;
struct btrfs_delayed_ref_root *delayed_refs;
-   int ret;
 
BUG_ON(extent_op  !extent_op-is_data);
ref = kmalloc(sizeof(*ref), GFP_NOFS);
@@ -651,9 +649,8 @@ int btrfs_add_delayed_data_ref(struct btrfs_trans_handle 
*trans,
 */
add_delayed_ref_head(trans, head_ref-node, bytenr, num_bytes,
 action, 1);
-   ret = add_delayed_data_ref(trans, ref-node, bytenr, num_bytes,
-  parent, ref_root, owner, offset, action);
-   BUG_ON(ret);
+   add_delayed_data_ref(trans, ref-node, bytenr, num_bytes, parent,
+ref_root, owner, offset, action);
spin_unlock(delayed_refs-lock);
return 0;
 }



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 70/99] btrfs: insert_ptr should return void

2011-11-23 Thread Jeff Mahoney
 insert_ptr has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.c |   46 +-
 1 files changed, 13 insertions(+), 33 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index c605fb3..2604ec4 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -2114,12 +2114,11 @@ static noinline int insert_new_root(struct 
btrfs_trans_handle *trans,
  *
  * slot and level indicate where you want the key to go, and
  * blocknr is the block the key points to.
- *
- * returns zero on success and  0 on any error
  */
-static int insert_ptr(struct btrfs_trans_handle *trans, struct btrfs_root
- *root, struct btrfs_path *path, struct btrfs_disk_key
- *key, u64 bytenr, int slot, int level)
+static void insert_ptr(struct btrfs_trans_handle *trans,
+  struct btrfs_root *root, struct btrfs_path *path,
+  struct btrfs_disk_key *key, u64 bytenr,
+  int slot, int level)
 {
struct extent_buffer *lower;
int nritems;
@@ -2129,8 +2128,7 @@ static int insert_ptr(struct btrfs_trans_handle *trans, 
struct btrfs_root
lower = path-nodes[level];
nritems = btrfs_header_nritems(lower);
BUG_ON(slot  nritems);
-   if (nritems == BTRFS_NODEPTRS_PER_BLOCK(root))
-   BUG();
+   BUG_ON(nritems == BTRFS_NODEPTRS_PER_BLOCK(root));
if (slot != nritems) {
memmove_extent_buffer(lower,
  btrfs_node_key_ptr_offset(slot + 1),
@@ -2143,7 +2141,6 @@ static int insert_ptr(struct btrfs_trans_handle *trans, 
struct btrfs_root
btrfs_set_node_ptr_generation(lower, slot, trans-transid);
btrfs_set_header_nritems(lower, nritems + 1);
btrfs_mark_buffer_dirty(lower);
-   return 0;
 }
 
 /*
@@ -2164,7 +2161,6 @@ static noinline int split_node(struct btrfs_trans_handle 
*trans,
struct btrfs_disk_key disk_key;
int mid;
int ret;
-   int wret;
u32 c_nritems;
 
c = path-nodes[level];
@@ -2221,11 +2217,8 @@ static noinline int split_node(struct btrfs_trans_handle 
*trans,
btrfs_mark_buffer_dirty(c);
btrfs_mark_buffer_dirty(split);
 
-   wret = insert_ptr(trans, root, path, disk_key, split-start,
- path-slots[level + 1] + 1,
- level + 1);
-   if (wret)
-   ret = wret;
+   insert_ptr(trans, root, path, disk_key, split-start,
+  path-slots[level + 1] + 1, level + 1);
 
if (path-slots[level] = mid) {
path-slots[level] -= mid;
@@ -2722,8 +2715,6 @@ static noinline int copy_for_split(struct 
btrfs_trans_handle *trans,
int data_copy_size;
int rt_data_off;
int i;
-   int ret = 0;
-   int wret;
struct btrfs_disk_key disk_key;
 
nritems = nritems - mid;
@@ -2751,12 +2742,9 @@ static noinline int copy_for_split(struct 
btrfs_trans_handle *trans,
}
 
btrfs_set_header_nritems(l, mid);
-   ret = 0;
btrfs_item_key(right, disk_key, 0);
-   wret = insert_ptr(trans, root, path, disk_key, right-start,
- path-slots[1] + 1, 1);
-   if (wret)
-   ret = wret;
+   insert_ptr(trans, root, path, disk_key, right-start,
+  path-slots[1] + 1, 1);
 
btrfs_mark_buffer_dirty(right);
btrfs_mark_buffer_dirty(l);
@@ -2775,7 +2763,7 @@ static noinline int copy_for_split(struct 
btrfs_trans_handle *trans,
 
BUG_ON(path-slots[0]  0);
 
-   return ret;
+   return 0;
 }
 
 /*
@@ -2964,12 +2952,8 @@ again:
if (split == 0) {
if (mid = slot) {
btrfs_set_header_nritems(right, 0);
-   wret = insert_ptr(trans, root, path,
- disk_key, right-start,
- path-slots[1] + 1, 1);
-   if (wret)
-   ret = wret;
-
+   insert_ptr(trans, root, path, disk_key, right-start,
+  path-slots[1] + 1, 1);
btrfs_tree_unlock(path-nodes[0]);
free_extent_buffer(path-nodes[0]);
path-nodes[0] = right;
@@ -2977,12 +2961,8 @@ again:
path-slots[1] += 1;
} else {
btrfs_set_header_nritems(right, 0);
-   wret = insert_ptr(trans, root, path,
- disk_key,
- right-start,
- path-slots[1], 1);
+   insert_ptr(trans, root, path, disk_key, right-start,
+ path-slots[1], 1);
-   if (wret)

[patch 74/99] btrfs: Fix kfree of member instead of structure

2011-11-23 Thread Jeff Mahoney
 Correctness fix: The kfree calls in the add_delayed_* functions free
 the node that's passed into it, but the node is a member of another
 structure. It works because it's always the first member of the
 containing structure, but it should really be using the containing
 structure itself.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/delayed-ref.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index b004960..e388ca3 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -455,7 +455,7 @@ static noinline void add_delayed_ref_head(struct 
btrfs_trans_handle *trans,
 * we've updated the existing ref, free the newly
 * allocated ref
 */
-   kfree(ref);
+   kfree(head_ref);
} else {
delayed_refs-num_heads++;
delayed_refs-num_heads_ready++;
@@ -510,7 +510,7 @@ static noinline void add_delayed_tree_ref(struct 
btrfs_trans_handle *trans,
 * we've updated the existing ref, free the newly
 * allocated ref
 */
-   kfree(ref);
+   kfree(full_ref);
} else {
delayed_refs-num_entries++;
trans-delayed_ref_updates++;
@@ -565,7 +565,7 @@ static noinline void add_delayed_data_ref(struct 
btrfs_trans_handle *trans,
 * we've updated the existing ref, free the newly
 * allocated ref
 */
-   kfree(ref);
+   kfree(full_ref);
} else {
delayed_refs-num_entries++;
trans-delayed_ref_updates++;



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 71/99] btrfs: add_delayed_ref_head should return void

2011-11-23 Thread Jeff Mahoney
 add_delayed_ref_head has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/delayed-ref.c |   29 ++---
 1 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 125cf76..caa9ade 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -390,10 +390,10 @@ update_existing_head_ref(struct btrfs_delayed_ref_node 
*existing,
  * this does all the dirty work in terms of maintaining the correct
  * overall modification count.
  */
-static noinline int add_delayed_ref_head(struct btrfs_trans_handle *trans,
-   struct btrfs_delayed_ref_node *ref,
-   u64 bytenr, u64 num_bytes,
-   int action, int is_data)
+static noinline void add_delayed_ref_head(struct btrfs_trans_handle *trans,
+struct btrfs_delayed_ref_node *ref,
+u64 bytenr, u64 num_bytes,
+int action, int is_data)
 {
struct btrfs_delayed_ref_node *existing;
struct btrfs_delayed_ref_head *head_ref = NULL;
@@ -462,7 +462,6 @@ static noinline int add_delayed_ref_head(struct 
btrfs_trans_handle *trans,
delayed_refs-num_entries++;
trans-delayed_ref_updates++;
}
-   return 0;
 }
 
 /*
@@ -610,10 +609,8 @@ int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle 
*trans,
 * insert both the head node and the new ref without dropping
 * the spin lock
 */
-   ret = add_delayed_ref_head(trans, head_ref-node, bytenr, num_bytes,
-  action, 0);
-   BUG_ON(ret);
-
+   add_delayed_ref_head(trans, head_ref-node, bytenr, num_bytes,
+action, 0);
ret = add_delayed_tree_ref(trans, ref-node, bytenr, num_bytes,
   parent, ref_root, level, action);
BUG_ON(ret);
@@ -655,10 +652,8 @@ int btrfs_add_delayed_data_ref(struct btrfs_trans_handle 
*trans,
 * insert both the head node and the new ref without dropping
 * the spin lock
 */
-   ret = add_delayed_ref_head(trans, head_ref-node, bytenr, num_bytes,
-  action, 1);
-   BUG_ON(ret);
-
+   add_delayed_ref_head(trans, head_ref-node, bytenr, num_bytes,
+action, 1);
ret = add_delayed_data_ref(trans, ref-node, bytenr, num_bytes,
   parent, ref_root, owner, offset, action);
BUG_ON(ret);
@@ -672,7 +667,6 @@ int btrfs_add_delayed_extent_op(struct btrfs_trans_handle 
*trans,
 {
struct btrfs_delayed_ref_head *head_ref;
struct btrfs_delayed_ref_root *delayed_refs;
-   int ret;
 
head_ref = kmalloc(sizeof(*head_ref), GFP_NOFS);
if (!head_ref)
@@ -683,11 +677,8 @@ int btrfs_add_delayed_extent_op(struct btrfs_trans_handle 
*trans,
delayed_refs = trans-transaction-delayed_refs;
spin_lock(delayed_refs-lock);
 
-   ret = add_delayed_ref_head(trans, head_ref-node, bytenr,
-  num_bytes, BTRFS_UPDATE_DELAYED_HEAD,
-  extent_op-is_data);
-   BUG_ON(ret);
-
+   add_delayed_ref_head(trans, head_ref-node, bytenr, num_bytes,
+BTRFS_UPDATE_DELAYED_HEAD, extent_op-is_data);
spin_unlock(delayed_refs-lock);
return 0;
 }



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 69/99] btrfs: del_ptr should return void

2011-11-23 Thread Jeff Mahoney
 With fixup_low_keys now returning void, there are no error conditions
 for del_ptr to report so it should return void. We set ret = 0 explicitly
 in btrfs_del_items but I'm not convinced that the error handling code
 already there is correct.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.c |   39 +--
 1 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index fdaddcc..c605fb3 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -36,7 +36,7 @@ static int balance_node_right(struct btrfs_trans_handle 
*trans,
  struct btrfs_root *root,
  struct extent_buffer *dst_buf,
  struct extent_buffer *src_buf);
-static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
+static void del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
   struct btrfs_path *path, int level, int slot);
 
 struct btrfs_path *btrfs_alloc_path(void)
@@ -994,10 +994,7 @@ static noinline int balance_level(struct 
btrfs_trans_handle *trans,
if (btrfs_header_nritems(right) == 0) {
clean_tree_block(trans, root, right);
btrfs_tree_unlock(right);
-   wret = del_ptr(trans, root, path, level + 1, pslot +
-  1);
-   if (wret)
-   ret = wret;
+   del_ptr(trans, root, path, level + 1, pslot + 1);
root_sub_used(root, right-len);
btrfs_free_tree_block(trans, root, right, 0, 1);
free_extent_buffer(right);
@@ -1035,9 +1032,7 @@ static noinline int balance_level(struct 
btrfs_trans_handle *trans,
if (btrfs_header_nritems(mid) == 0) {
clean_tree_block(trans, root, mid);
btrfs_tree_unlock(mid);
-   wret = del_ptr(trans, root, path, level + 1, pslot);
-   if (wret)
-   ret = wret;
+   del_ptr(trans, root, path, level + 1, pslot);
root_sub_used(root, mid-len);
btrfs_free_tree_block(trans, root, mid, 0, 1);
free_extent_buffer(mid);
@@ -3683,12 +3678,11 @@ int btrfs_insert_item(struct btrfs_trans_handle *trans, 
struct btrfs_root
  * the tree should have been previously balanced so the deletion does not
  * empty a node.
  */
-static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
-  struct btrfs_path *path, int level, int slot)
+static void del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
+   struct btrfs_path *path, int level, int slot)
 {
struct extent_buffer *parent = path-nodes[level];
u32 nritems;
-   int ret = 0;
 
nritems = btrfs_header_nritems(parent);
if (slot != nritems - 1) {
@@ -3711,7 +3705,6 @@ static int del_ptr(struct btrfs_trans_handle *trans, 
struct btrfs_root *root,
fixup_low_keys(trans, root, path, disk_key, level + 1);
}
btrfs_mark_buffer_dirty(parent);
-   return ret;
 }
 
 /*
@@ -3724,17 +3717,13 @@ static int del_ptr(struct btrfs_trans_handle *trans, 
struct btrfs_root *root,
  * The path must have already been setup for deleting the leaf, including
  * all the proper balancing.  path-nodes[1] must be locked.
  */
-static noinline int btrfs_del_leaf(struct btrfs_trans_handle *trans,
-  struct btrfs_root *root,
-  struct btrfs_path *path,
-  struct extent_buffer *leaf)
+static noinline void btrfs_del_leaf(struct btrfs_trans_handle *trans,
+   struct btrfs_root *root,
+   struct btrfs_path *path,
+   struct extent_buffer *leaf)
 {
-   int ret;
-
WARN_ON(btrfs_header_generation(leaf) != trans-transid);
-   ret = del_ptr(trans, root, path, 1, path-slots[1]);
-   if (ret)
-   return ret;
+   del_ptr(trans, root, path, 1, path-slots[1]);
 
/*
 * btrfs_free_extent is expensive, we want to make sure we
@@ -3745,7 +3734,6 @@ static noinline int btrfs_del_leaf(struct 
btrfs_trans_handle *trans,
root_sub_used(root, leaf-len);
 
btrfs_free_tree_block(trans, root, leaf, 0, 1);
-   return 0;
 }
 /*
  * delete the item at the leaf level in path.  If that empties
@@ -3802,8 +3790,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, 
struct btrfs_root *root,
} else {
btrfs_set_path_blocking(path);
clean_tree_block(trans, root, leaf);
-   ret = btrfs_del_leaf(trans, root, path, leaf);
-   BUG_ON(ret);
+ 

[patch 67/99] btrfs: fixup_low_keys should return void

2011-11-23 Thread Jeff Mahoney
 fixup_low_keys has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.c |   39 +++
 1 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 011cab3..dedd3a1 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1864,15 +1864,12 @@ done:
  * fixing up pointers when a given leaf/node is not in slot 0 of the
  * higher levels
  *
- * If this fails to write a tree block, it returns -1, but continues
- * fixing up the blocks in ram so the tree is consistent.
  */
-static int fixup_low_keys(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct btrfs_path *path,
- struct btrfs_disk_key *key, int level)
+static void fixup_low_keys(struct btrfs_trans_handle *trans,
+  struct btrfs_root *root, struct btrfs_path *path,
+  struct btrfs_disk_key *key, int level)
 {
int i;
-   int ret = 0;
struct extent_buffer *t;
 
for (i = level; i  BTRFS_MAX_LEVEL; i++) {
@@ -1885,7 +1882,6 @@ static int fixup_low_keys(struct btrfs_trans_handle 
*trans,
if (tslot != 0)
break;
}
-   return ret;
 }
 
 /*
@@ -2626,9 +2622,7 @@ static noinline int __push_leaf_left(struct 
btrfs_trans_handle *trans,
clean_tree_block(trans, root, right);
 
btrfs_item_key(right, disk_key, 0);
-   wret = fixup_low_keys(trans, root, path, disk_key, 1);
-   if (wret)
-   ret = wret;
+   fixup_low_keys(trans, root, path, disk_key, 1);
 
/* then fixup the leaf pointer in the path */
if (path-slots[0]  push_items) {
@@ -2999,12 +2993,9 @@ again:
free_extent_buffer(path-nodes[0]);
path-nodes[0] = right;
path-slots[0] = 0;
-   if (path-slots[1] == 0) {
-   wret = fixup_low_keys(trans, root,
-   path, disk_key, 1);
-   if (wret)
-   ret = wret;
-   }
+   if (path-slots[1] == 0)
+   fixup_low_keys(trans, root, path,
+  disk_key, 1);
}
btrfs_mark_buffer_dirty(right);
return ret;
@@ -3527,7 +3518,7 @@ int btrfs_insert_some_items(struct btrfs_trans_handle 
*trans,
ret = 0;
if (slot == 0) {
btrfs_cpu_key_to_disk(disk_key, cpu_key);
-   ret = fixup_low_keys(trans, root, path, disk_key, 1);
+   fixup_low_keys(trans, root, path, disk_key, 1);
}
 
if (btrfs_leaf_free_space(root, leaf)  0) {
@@ -3555,7 +3546,6 @@ int setup_items_for_insert(struct btrfs_trans_handle 
*trans,
u32 nritems;
unsigned int data_end;
struct btrfs_disk_key disk_key;
-   int ret;
struct extent_buffer *leaf;
int slot;
 
@@ -3616,10 +3606,9 @@ int setup_items_for_insert(struct btrfs_trans_handle 
*trans,
 
btrfs_set_header_nritems(leaf, nritems + nr);
 
-   ret = 0;
if (slot == 0) {
btrfs_cpu_key_to_disk(disk_key, cpu_key);
-   ret = fixup_low_keys(trans, root, path, disk_key, 1);
+   fixup_low_keys(trans, root, path, disk_key, 1);
}
btrfs_unlock_up_safe(path, 1);
btrfs_mark_buffer_dirty(leaf);
@@ -3706,7 +3695,6 @@ static int del_ptr(struct btrfs_trans_handle *trans, 
struct btrfs_root *root,
struct extent_buffer *parent = path-nodes[level];
u32 nritems;
int ret = 0;
-   int wret;
 
nritems = btrfs_header_nritems(parent);
if (slot != nritems - 1) {
@@ -3726,9 +3714,7 @@ static int del_ptr(struct btrfs_trans_handle *trans, 
struct btrfs_root *root,
struct btrfs_disk_key disk_key;
 
btrfs_node_key(parent, disk_key, 0);
-   wret = fixup_low_keys(trans, root, path, disk_key, level + 1);
-   if (wret)
-   ret = wret;
+   fixup_low_keys(trans, root, path, disk_key, level + 1);
}
btrfs_mark_buffer_dirty(parent);
return ret;
@@ -3831,10 +3817,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, 
struct btrfs_root *root,
struct btrfs_disk_key disk_key;
 
btrfs_item_key(leaf, disk_key, 0);
-   wret = fixup_low_keys(trans, root, path,
- disk_key, 1);
-   if (wret)
-   ret = wret;
+   fixup_low_keys(trans, root, path, disk_key, 1);
}
 
/* delete the leaf if it is mostly empty 

[patch 64/99] btrfs: Factor out tree-ops-merge_bio_hook call

2011-11-23 Thread Jeff Mahoney
 In submit_extent_page, there's a visually noisy if statement that, in
 the midst of other conditions, does the tree dependency for tree-ops
 and tree-ops-merge_bio_hook before calling it, and then another
 condition afterwards. If an error is returned from merge_bio_hook,
 there's no way to catch it. It's considered a routine 1 return
 value instead of a failure.

 This patch factors out the dependency check into a new local merge_bio
 routine and BUG's on an error. The if statement is less noisy as a side-
 effect.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |   17 ++---
 fs/btrfs/inode.c |5 +++--
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 0575792..09095b8 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2058,6 +2058,19 @@ static int submit_one_bio(int rw, struct bio *bio, int 
mirror_num,
return ret;
 }
 
+static int merge_bio(struct extent_io_tree *tree, struct page *page,
+unsigned long offset, size_t size, struct bio *bio,
+unsigned long bio_flags)
+{
+   int ret = 0;
+   if (tree-ops  tree-ops-merge_bio_hook)
+   ret = tree-ops-merge_bio_hook(page, offset, size, bio,
+   bio_flags);
+   BUG_ON(ret  0);
+   return ret;
+
+}
+
 static int submit_extent_page(int rw, struct extent_io_tree *tree,
  struct page *page, sector_t sector,
  size_t size, unsigned long offset,
@@ -2086,9 +2099,7 @@ static int submit_extent_page(int rw, struct 
extent_io_tree *tree,
sector;
 
if (prev_bio_flags != bio_flags || !contig ||
-   (tree-ops  tree-ops-merge_bio_hook 
-tree-ops-merge_bio_hook(page, offset, page_size, bio,
-  bio_flags)) ||
+   merge_bio(tree, page, offset, page_size, bio, bio_flags) ||
bio_add_page(bio, page, page_size, offset)  page_size) {
ret = submit_one_bio(rw, bio, mirror_num,
 prev_bio_flags);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c0dc599..a06cb64 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1425,10 +1425,11 @@ int btrfs_merge_bio_hook(struct page *page, unsigned 
long offset,
map_length = length;
ret = btrfs_map_block(map_tree, READ, logical,
  map_length, NULL, 0);
-
+   /* Will always return 0 or 1 with map_multi == NULL */
+   BUG_ON(ret  0);
if (map_length  length + size)
return 1;
-   return ret;
+   return 0;
 }
 
 /*



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 72/99] btrfs: add_delayed_tree_ref should return void

2011-11-23 Thread Jeff Mahoney
 add_delayed_tree_ref has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/delayed-ref.c |   15 ++-
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index caa9ade..3ae2401 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -467,10 +467,10 @@ static noinline void add_delayed_ref_head(struct 
btrfs_trans_handle *trans,
 /*
  * helper to insert a delayed tree ref into the rbtree.
  */
-static noinline int add_delayed_tree_ref(struct btrfs_trans_handle *trans,
-struct btrfs_delayed_ref_node *ref,
-u64 bytenr, u64 num_bytes, u64 parent,
-u64 ref_root, int level, int action)
+static noinline void add_delayed_tree_ref(struct btrfs_trans_handle *trans,
+ struct btrfs_delayed_ref_node *ref,
+ u64 bytenr, u64 num_bytes, u64 parent,
+ u64 ref_root, int level, int action)
 {
struct btrfs_delayed_ref_node *existing;
struct btrfs_delayed_tree_ref *full_ref;
@@ -515,7 +515,6 @@ static noinline int add_delayed_tree_ref(struct 
btrfs_trans_handle *trans,
delayed_refs-num_entries++;
trans-delayed_ref_updates++;
}
-   return 0;
 }
 
 /*
@@ -587,7 +586,6 @@ int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle 
*trans,
struct btrfs_delayed_tree_ref *ref;
struct btrfs_delayed_ref_head *head_ref;
struct btrfs_delayed_ref_root *delayed_refs;
-   int ret;
 
BUG_ON(extent_op  extent_op-is_data);
ref = kmalloc(sizeof(*ref), GFP_NOFS);
@@ -611,9 +609,8 @@ int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle 
*trans,
 */
add_delayed_ref_head(trans, head_ref-node, bytenr, num_bytes,
 action, 0);
-   ret = add_delayed_tree_ref(trans, ref-node, bytenr, num_bytes,
-  parent, ref_root, level, action);
-   BUG_ON(ret);
+   add_delayed_tree_ref(trans, ref-node, bytenr, num_bytes, parent,
+ref_root, level, action);
spin_unlock(delayed_refs-lock);
return 0;
 }



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 65/99] btrfs: -submit_bio_hook error push-up

2011-11-23 Thread Jeff Mahoney
 This pushes failures from the submit_bio_hook callbacks,
 btrfs_submit_bio_hook and btree_submit_bio_hook into the callers, including
 callers of submit_one_bio where it catches the failures with BUG_ON.

 It also pushes up through the -readpage_io_failed_hook to
 end_bio_extent_writepage where the error is already caught with BUG_ON.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/disk-io.c   |6 +++---
 fs/btrfs/extent_io.c |   33 +++--
 fs/btrfs/inode.c |3 ++-
 3 files changed, 28 insertions(+), 14 deletions(-)

--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -811,9 +811,9 @@ static int btree_submit_bio_hook(struct
 {
int ret;
 
-   ret = btrfs_bio_wq_end_io(BTRFS_I(inode)-root-fs_info,
- bio, 1);
-   BUG_ON(ret);
+   ret = btrfs_bio_wq_end_io(BTRFS_I(inode)-root-fs_info, bio, 1);
+   if (ret)
+   return ret;
 
if (!(rw  REQ_WRITE)) {
/*
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1888,6 +1888,7 @@ static void end_bio_extent_writepage(str
uptodate = (err == 0);
continue;
}
+   BUG_ON(ret  0);
}
 
if (!uptodate) {
@@ -1980,6 +1981,7 @@ static void end_bio_extent_readpage(stru
uncache_state(cached);
continue;
}
+   BUG_ON(ret  0);
}
 
if (uptodate) {
@@ -2034,8 +2036,8 @@ btrfs_bio_alloc(struct block_device *bde
return bio;
 }
 
-static int submit_one_bio(int rw, struct bio *bio, int mirror_num,
- unsigned long bio_flags)
+static int __must_check submit_one_bio(int rw, struct bio *bio,
+  int mirror_num, unsigned long bio_flags)
 {
int ret = 0;
struct bio_vec *bvec = bio-bi_io_vec + bio-bi_vcnt - 1;
@@ -2105,6 +2107,7 @@ static int submit_extent_page(int rw, st
bio_add_page(bio, page, page_size, offset)  page_size) {
ret = submit_one_bio(rw, bio, mirror_num,
 prev_bio_flags);
+   BUG_ON(ret  0);
bio = NULL;
} else {
return 0;
@@ -2125,8 +2128,10 @@ static int submit_extent_page(int rw, st
 
if (bio_ret)
*bio_ret = bio;
-   else
+   else {
ret = submit_one_bio(rw, bio, mirror_num, bio_flags);
+   BUG_ON(ret  0);
+   }
 
return ret;
 }
@@ -2349,8 +2354,10 @@ int extent_read_full_page(struct extent_
 
ret = __extent_read_full_page(tree, page, get_extent, bio, mirror_num,
  bio_flags);
-   if (bio)
+   if (bio) {
ret = submit_one_bio(READ, bio, mirror_num, bio_flags);
+   BUG_ON(ret  0);
+   }
return ret;
 }
 
@@ -2752,10 +2759,12 @@ retry:
 static void flush_epd_write_bio(struct extent_page_data *epd)
 {
if (epd-bio) {
+   int ret;
if (epd-sync_io)
-   submit_one_bio(WRITE_SYNC, epd-bio, 0, 0);
+   ret = submit_one_bio(WRITE_SYNC, epd-bio, 0, 0);
else
-   submit_one_bio(WRITE, epd-bio, 0, 0);
+   ret = submit_one_bio(WRITE, epd-bio, 0, 0);
+   BUG_ON(ret  0);
epd-bio = NULL;
}
 }
@@ -2871,8 +2880,10 @@ int extent_readpages(struct extent_io_tr
page_cache_release(page);
}
BUG_ON(!list_empty(pages));
-   if (bio)
-   submit_one_bio(READ, bio, 0, bio_flags);
+   if (bio) {
+   int ret = submit_one_bio(READ, bio, 0, bio_flags);
+   BUG_ON(ret  0);
+   }
return 0;
 }
 
@@ -3704,8 +3715,10 @@ int read_extent_buffer_pages(struct exte
}
}
 
-   if (bio)
-   submit_one_bio(READ, bio, mirror_num, bio_flags);
+   if (bio) {
+   err = submit_one_bio(READ, bio, mirror_num, bio_flags);
+   BUG_ON(err  0);
+   }
 
if (ret || wait != WAIT_COMPLETE)
return ret;
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1488,7 +1488,8 @@ static int btrfs_submit_bio_hook(struct
metadata = 2;
 
ret = btrfs_bio_wq_end_io(root-fs_info, bio, metadata);
-   BUG_ON(ret);
+   if (ret)
+   return ret;
 
if (!(rw  REQ_WRITE)) {
if (bio_flags  EXTENT_BIO_COMPRESSED) {



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 66/99] btrfs: __add_reloc_root error push-up

2011-11-23 Thread Jeff Mahoney
 This patch pushes kmalloc errors up to the caller and BUGs in the caller.

 The BUG_ON for duplicate reloc tree root insertion is replaced with a
 panic explaining the issue.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/relocation.c |   22 --
 1 file changed, 16 insertions(+), 6 deletions(-)

--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1219,14 +1219,15 @@ fail:
 /*
  * helper to add 'address of tree root - reloc tree' mapping
  */
-static int __add_reloc_root(struct btrfs_root *root)
+static int __must_check __add_reloc_root(struct btrfs_root *root)
 {
struct rb_node *rb_node;
struct mapping_node *node;
struct reloc_control *rc = root-fs_info-reloc_ctl;
 
node = kmalloc(sizeof(*node), GFP_NOFS);
-   BUG_ON(!node);
+   if (!node)
+   return -ENOMEM;
 
node-bytenr = root-node-start;
node-data = root;
@@ -1235,7 +1236,12 @@ static int __add_reloc_root(struct btrfs
rb_node = tree_insert(rc-reloc_root_tree.rb_root,
  node-bytenr, node-rb_node);
spin_unlock(rc-reloc_root_tree.lock);
-   BUG_ON(rb_node);
+   if (rb_node) {
+   kfree(node);
+   btrfs_panic(root-fs_info, -EEXIST, Duplicate root found 
+   for start=%llu while inserting into relocation 
+   tree\n);
+   }
 
list_add_tail(root-root_list, rc-reloc_roots);
return 0;
@@ -1351,6 +1357,7 @@ int btrfs_init_reloc_root(struct btrfs_t
struct btrfs_root *reloc_root;
struct reloc_control *rc = root-fs_info-reloc_ctl;
int clear_rsv = 0;
+   int ret;
 
if (root-reloc_root) {
reloc_root = root-reloc_root;
@@ -1370,7 +1377,8 @@ int btrfs_init_reloc_root(struct btrfs_t
if (clear_rsv)
trans-block_rsv = NULL;
 
-   __add_reloc_root(reloc_root);
+   ret = __add_reloc_root(reloc_root);
+   BUG_ON(ret  0);
root-reloc_root = reloc_root;
return 0;
 }
@@ -4248,7 +4256,8 @@ int btrfs_recover_relocation(struct btrf
   reloc_root-root_key.offset);
BUG_ON(IS_ERR(fs_root));
 
-   __add_reloc_root(reloc_root);
+   err = __add_reloc_root(reloc_root);
+   BUG_ON(err  0);
fs_root-reloc_root = reloc_root;
}
 
@@ -4450,7 +4459,8 @@ void btrfs_reloc_post_snapshot(struct bt
reloc_root = create_reloc_root(trans, root-reloc_root,
   new_root-root_key.objectid);
 
-   __add_reloc_root(reloc_root);
+   ret = __add_reloc_root(reloc_root);
+   BUG_ON(ret  0);
new_root-reloc_root = reloc_root;
 
if (rc-create_reloc_tree) {



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 63/99] btrfs: Simplify btrfs_submit_bio_hook

2011-11-23 Thread Jeff Mahoney
 btrfs_submit_bio_hook currently calls btrfs_bio_wq_end_io in either case
 of an if statement that determines one of the arguments.

 This patch moves the function call outside of the if statement and uses it
 to only determine the different argument. This allows us to catch an
 error in one place in a more visually obvious way.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/inode.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 59c681b..c0dc599 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1479,13 +1479,14 @@ static int btrfs_submit_bio_hook(struct inode *inode, 
int rw, struct bio *bio,
struct btrfs_root *root = BTRFS_I(inode)-root;
int ret = 0;
int skip_sum;
+   int metadata = 0;
 
skip_sum = BTRFS_I(inode)-flags  BTRFS_INODE_NODATASUM;
 
if (btrfs_is_free_space_inode(root, inode))
-   ret = btrfs_bio_wq_end_io(root-fs_info, bio, 2);
-   else
-   ret = btrfs_bio_wq_end_io(root-fs_info, bio, 0);
+   metadata = 2;
+
+   ret = btrfs_bio_wq_end_io(root-fs_info, bio, metadata);
BUG_ON(ret);
 
if (!(rw  REQ_WRITE)) {



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 61/99] btrfs: setup_inline_extent_backref should return void

2011-11-23 Thread Jeff Mahoney
 setup_inline_extent_backref has no error conditions and should return
 void. We set ret = 0 explicitly in insert_inline_extent_backref since
 it would have been set using the return value, which would have been 0.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent-tree.c |   23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1556,13 +1556,13 @@ out:
  * helper to add new inline back ref
  */
 static noinline_for_stack
-int setup_inline_extent_backref(struct btrfs_trans_handle *trans,
-   struct btrfs_root *root,
-   struct btrfs_path *path,
-   struct btrfs_extent_inline_ref *iref,
-   u64 parent, u64 root_objectid,
-   u64 owner, u64 offset, int refs_to_add,
-   struct btrfs_delayed_extent_op *extent_op)
+void setup_inline_extent_backref(struct btrfs_trans_handle *trans,
+struct btrfs_root *root,
+struct btrfs_path *path,
+struct btrfs_extent_inline_ref *iref,
+u64 parent, u64 root_objectid,
+u64 owner, u64 offset, int refs_to_add,
+struct btrfs_delayed_extent_op *extent_op)
 {
struct extent_buffer *leaf;
struct btrfs_extent_item *ei;
@@ -1616,7 +1616,6 @@ int setup_inline_extent_backref(struct b
btrfs_set_extent_inline_ref_offset(leaf, iref, root_objectid);
}
btrfs_mark_buffer_dirty(leaf);
-   return 0;
 }
 
 static int lookup_extent_backref(struct btrfs_trans_handle *trans,
@@ -1735,10 +1734,10 @@ int insert_inline_extent_backref(struct
ret = update_inline_extent_backref(trans, root, path, iref,
   refs_to_add, extent_op);
} else if (ret == -ENOENT) {
-   ret = setup_inline_extent_backref(trans, root, path, iref,
- parent, root_objectid,
- owner, offset, refs_to_add,
- extent_op);
+   setup_inline_extent_backref(trans, root, path, iref, parent,
+   root_objectid, owner, offset,
+   refs_to_add, extent_op);
+   ret = 0;
}
return ret;
 }



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 60/99] btrfs: btrfs_set_block_group_rw should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_set_block_group_rw has no error conditions and should return
 void. Its callers already ignore the error codes anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.h   |4 ++--
 fs/btrfs/extent-tree.c |3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2263,8 +2263,8 @@ void btrfs_block_rsv_release(struct btrf
 u64 num_bytes);
 int btrfs_set_block_group_ro(struct btrfs_root *root,
 struct btrfs_block_group_cache *cache);
-int btrfs_set_block_group_rw(struct btrfs_root *root,
-struct btrfs_block_group_cache *cache);
+void btrfs_set_block_group_rw(struct btrfs_root *root,
+ struct btrfs_block_group_cache *cache);
 void btrfs_put_block_group_cache(struct btrfs_fs_info *info);
 u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo);
 int btrfs_error_unpin_extent_range(struct btrfs_root *root,
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6769,7 +6769,7 @@ u64 btrfs_account_ro_block_groups_free_s
return free_bytes;
 }
 
-int btrfs_set_block_group_rw(struct btrfs_root *root,
+void btrfs_set_block_group_rw(struct btrfs_root *root,
  struct btrfs_block_group_cache *cache)
 {
struct btrfs_space_info *sinfo = cache-space_info;
@@ -6785,7 +6785,6 @@ int btrfs_set_block_group_rw(struct btrf
cache-ro = 0;
spin_unlock(cache-lock);
spin_unlock(sinfo-lock);
-   return 0;
 }
 
 /*



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 58/99] btrfs: btrfs_destroy_delalloc_inodes should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_destroy_delalloc_inodes has no error conditions and should return
 void. Its callers already ignore the error codes anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/disk-io.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -54,7 +54,7 @@ static int btrfs_destroy_ordered_extents
 static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
  struct btrfs_root *root);
 static int btrfs_destroy_pending_snapshots(struct btrfs_transaction *t);
-static int btrfs_destroy_delalloc_inodes(struct btrfs_root *root);
+static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root);
 static int btrfs_destroy_marked_extents(struct btrfs_root *root,
struct extent_io_tree *dirty_pages,
int mark);
@@ -2939,7 +2939,7 @@ static int btrfs_destroy_pending_snapsho
return 0;
 }
 
-static int btrfs_destroy_delalloc_inodes(struct btrfs_root *root)
+static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root)
 {
struct btrfs_inode *btrfs_inode;
struct list_head splice;
@@ -2959,8 +2959,6 @@ static int btrfs_destroy_delalloc_inodes
}
 
spin_unlock(root-fs_info-delalloc_lock);
-
-   return 0;
 }
 
 static int btrfs_destroy_marked_extents(struct btrfs_root *root,



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 59/99] btrfs: btrfs_prepare_extent_commit should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_prepare_extent_commit has no error conditions and should return
 void. Its callers already ignore the error codes anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.h   |4 ++--
 fs/btrfs/extent-tree.c |3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2207,8 +2207,8 @@ int btrfs_free_extent(struct btrfs_trans
 int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len);
 int btrfs_free_and_pin_reserved_extent(struct btrfs_root *root,
   u64 start, u64 len);
-int btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans,
-   struct btrfs_root *root);
+void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans,
+struct btrfs_root *root);
 int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
   struct btrfs_root *root);
 int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4385,7 +4385,7 @@ static int btrfs_update_reserved_bytes(s
return ret;
 }
 
-int btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans,
+void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans,
struct btrfs_root *root)
 {
struct btrfs_fs_info *fs_info = root-fs_info;
@@ -4415,7 +4415,6 @@ int btrfs_prepare_extent_commit(struct b
up_write(fs_info-extent_commit_sem);
 
update_global_block_rsv(fs_info);
-   return 0;
 }
 
 static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end)



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 57/99] btrfs: __setup_root should return void

2011-11-23 Thread Jeff Mahoney
 __setup_root has no error conditions and should return void. Its callers
 already ignore the error codes anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/disk-io.c |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1058,10 +1058,10 @@ int clean_tree_block(struct btrfs_trans_
return 0;
 }
 
-static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
-   u32 stripesize, struct btrfs_root *root,
-   struct btrfs_fs_info *fs_info,
-   u64 objectid)
+static void __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
+u32 stripesize, struct btrfs_root *root,
+struct btrfs_fs_info *fs_info,
+u64 objectid)
 {
root-node = NULL;
root-commit_root = NULL;
@@ -1114,7 +1114,6 @@ static int __setup_root(u32 nodesize, u3
root-defrag_running = 0;
root-root_key.objectid = objectid;
root-anon_dev = 0;
-   return 0;
 }
 
 static int __must_check find_and_setup_root(struct btrfs_root *tree_root,



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 55/99] btrfs: btrfs_init_compress should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_init_compress doesn't have any failure conditions, so return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/compression.c |3 +--
 fs/btrfs/compression.h |2 +-
 fs/btrfs/super.c   |5 +
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index cca501b..0c0e842 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -734,7 +734,7 @@ struct btrfs_compress_op *btrfs_compress_op[] = {
btrfs_lzo_compress,
 };
 
-int __init btrfs_init_compress(void)
+void __init btrfs_init_compress(void)
 {
int i;
 
@@ -744,7 +744,6 @@ int __init btrfs_init_compress(void)
atomic_set(comp_alloc_workspace[i], 0);
init_waitqueue_head(comp_workspace_wait[i]);
}
-   return 0;
 }
 
 /*
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index a12059f..9afb0a6 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -19,7 +19,7 @@
 #ifndef __BTRFS_COMPRESSION_
 #define __BTRFS_COMPRESSION_
 
-int btrfs_init_compress(void);
+void btrfs_init_compress(void);
 void btrfs_exit_compress(void);
 
 int btrfs_compress_pages(int type, struct address_space *mapping,
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 0152207..26e1dcf 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1347,9 +1347,7 @@ static int __init init_btrfs_fs(void)
if (err)
return err;
 
-   err = btrfs_init_compress();
-   if (err)
-   goto free_sysfs;
+   btrfs_init_compress();
 
err = btrfs_init_cachep();
if (err)
@@ -1390,7 +1388,6 @@ free_cachep:
btrfs_destroy_cachep();
 free_compress:
btrfs_exit_compress();
-free_sysfs:
btrfs_exit_sysfs();
return err;
 }



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 56/99] btrfs: btrfs_invalidate_inodes should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_invalidate_inodes has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.h |2 +-
 fs/btrfs/inode.c |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 7d90a9c..e8f0689 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2584,7 +2584,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root);
 void btrfs_orphan_commit_root(struct btrfs_trans_handle *trans,
  struct btrfs_root *root);
 int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size);
-int btrfs_invalidate_inodes(struct btrfs_root *root);
+void btrfs_invalidate_inodes(struct btrfs_root *root);
 void btrfs_add_delayed_iput(struct inode *inode);
 void btrfs_run_delayed_iputs(struct btrfs_root *root);
 int btrfs_prealloc_file_range(struct inode *inode, int mode,
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 321c9cf..59c681b 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3861,7 +3861,7 @@ static void inode_tree_del(struct inode *inode)
}
 }
 
-int btrfs_invalidate_inodes(struct btrfs_root *root)
+void btrfs_invalidate_inodes(struct btrfs_root *root)
 {
struct rb_node *node;
struct rb_node *prev;
@@ -3921,7 +3921,6 @@ again:
node = rb_next(node);
}
spin_unlock(root-inode_lock);
-   return 0;
 }
 
 static int btrfs_init_locked_inode(struct inode *inode, void *p)



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 53/99] btrfs: btrfs_end_log_trans should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_end_log_trans has no error conditions and should return void.
 Its callers ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/tree-log.c |3 +--
 fs/btrfs/tree-log.h |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 483e280..2c45b3d 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -212,14 +212,13 @@ int btrfs_pin_log_trans(struct btrfs_root *root)
  * indicate we're done making changes to the log tree
  * and wake up anyone waiting to do a sync
  */
-int btrfs_end_log_trans(struct btrfs_root *root)
+void btrfs_end_log_trans(struct btrfs_root *root)
 {
if (atomic_dec_and_test(root-log_writers)) {
smp_mb();
if (waitqueue_active(root-log_writer_wait))
wake_up(root-log_writer_wait);
}
-   return 0;
 }
 
 
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index 2270ac5..862ac81 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -38,7 +38,7 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle 
*trans,
   struct btrfs_root *root,
   const char *name, int name_len,
   struct inode *inode, u64 dirid);
-int btrfs_end_log_trans(struct btrfs_root *root);
+void btrfs_end_log_trans(struct btrfs_root *root);
 int btrfs_pin_log_trans(struct btrfs_root *root);
 int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct inode *inode,



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 52/99] btrfs: btrfs_requeue_work should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_requeue_work has no error conditions and should return void.
 Its callers ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/async-thread.c |7 ++-
 fs/btrfs/async-thread.h |2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -613,14 +613,14 @@ found:
  * it was taken from.  It is intended for use with long running work functions
  * that make some progress and want to give the cpu up for others.
  */
-int btrfs_requeue_work(struct btrfs_work *work)
+void btrfs_requeue_work(struct btrfs_work *work)
 {
struct btrfs_worker_thread *worker = work-worker;
unsigned long flags;
int wake = 0;
 
if (test_and_set_bit(WORK_QUEUED_BIT, work-flags))
-   goto out;
+   return;
 
spin_lock_irqsave(worker-lock, flags);
if (test_bit(WORK_HIGH_PRIO_BIT, work-flags))
@@ -647,9 +647,6 @@ int btrfs_requeue_work(struct btrfs_work
if (wake)
wake_up_process(worker-task);
spin_unlock_irqrestore(worker-lock, flags);
-out:
-
-   return 0;
 }
 
 void btrfs_set_work_high_prio(struct btrfs_work *work)
--- a/fs/btrfs/async-thread.h
+++ b/fs/btrfs/async-thread.h
@@ -114,6 +114,6 @@ int btrfs_start_workers(struct btrfs_wor
 void btrfs_stop_workers(struct btrfs_workers *workers);
 void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max,
struct btrfs_workers *async_starter);
-int btrfs_requeue_work(struct btrfs_work *work);
+void btrfs_requeue_work(struct btrfs_work *work);
 void btrfs_set_work_high_prio(struct btrfs_work *work);
 #endif



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 50/99] btrfs: run_ordered_completions should return void

2011-11-23 Thread Jeff Mahoney
 run_ordered_completions has no error conditions and should return void.
 Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/async-thread.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -174,11 +174,11 @@ out:
spin_unlock_irqrestore(workers-lock, flags);
 }
 
-static noinline int run_ordered_completions(struct btrfs_workers *workers,
+static noinline void run_ordered_completions(struct btrfs_workers *workers,
struct btrfs_work *work)
 {
if (!workers-ordered)
-   return 0;
+   return;
 
set_bit(WORK_DONE_BIT, work-flags);
 
@@ -216,7 +216,6 @@ static noinline int run_ordered_completi
}
 
spin_unlock(workers-order_lock);
-   return 0;
 }
 
 static void put_worker(struct btrfs_worker_thread *worker)



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 54/99] btrfs: wait_for_writer should return void

2011-11-23 Thread Jeff Mahoney
 wait_for_writer has no error conditions and should return void. Its
 callers already ignore the error codes anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/tree-log.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 2c45b3d..aac743b 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1964,8 +1964,8 @@ static int wait_log_commit(struct btrfs_trans_handle 
*trans,
return 0;
 }
 
-static int wait_for_writer(struct btrfs_trans_handle *trans,
-  struct btrfs_root *root)
+static void wait_for_writer(struct btrfs_trans_handle *trans,
+   struct btrfs_root *root)
 {
DEFINE_WAIT(wait);
while (atomic_read(root-log_writers)) {
@@ -1978,7 +1978,6 @@ static int wait_for_writer(struct btrfs_trans_handle 
*trans,
mutex_lock(root-log_mutex);
finish_wait(root-log_writer_wait, wait);
}
-   return 0;
 }
 
 /*



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 49/99] btrfs: btrfs_queue_worker should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_queue_worker has no error conditions and should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/async-thread.c |   14 --
 fs/btrfs/async-thread.h |2 +-
 2 files changed, 5 insertions(+), 11 deletions(-)

--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -95,7 +95,6 @@ static void start_new_worker_func(struct
 static int start_new_worker(struct btrfs_workers *queue)
 {
struct worker_start *start;
-   int ret;
 
start = kzalloc(sizeof(*start), GFP_NOFS);
if (!start)
@@ -103,10 +102,8 @@ static int start_new_worker(struct btrfs
 
start-work.func = start_new_worker_func;
start-queue = queue;
-   ret = btrfs_queue_worker(queue-atomic_worker_start, start-work);
-   if (ret)
-   kfree(start);
-   return ret;
+   btrfs_queue_worker(queue-atomic_worker_start, start-work);
+   return 0;
 }
 
 /*
@@ -665,7 +662,7 @@ void btrfs_set_work_high_prio(struct btr
 /*
  * places a struct btrfs_work into the pending queue of one of the kthreads
  */
-int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work)
+void btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work)
 {
struct btrfs_worker_thread *worker;
unsigned long flags;
@@ -673,7 +670,7 @@ int btrfs_queue_worker(struct btrfs_work
 
/* don't requeue something already on a list */
if (test_and_set_bit(WORK_QUEUED_BIT, work-flags))
-   goto out;
+   return;
 
worker = find_worker(workers);
if (workers-ordered) {
@@ -712,7 +709,4 @@ int btrfs_queue_worker(struct btrfs_work
if (wake)
wake_up_process(worker-task);
spin_unlock_irqrestore(worker-lock, flags);
-
-out:
-   return 0;
 }
--- a/fs/btrfs/async-thread.h
+++ b/fs/btrfs/async-thread.h
@@ -109,7 +109,7 @@ struct btrfs_workers {
char *name;
 };
 
-int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work);
+void btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work 
*work);
 int btrfs_start_workers(struct btrfs_workers *workers, int num_workers);
 int btrfs_stop_workers(struct btrfs_workers *workers);
 void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max,



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 47/99] btrfs: schedule_bio should return void

2011-11-23 Thread Jeff Mahoney
 schedule_bio has no error conditions and should return void. Its callers
 already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/volumes.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3268,7 +3268,7 @@ struct async_sched {
  * This will add one bio to the pending list for a device and make sure
  * the work struct is scheduled.
  */
-static noinline int schedule_bio(struct btrfs_root *root,
+static noinline void schedule_bio(struct btrfs_root *root,
 struct btrfs_device *device,
 int rw, struct bio *bio)
 {
@@ -3280,7 +3280,6 @@ static noinline int schedule_bio(struct
bio_get(bio);
submit_bio(rw, bio);
bio_put(bio);
-   return 0;
}
 
/*
@@ -3314,7 +3313,6 @@ static noinline int schedule_bio(struct
if (should_queue)
btrfs_queue_worker(root-fs_info-submit_workers,
   device-work);
-   return 0;
 }
 
 int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 51/99] btrfs: btrfs_stop_workers should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_stop_workers has no error conditions and should return void.
 Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/async-thread.c |3 +--
 fs/btrfs/async-thread.h |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -401,7 +401,7 @@ again:
 /*
  * this will wait for all the worker threads to shutdown
  */
-int btrfs_stop_workers(struct btrfs_workers *workers)
+void btrfs_stop_workers(struct btrfs_workers *workers)
 {
struct list_head *cur;
struct btrfs_worker_thread *worker;
@@ -429,7 +429,6 @@ int btrfs_stop_workers(struct btrfs_work
put_worker(worker);
}
spin_unlock_irq(workers-lock);
-   return 0;
 }
 
 /*
--- a/fs/btrfs/async-thread.h
+++ b/fs/btrfs/async-thread.h
@@ -111,7 +111,7 @@ struct btrfs_workers {
 
 void btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work 
*work);
 int btrfs_start_workers(struct btrfs_workers *workers, int num_workers);
-int btrfs_stop_workers(struct btrfs_workers *workers);
+void btrfs_stop_workers(struct btrfs_workers *workers);
 void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max,
struct btrfs_workers *async_starter);
 int btrfs_requeue_work(struct btrfs_work *work);



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 40/99] btrfs: check_page_uptodate should return void

2011-11-23 Thread Jeff Mahoney
 check_page_uptodate has no error conditions and should return void. Its
 callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1805,14 +1805,12 @@ int test_range_bit(struct extent_io_tree
  * helper function to set a given page up to date if all the
  * extents in the tree for that page are up to date
  */
-static int check_page_uptodate(struct extent_io_tree *tree,
-  struct page *page)
+static void check_page_uptodate(struct extent_io_tree *tree, struct page *page)
 {
u64 start = (u64)page-index  PAGE_CACHE_SHIFT;
u64 end = start + PAGE_CACHE_SIZE - 1;
if (test_range_bit(tree, start, end, EXTENT_UPTODATE, 1, NULL))
SetPageUptodate(page);
-   return 0;
 }
 
 /*



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 37/99] btrfs: wait_on_state should return void

2011-11-23 Thread Jeff Mahoney
 wait_on_state has no error conditions and should return void. Its callers
 already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -621,8 +621,8 @@ search_again:
  cached_state, GFP_ATOMIC);
 }
 
-static int wait_on_state(struct extent_io_tree *tree,
-struct extent_state *state)
+static void wait_on_state(struct extent_io_tree *tree,
+ struct extent_state *state)
__releases(tree-lock)
__acquires(tree-lock)
 {
@@ -632,7 +632,6 @@ static int wait_on_state(struct extent_i
schedule();
spin_lock(tree-lock);
finish_wait(state-wq, wait);
-   return 0;
 }
 
 /*



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 38/99] btrfs: wait_extent_bit should return void

2011-11-23 Thread Jeff Mahoney
 wait_extent_bit has no error conditions and should return void. Its
 callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |3 +--
 fs/btrfs/extent_io.h |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -639,7 +639,7 @@ static void wait_on_state(struct extent_
  * The range [start, end] is inclusive.
  * The tree lock is taken by this function
  */
-int wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits)
+void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits)
 {
struct extent_state *state;
struct rb_node *node;
@@ -676,7 +676,6 @@ again:
}
 out:
spin_unlock(tree-lock);
-   return 0;
 }
 
 static void set_state_bits(struct extent_io_tree *tree,
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -277,7 +277,7 @@ void memmove_extent_buffer(struct extent
   unsigned long src_offset, unsigned long len);
 void memset_extent_buffer(struct extent_buffer *eb, char c,
  unsigned long start, unsigned long len);
-int wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits);
+void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int 
bits);
 int clear_extent_buffer_dirty(struct extent_io_tree *tree,
  struct extent_buffer *eb);
 int set_extent_buffer_dirty(struct extent_io_tree *tree,



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 15/99] btrfs: try_lock_extent can drop gfp_t argumetn

2011-11-23 Thread Jeff Mahoney
 All of the callers of try_lock_extent call it with gfp_t == GFP_NOFS.

 This patch simplifies the call sites by calling clear_extent_bit with
 GFP_NOFS from try_lock_extent itself.

 Since the extent io code will probably never be used outside of a file
 system, this is generally ok. If there are new callers, they can add
 their own version or re-genericize it.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c  |   22 ++
 fs/btrfs/extent_io.h  |4 ++--
 fs/btrfs/relocation.c |3 +--
 3 files changed, 9 insertions(+), 20 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1238,28 +1238,18 @@ int lock_extent(struct extent_io_tree *t
return lock_extent_bits(tree, start, end, 0, NULL, mask);
 }
 
-int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end,
-   gfp_t mask)
+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, mask);
+failed_start, NULL, GFP_NOFS);
if (err == -EEXIST) {
-   if (failed_start  start) {
-   if (mask  __GFP_WAIT)
-   clear_extent_bit(tree, start, failed_start - 1,
-EXTENT_LOCKED, 1, 0, NULL,
-mask);
-   else {
-   err = clear_extent_bit_atomic(tree, start,
-   failed_start - 1,
-   EXTENT_LOCKED, 1, 0,
-   NULL, mask);
-   BUG_ON(err  0);
-   }
-   }
+   if (failed_start  start)
+   clear_extent_bit(tree, start, failed_start - 1,
+EXTENT_LOCKED, 1, 0, NULL,
+GFP_NOFS);
return 0;
}
return 1;
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -191,8 +191,8 @@ int __must_check unlock_extent_cached_at
 struct extent_state **cached);
 void unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end,
  struct extent_state **cached);
-int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end,
-   gfp_t mask);
+int __must_check try_lock_extent(struct extent_io_tree *tree, u64 start,
+u64 end);
 int extent_read_full_page(struct extent_io_tree *tree, struct page *page,
  get_extent_t *get_extent, int mirror_num);
 int __init extent_io_init(void);
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1596,8 +1596,7 @@ int replace_file_extents(struct btrfs_tr
WARN_ON(!IS_ALIGNED(end, root-sectorsize));
end--;
ret = try_lock_extent(BTRFS_I(inode)-io_tree,
- key.offset, end,
- GFP_NOFS);
+ key.offset, end);
if (!ret)
continue;
 


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 48/99] btrfs: fill_device_from_item should return void

2011-11-23 Thread Jeff Mahoney
 fill_device_from_item has no error conditions and should return void.
 Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/volumes.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3513,7 +3513,7 @@ static int read_one_chunk(struct btrfs_r
return 0;
 }
 
-static int fill_device_from_item(struct extent_buffer *leaf,
+static void fill_device_from_item(struct extent_buffer *leaf,
 struct btrfs_dev_item *dev_item,
 struct btrfs_device *device)
 {
@@ -3530,8 +3530,6 @@ static int fill_device_from_item(struct
 
ptr = (unsigned long)btrfs_device_uuid(dev_item);
read_extent_buffer(leaf, device-uuid, ptr, BTRFS_UUID_SIZE);
-
-   return 0;
 }
 
 static int open_seed_devices(struct btrfs_root *root, u8 *fsid)



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 42/99] btrfs: check_page_writeback should return void

2011-11-23 Thread Jeff Mahoney
 check_page_writeback has no error conditions and should return void.
 Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1829,11 +1829,10 @@ static void check_page_locked(struct ext
  * helper function to end page writeback if all the extents
  * in the tree for that page are done with writeback
  */
-static int check_page_writeback(struct extent_io_tree *tree,
-struct page *page)
+static void check_page_writeback(struct extent_io_tree *tree,
+struct page *page)
 {
end_page_writeback(page);
-   return 0;
 }
 
 /*



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 46/99] btrfs: btrfs_close_extra_devices should return void

2011-11-23 Thread Jeff Mahoney
 btrfs_close_extra_devices has no error conditions and should return
 void. Its callers already ignore the error code anyway.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/volumes.c |3 +--
 fs/btrfs/volumes.h |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -437,7 +437,7 @@ error:
return ERR_PTR(-ENOMEM);
 }
 
-int btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices)
+void btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices)
 {
struct btrfs_device *device, *next;
 
@@ -470,7 +470,6 @@ again:
}
 
mutex_unlock(uuid_mutex);
-   return 0;
 }
 
 static void __free_device(struct work_struct *work)
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -197,7 +197,7 @@ int btrfs_open_devices(struct btrfs_fs_d
 int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
  struct btrfs_fs_devices **fs_devices_ret);
 int btrfs_close_devices(struct btrfs_fs_devices *fs_devices);
-int btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices);
+void btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices);
 int btrfs_add_device(struct btrfs_trans_handle *trans,
 struct btrfs_root *root,
 struct btrfs_device *device);



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 02/99] btrfs: Catch locking failures in {set,clear,convert}_extent_bit

2011-11-23 Thread Jeff Mahoney
 The *_state functions can only return 0 or -EEXIST. This patch addresses
 the cases where those functions returning -EEXIST represent a locking
 failure. It handles them by panicking with an appropriate error message.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |   58 +--
 1 file changed, 38 insertions(+), 20 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -51,6 +51,12 @@ struct extent_page_data {
unsigned int sync_io:1;
 };
 
+static inline struct btrfs_fs_info *
+tree_fs_info(struct extent_io_tree *tree)
+{
+   return btrfs_sb(tree-mapping-host-i_sb)-fs_info;
+}
+
 int __init extent_io_init(void)
 {
extent_state_cache = kmem_cache_create(extent_state,
@@ -437,6 +443,13 @@ alloc_extent_state_atomic(struct extent_
return prealloc;
 }
 
+NORET_TYPE void extent_io_tree_panic(struct extent_io_tree *tree, int err)
+{
+   btrfs_panic(tree_fs_info(tree), err, Locking error: 
+   Extent tree was modified by another 
+   thread while locked.);
+}
+
 /*
  * clear some bits on a range in the tree.  This may require splitting
  * or inserting elements in the tree, so the gfp mask is used to
@@ -531,7 +544,9 @@ hit_next:
prealloc = alloc_extent_state_atomic(prealloc);
BUG_ON(!prealloc);
err = split_state(tree, state, prealloc, start);
-   BUG_ON(err == -EEXIST);
+   if (err)
+   extent_io_tree_panic(tree, err);
+
prealloc = NULL;
if (err)
goto out;
@@ -553,7 +568,9 @@ hit_next:
prealloc = alloc_extent_state_atomic(prealloc);
BUG_ON(!prealloc);
err = split_state(tree, state, prealloc, end + 1);
-   BUG_ON(err == -EEXIST);
+   if (err)
+   extent_io_tree_panic(tree, err);
+
if (wake)
wake_up(state-wq);
 
@@ -736,8 +753,10 @@ again:
prealloc = alloc_extent_state_atomic(prealloc);
BUG_ON(!prealloc);
err = insert_state(tree, prealloc, start, end, bits);
+   if (err)
+   extent_io_tree_panic(tree, err);
+
prealloc = NULL;
-   BUG_ON(err == -EEXIST);
goto out;
}
state = rb_entry(node, struct extent_state, rb_node);
@@ -803,7 +822,9 @@ hit_next:
prealloc = alloc_extent_state_atomic(prealloc);
BUG_ON(!prealloc);
err = split_state(tree, state, prealloc, start);
-   BUG_ON(err == -EEXIST);
+   if (err)
+   extent_io_tree_panic(tree, err);
+
prealloc = NULL;
if (err)
goto out;
@@ -840,12 +861,9 @@ hit_next:
 */
err = insert_state(tree, prealloc, start, this_end,
   bits);
-   BUG_ON(err == -EEXIST);
-   if (err) {
-   free_extent_state(prealloc);
-   prealloc = NULL;
-   goto out;
-   }
+   if (err)
+   extent_io_tree_panic(tree, err);
+
cache_state(prealloc, cached_state);
prealloc = NULL;
start = this_end + 1;
@@ -867,7 +885,8 @@ hit_next:
prealloc = alloc_extent_state_atomic(prealloc);
BUG_ON(!prealloc);
err = split_state(tree, state, prealloc, end + 1);
-   BUG_ON(err == -EEXIST);
+   if (err)
+   extent_io_tree_panic(tree, err);
 
set_state_bits(tree, prealloc, bits);
cache_state(prealloc, cached_state);
#@@ -938,7 +957,8 @@ again:
#   return -ENOMEM;
#   err = insert_state(tree, prealloc, start, end, bits);
#   prealloc = NULL;
#-  BUG_ON(err == -EEXIST);
#+  if (err)
#+  extent_io_tree_panic(tree, err);
#   goto out;
#   }
#   state = rb_entry(node, struct extent_state, rb_node);
#@@ -994,7 +1014,8 @@ hit_next:
#   if (!prealloc)
#   return -ENOMEM;
#   err = split_state(tree, state, prealloc, start);
#-  BUG_ON(err == -EEXIST);
#+  if (err)
#+  extent_io_tree_panic(tree, err);
#   prealloc = NULL;
#   if (err)
#   goto out;
#@@ -1032,12 +1053,8 @@ hit_next:
#*/
#   err = insert_state(tree, prealloc, start, this_end,
#  bits);
#-  BUG_ON(err == -EEXIST);
#-  if (err) {
#-  free_extent_state(prealloc);
#- 

[patch 35/99] btrfs: btrfs_update_root error push-up

2011-11-23 Thread Jeff Mahoney
 btrfs_update_root BUG's when it can't alloc a path, yet it can recover
 from a search error. This patch returns -ENOMEM instead.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.h |7 ---
 fs/btrfs/root-tree.c |4 +++-
 2 files changed, 7 insertions(+), 4 deletions(-)

--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2400,9 +2400,10 @@ int btrfs_del_root(struct btrfs_trans_ha
 int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root
  *root, struct btrfs_key *key, struct btrfs_root_item
  *item);
-int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
- *root, struct btrfs_key *key, struct btrfs_root_item
- *item);
+int __must_check btrfs_update_root(struct btrfs_trans_handle *trans,
+  struct btrfs_root *root,
+  struct btrfs_key *key,
+  struct btrfs_root_item *item);
 int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct
 btrfs_root_item *item, struct btrfs_key *key);
 int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid);
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -93,7 +93,9 @@ int btrfs_update_root(struct btrfs_trans
unsigned long ptr;
 
path = btrfs_alloc_path();
-   BUG_ON(!path);
+   if (!path)
+   return -ENOMEM;
+
ret = btrfs_search_slot(trans, root, key, path, 0, 1);
if (ret  0)
goto out;



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 31/99] btrfs: btrfs_pin_extent error push-up

2011-11-23 Thread Jeff Mahoney
 btrfs_pin_extent looks up a block group and then calls pin_down_extent
 with it. If the lookup fails, it should return -ENOENT to allow callers
 to handle the error condition. For the three existing callers, it is
 a logic error if the lookup fails and a panic will occur.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.h   |   11 ++-
 fs/btrfs/extent-tree.c |   23 +--
 fs/btrfs/tree-log.c|8 ++--
 3 files changed, 29 insertions(+), 13 deletions(-)

--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2155,11 +2155,12 @@ int btrfs_lookup_extent(struct btrfs_roo
 int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
 struct btrfs_root *root, u64 bytenr,
 u64 num_bytes, u64 *refs, u64 *flags);
-int btrfs_pin_extent(struct btrfs_root *root,
-u64 bytenr, u64 num, int reserved);
-int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans,
-   struct btrfs_root *root,
-   u64 bytenr, u64 num_bytes);
+int __must_check btrfs_pin_extent(struct btrfs_root *root, u64 bytenr,
+ u64 num, int reserved);
+int __must_check btrfs_pin_extent_for_log_replay(
+   struct btrfs_trans_handle *trans,
+   struct btrfs_root *root,
+   u64 bytenr, u64 num_bytes);
 int btrfs_cross_ref_exist(struct btrfs_trans_handle *trans,
  struct btrfs_root *root,
  u64 objectid, u64 offset, u64 bytenr);
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2101,8 +2101,14 @@ static int run_one_delayed_ref(struct bt
BUG_ON(extent_op);
head = btrfs_delayed_node_to_head(node);
if (insert_reserved) {
-   btrfs_pin_extent(root, node-bytenr,
-node-num_bytes, 1);
+   ret = btrfs_pin_extent(root, node-bytenr,
+  node-num_bytes, 1);
+   if (ret)
+   btrfs_panic(root-fs_info, ret,
+   Cannot pin extent in range 
+   %llu(%llu)\n,
+   node-bytenr, node-num_bytes);
+
if (head-is_data) {
ret = btrfs_del_csums(trans, root,
  node-bytenr,
@@ -4347,7 +4353,8 @@ int btrfs_pin_extent(struct btrfs_root *
struct btrfs_block_group_cache *cache;
 
cache = btrfs_lookup_block_group(root-fs_info, bytenr);
-   BUG_ON(!cache);
+   if (cache == NULL)
+   return -ENOENT;
 
pin_down_extent(root, cache, bytenr, num_bytes, reserved);
 
@@ -4365,7 +4372,8 @@ int btrfs_pin_extent_for_log_replay(stru
struct btrfs_block_group_cache *cache;
 
cache = btrfs_lookup_block_group(root-fs_info, bytenr);
-   BUG_ON(!cache);
+   if (cache == NULL)
+   return -ENOENT;
 
/*
 * pull in the free space cache (if any) so that our pin
@@ -4871,8 +4879,11 @@ int btrfs_free_extent(struct btrfs_trans
if (root_objectid == BTRFS_TREE_LOG_OBJECTID) {
WARN_ON(owner = BTRFS_FIRST_FREE_OBJECTID);
/* unlocks the pinned mutex */
-   btrfs_pin_extent(root, bytenr, num_bytes, 1);
-   ret = 0;
+   ret = btrfs_pin_extent(root, bytenr, num_bytes, 1);
+   if (ret)
+   btrfs_panic(root-fs_info, ret, Cannot pin 
+   extent in range %llu(%llu)\n,
+   bytenr, num_bytes);
} else if (owner  BTRFS_FIRST_FREE_OBJECTID) {
ret = btrfs_add_delayed_tree_ref(trans, bytenr, num_bytes,
parent, root_objectid, (int)owner,
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -275,10 +275,14 @@ static int process_one_buffer(struct btr
  struct extent_buffer *eb,
  struct walk_control *wc, u64 gen)
 {
-   if (wc-pin)
-   btrfs_pin_extent_for_log_replay(wc-trans,
+   if (wc-pin) {
+   int ret = btrfs_pin_extent_for_log_replay(wc-trans,
log-fs_info-extent_root,
eb-start, eb-len);
+   if (ret)
+   btrfs_panic(log-fs_info, ret, Cannot pin extent in 
+   range %llu(%llu)\n, eb-start, eb-len);
+   }
 
if (btrfs_buffer_uptodate(eb, gen)) {
if (wc-write)



--
To unsubscribe from this list: send the 

[patch 32/99] btrfs: btrfs_drop_snapshot should return int

2011-11-23 Thread Jeff Mahoney
Commit cb1b69f4 (Btrfs: forced readonly when btrfs_drop_snapshot() fails)
made btrfs_drop_snapshot return void because there were no callers checking
the return value. That is the wrong order to handle error propogation since
the caller will have no idea that an error has occured and continue on
as if nothing went wrong.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/ctree.h   |5 +++--
 fs/btrfs/extent-tree.c |6 +++---
 fs/btrfs/relocation.c  |3 ++-
 fs/btrfs/transaction.c |7 +--
 4 files changed, 13 insertions(+), 8 deletions(-)

--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2367,8 +2367,9 @@ static inline int btrfs_insert_empty_ite
 int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path);
 int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path);
 int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf);
-void btrfs_drop_snapshot(struct btrfs_root *root,
-struct btrfs_block_rsv *block_rsv, int update_ref);
+int __must_check btrfs_drop_snapshot(struct btrfs_root *root,
+struct btrfs_block_rsv *block_rsv,
+int update_ref);
 int btrfs_drop_subtree(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct extent_buffer *node,
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6347,8 +6347,8 @@ static noinline int walk_up_tree(struct
  * also make sure backrefs for the shared block and all lower level
  * blocks are properly updated.
  */
-void btrfs_drop_snapshot(struct btrfs_root *root,
-struct btrfs_block_rsv *block_rsv, int update_ref)
+int btrfs_drop_snapshot(struct btrfs_root *root,
+   struct btrfs_block_rsv *block_rsv, int update_ref)
 {
struct btrfs_path *path;
struct btrfs_trans_handle *trans;
@@ -6513,7 +6513,7 @@ out_free:
 out:
if (err)
btrfs_std_error(root-fs_info, err);
-   return;
+   return err;
 }
 
 /*
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2269,7 +2269,8 @@ again:
} else {
list_del_init(reloc_root-root_list);
}
-   btrfs_drop_snapshot(reloc_root, rc-block_rsv, 0);
+   ret = btrfs_drop_snapshot(reloc_root, rc-block_rsv, 0);
+   BUG_ON(ret  0);
}
 
if (found) {
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1375,6 +1375,8 @@ int btrfs_clean_old_snapshots(struct btr
spin_unlock(fs_info-trans_lock);
 
while (!list_empty(list)) {
+   int ret;
+
root = list_entry(list.next, struct btrfs_root, root_list);
list_del(root-root_list);
 
@@ -1382,9 +1384,10 @@ int btrfs_clean_old_snapshots(struct btr
 
if (btrfs_header_backref_rev(root-node) 
BTRFS_MIXED_BACKREF_REV)
-   btrfs_drop_snapshot(root, NULL, 0);
+   ret = btrfs_drop_snapshot(root, NULL, 0);
else
-   btrfs_drop_snapshot(root, NULL, 1);
+   ret = btrfs_drop_snapshot(root, NULL, 1);
+   BUG_ON(ret  0);
}
return 0;
 }



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 33/99] btrfs: btrfs_start_transaction non-looped error push-up

2011-11-23 Thread Jeff Mahoney
 This patch handles btrfs_start_transaction failures that don't occur
 in a loop and are obvious to simply push up. In all cases except the
 mark_garbage_root case, the error is already handled by BUG_ON in the
 caller.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent-tree.c |6 +-
 fs/btrfs/relocation.c  |6 --
 fs/btrfs/tree-log.c|5 -
 fs/btrfs/volumes.c |3 ++-
 4 files changed, 15 insertions(+), 5 deletions(-)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6374,7 +6374,11 @@ int btrfs_drop_snapshot(struct btrfs_roo
}
 
trans = btrfs_start_transaction(tree_root, 0);
-   BUG_ON(IS_ERR(trans));
+   if (IS_ERR(trans)) {
+   kfree(wc);
+   btrfs_free_path(path);
+   return PTR_ERR(trans);
+   }
 
if (block_rsv)
trans-block_rsv = block_rsv;
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4118,7 +4118,8 @@ static noinline_for_stack int mark_garba
int ret;
 
trans = btrfs_start_transaction(root-fs_info-tree_root, 0);
-   BUG_ON(IS_ERR(trans));
+   if (IS_ERR(trans))
+   return PTR_ERR(trans);
 
memset(root-root_item.drop_progress, 0,
sizeof(root-root_item.drop_progress));
@@ -4198,7 +4199,8 @@ int btrfs_recover_relocation(struct btrf
err = ret;
goto out;
}
-   mark_garbage_root(reloc_root);
+   ret = mark_garbage_root(reloc_root);
+   BUG_ON(ret);
}
}
 
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3171,7 +3171,10 @@ int btrfs_recover_log_trees(struct btrfs
fs_info-log_root_recovering = 1;
 
trans = btrfs_start_transaction(fs_info-tree_root, 0);
-   BUG_ON(IS_ERR(trans));
+   if (IS_ERR(trans)) {
+   btrfs_free_path(path);
+   return PTR_ERR(trans);
+   }
 
wc.trans = trans;
wc.pin = 1;
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1932,7 +1932,8 @@ static int btrfs_relocate_chunk(struct b
return ret;
 
trans = btrfs_start_transaction(root, 0);
-   BUG_ON(IS_ERR(trans));
+   if (IS_ERR(trans))
+   return PTR_ERR(trans);
 
lock_chunks(root);
 



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 36/99] btrfs: set_range_writeback should return void

2011-11-23 Thread Jeff Mahoney
 set_range_writeback has no error conditions and should return void.
 Its callers already ignore the error code anyway.

 There are internal error conditions but they are fatal and will cause
 a panic.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1253,7 +1253,7 @@ int unlock_extent(struct extent_io_tree
 /*
  * helper function to set both pages and extents in the tree writeback
  */
-static int set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end)
+static void set_range_writeback(struct extent_io_tree *tree, u64 start, u64 
end)
 {
unsigned long index = start  PAGE_CACHE_SHIFT;
unsigned long end_index = end  PAGE_CACHE_SHIFT;
@@ -1261,12 +1261,14 @@ static int set_range_writeback(struct ex
 
while (index = end_index) {
page = find_get_page(tree-mapping, index);
-   BUG_ON(!page);
+   if (!page)
+   btrfs_panic(tree_fs_info(tree), -ENOENT,
+   Page not found in extent io tree at 
+   offset %llu, index  PAGE_CACHE_SHIFT);
set_page_writeback(page);
page_cache_release(page);
index++;
}
-   return 0;
 }
 
 /* find the first state struct with 'bits' set after 'start', and



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 28/99] btrfs: clear_extent_bit error push-up

2011-11-23 Thread Jeff Mahoney
 clear_extent_bit can fail with -ENOMEM for a specific case but will BUG
 on other memory allocation failures.

 This patch returns -ENOMEM for memory allocation failures and handles them
 with BUG_ON in callers which don't handle it already.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

Index: source/fs/btrfs/extent_io.c
===
--- source.orig/fs/btrfs/extent_io.c2011-11-21 14:40:44.0 -0500
+++ source/fs/btrfs/extent_io.c 2011-11-21 14:40:45.0 -0500
@@ -503,7 +503,7 @@ static int __clear_extent_bit(struct ext
struct rb_node *next_node;
struct rb_node *node;
u64 last_end;
-   int err;
+   int err = 0;
int clear = 0;
 
if (delete)
@@ -568,7 +568,10 @@ hit_next:
if (state-start  start) {
assert_atomic_alloc(prealloc, mask);
prealloc = alloc_extent_state_atomic(prealloc);
-   BUG_ON(!prealloc);
+   if (!prealloc) {
+   err = -ENOMEM;
+   goto out;
+   }
err = split_state(tree, state, prealloc, start);
if (err)
extent_io_tree_panic(tree, err);
@@ -593,7 +596,10 @@ hit_next:
if (state-start = end  state-end  end) {
assert_atomic_alloc(prealloc, mask);
prealloc = alloc_extent_state_atomic(prealloc);
-   BUG_ON(!prealloc);
+   if (!prealloc) {
+   err = -ENOMEM;
+   goto out;
+   }
err = split_state(tree, state, prealloc, end + 1);
if (err)
extent_io_tree_panic(tree, err);
@@ -629,7 +635,7 @@ out:
if (prealloc)
free_extent_state(prealloc);
 
-   return 0;
+   return err;
 
 search_again:
if (start  end)


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 30/99] btrfs: pin_down_extent should return void

2011-11-23 Thread Jeff Mahoney
 pin_down_extent performs some operations which can't fail and then calls
 set_extent_dirty, which has two failure cases via set_extent_bit:
 1) Return -EEXIST if exclusive bits are set
- Since it doesn't use any exclusive bits, this failure case can't
   occur.
 2) Return -ENOMEM if memory can't be allocated
- Since it's called with gfp_flags  __GFP_NOFAIL, this failure case
  can't occur.

 With no failure cases, it should return void.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent-tree.c |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4290,9 +4290,9 @@ static u64 first_logical_byte(struct btr
return bytenr;
 }
 
-static int pin_down_extent(struct btrfs_root *root,
-  struct btrfs_block_group_cache *cache,
-  u64 bytenr, u64 num_bytes, int reserved)
+static void pin_down_extent(struct btrfs_root *root,
+   struct btrfs_block_group_cache *cache,
+   u64 bytenr, u64 num_bytes, int reserved)
 {
spin_lock(cache-space_info-lock);
spin_lock(cache-lock);
@@ -4311,7 +4311,6 @@ static int pin_down_extent(struct btrfs_

set_extent_dirty(root-fs_info-pinned_extents, bytenr,
 bytenr + num_bytes - 1);
-   return 0;
 }
 
 /*



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 29/99] btrfs: convert_extent_bit should return void with __GFP_WAIT set

2011-11-23 Thread Jeff Mahoney
 Now that allocations that are allowed to sleep can't fail,
 convert_extent_bit has no more error conditions and we can assume the
 return value will be 0 and return void to callers.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |   18 ++
 fs/btrfs/extent_io.h |4 ++--
 2 files changed, 16 insertions(+), 6 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1011,8 +1011,8 @@ int set_extent_bit_excl(struct extent_io
  * converting from say DELALLOC to DIRTY.  This is not meant to be used with
  * boundary bits like LOCK.
  */
-int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
-  int bits, int clear_bits, gfp_t mask)
+static int __convert_extent_bit(struct extent_io_tree *tree, u64 start,
+u64 end, int bits, int clear_bits, gfp_t mask)
 {
struct extent_state *state;
struct extent_state *prealloc = NULL;
@@ -1020,9 +1020,10 @@ int convert_extent_bit(struct extent_io_
int err = 0;
u64 last_start;
u64 last_end;
+   int wait = mask  __GFP_WAIT;
 
 again:
-   if (!prealloc  (mask  __GFP_WAIT))
+   if (!prealloc  !wait)
prealloc = alloc_extent_state_nofail(mask);
 
spin_lock(tree-lock);
@@ -1176,11 +1177,20 @@ search_again:
if (start  end)
goto out;
spin_unlock(tree-lock);
-   if (mask  __GFP_WAIT)
+   if (wait)
cond_resched();
goto again;
 }
 
+void convert_extent_bit(struct extent_io_tree *tree, u64 start,
+   u64 end, int bits, int clear_bits, gfp_t mask)
+{
+   int ret;
+   WARN_ON(!(mask  __GFP_WAIT));
+   ret = __convert_extent_bit(tree, start, end, bits, clear_bits, mask);
+   BUG_ON(ret  0);
+}
+
 /* wrappers around set/clear extent bit */
 void set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end)
 {
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -233,8 +233,8 @@ void set_extent_uptodate(struct extent_i
 void set_extent_new(struct extent_io_tree *tree, u64 start, u64 end);
 void set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end);
 void clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end);
-int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
-  int bits, int clear_bits, gfp_t mask);
+void convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
+   int bits, int clear_bits, gfp_t mask);
 void set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end,
 struct extent_state **cached_state);
 int find_first_extent_bit(struct extent_io_tree *tree, u64 start,



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 25/99] btrfs: set_extent_bit can drop gfp_t argument

2011-11-23 Thread Jeff Mahoney
 Now that all of the callers of set_extent_bit use GFP_NOFS and
 all callers of set_extent_bit_atomic use GFP_ATOMIC, we can
 drop the gfp_t argument to both.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |   35 +++
 fs/btrfs/extent_io.h |9 +++--
 fs/btrfs/inode.c |2 +-
 3 files changed, 19 insertions(+), 27 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -960,30 +960,28 @@ search_again:
 
 int set_extent_bit_atomic(struct extent_io_tree *tree, u64 start, u64 end,
  int bits, u64 *failed_start,
- struct extent_state **cached_state, gfp_t mask)
+ struct extent_state **cached_state)
 {
-   WARN_ON(mask  __GFP_WAIT);
return __set_extent_bit(tree, start, end, bits, 0, failed_start,
-   cached_state, mask);
+   cached_state, GFP_ATOMIC);
 }
 
 void 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)
+   u64 *failed_start, struct extent_state **cached_state)
 {
int ret;
-   WARN_ON(!(mask  __GFP_WAIT));
+   might_sleep();
ret = __set_extent_bit(tree, start, end, bits, 0,
-  failed_start, cached_state, mask);
+  failed_start, cached_state, GFP_NOFS);
BUG_ON(ret  0);
 }
 
 int set_extent_bit_excl(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 **cached_state)
 {
return __set_extent_bit(tree, start, end, bits, exclusive_bits,
-   failed_start, cached_state, mask);
+   failed_start, cached_state, GFP_NOFS);
 }
 
 /**
@@ -1174,12 +1172,12 @@ search_again:
 /* wrappers around set/clear extent bit */
 void set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end)
 {
-   set_extent_bit(tree, start, end, EXTENT_DIRTY, NULL, NULL, GFP_NOFS);
+   set_extent_bit(tree, start, end, EXTENT_DIRTY, NULL, NULL);
 }
 
 void set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int bits)
 {
-   set_extent_bit(tree, start, end, bits, NULL, NULL, GFP_NOFS);
+   set_extent_bit(tree, start, end, bits, NULL, NULL);
 }
 
 void clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
@@ -1199,7 +1197,7 @@ void set_extent_delalloc(struct extent_i
 struct extent_state **cached_state)
 {
set_extent_bit(tree, start, end, EXTENT_DELALLOC | EXTENT_UPTODATE,
-  NULL, cached_state, GFP_NOFS);
+  NULL, cached_state);
 }
 
 void clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end)
@@ -1210,21 +1208,20 @@ void clear_extent_dirty(struct extent_io
 
 void set_extent_new(struct extent_io_tree *tree, u64 start, u64 end)
 {
-   set_extent_bit(tree, start, end, EXTENT_NEW, NULL, NULL, GFP_NOFS);
+   set_extent_bit(tree, start, end, EXTENT_NEW, NULL, NULL);
 }
 
 int set_extent_uptodate_atomic(struct extent_io_tree *tree, u64 start, u64 end,
   struct extent_state **cached_state)
 {
return set_extent_bit_atomic(tree, start, end, EXTENT_UPTODATE, NULL,
-cached_state, GFP_ATOMIC);
+cached_state);
 }
 
 void set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
 struct extent_state **cached_state)
 {
-   set_extent_bit(tree, start, end, EXTENT_UPTODATE, NULL, cached_state,
-  GFP_NOFS);
+   set_extent_bit(tree, start, end, EXTENT_UPTODATE, NULL, cached_state);
 }
 
 static void clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
@@ -1246,8 +1243,7 @@ int lock_extent_bits(struct extent_io_tr
while (1) {
err = set_extent_bit_excl(tree, start, end,
  EXTENT_LOCKED | bits, EXTENT_LOCKED,
- failed_start, cached_state,
- GFP_NOFS);
+ failed_start, cached_state);
if (err == -EEXIST) {
wait_extent_bit(tree, failed_start, end, EXTENT_LOCKED);
start = failed_start;
@@ -1270,8 +1266,7 @@ int try_lock_extent(struct extent_io_tre
u64 failed_start;
 
err = set_extent_bit_excl(tree, start, end, EXTENT_LOCKED,
- EXTENT_LOCKED, failed_start, NULL,
- GFP_NOFS);
+ EXTENT_LOCKED, failed_start, 

[patch 21/99] btrfs: set_extent_bits can drop gfp_t argument

2011-11-23 Thread Jeff Mahoney
 Now that all of the callers of set_extent_bits use GFP_NOFS, we can
 drop the gfp_t argument entirely and allow set_extent_bits to always
 pass GFP_NOFS.

 Since the extent io code will probably never be used outside of a file
 system, this is generally ok. If there are new callers, they can add
 their own version or re-genericize it.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent-tree.c |4 ++--
 fs/btrfs/extent_io.c   |9 -
 fs/btrfs/extent_io.h   |2 +-
 fs/btrfs/file-item.c   |2 +-
 fs/btrfs/relocation.c  |4 ++--
 fs/btrfs/scrub.c   |2 +-
 6 files changed, 11 insertions(+), 12 deletions(-)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -211,9 +211,9 @@ static int add_excluded_extent(struct bt
 {
u64 end = start + num_bytes - 1;
set_extent_bits(root-fs_info-freed_extents[0],
-   start, end, EXTENT_UPTODATE, GFP_NOFS);
+   start, end, EXTENT_UPTODATE);
set_extent_bits(root-fs_info-freed_extents[1],
-   start, end, EXTENT_UPTODATE, GFP_NOFS);
+   start, end, EXTENT_UPTODATE);
return 0;
 }
 
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1172,10 +1172,9 @@ void set_extent_dirty(struct extent_io_t
set_extent_bit(tree, start, end, EXTENT_DIRTY, NULL, NULL, GFP_NOFS);
 }
 
-void set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
-int bits, gfp_t mask)
+void set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int bits)
 {
-   set_extent_bit(tree, start, end, bits, NULL, NULL, mask);
+   set_extent_bit(tree, start, end, bits, NULL, NULL, GFP_NOFS);
 }
 
 void clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
@@ -2125,7 +2124,7 @@ static int bio_readpage_error(struct bio
 
/* set the bits in the private failure tree */
set_extent_bits(failure_tree, start, end,
-   EXTENT_LOCKED | EXTENT_DIRTY, GFP_NOFS);
+   EXTENT_LOCKED | EXTENT_DIRTY);
ret = set_state_private(failure_tree, start,
(u64)(unsigned long)failrec);
if (ret  0) {
@@ -2133,7 +2132,7 @@ static int bio_readpage_error(struct bio
return ret;
}
/* set the bits in the inode's tree */
-   set_extent_bits(tree, start, end, EXTENT_DAMAGED, GFP_NOFS);
+   set_extent_bits(tree, start, end, EXTENT_DAMAGED);
} else {
failrec = (struct io_failure_record *)(unsigned long)private;
pr_debug(bio_readpage_error: (found) logical=%llu, 
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -216,7 +216,7 @@ void clear_extent_bit(struct extent_io_t
  int bits, int wake, int delete,
  struct extent_state **cached);
 void set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
-int bits, gfp_t mask);
+int bits);
 int __must_check set_extent_bit_excl(struct extent_io_tree *tree, u64 start,
 u64 end, int bits, int exclusive_bits,
 u64 *failed_start,
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -214,7 +214,7 @@ static int __btrfs_lookup_bio_sums(struc
BTRFS_DATA_RELOC_TREE_OBJECTID) {
set_extent_bits(io_tree, offset,
offset + bvec-bv_len - 1,
-   EXTENT_NODATASUM, GFP_NOFS);
+   EXTENT_NODATASUM);
} else {
printk(KERN_INFO btrfs no csum found 
   for inode %llu start %llu\n,
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2645,7 +2645,7 @@ static void mark_block_processed(struct
 u64 bytenr, u32 blocksize)
 {
set_extent_bits(rc-processed_blocks, bytenr, bytenr + blocksize - 1,
-   EXTENT_DIRTY, GFP_NOFS);
+   EXTENT_DIRTY);
 }
 
 static void __mark_block_processed(struct reloc_control *rc,
@@ -3015,7 +3015,7 @@ static int relocate_file_extent_cluster(
page_start + offset == cluster-boundary[nr]) {
set_extent_bits(BTRFS_I(inode)-io_tree,
page_start, page_end,
-   EXTENT_BOUNDARY, GFP_NOFS);
+   EXTENT_BOUNDARY);
nr++;
}
 
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -425,7 +425,7 @@ static int scrub_fixup_readpage(u64 inum
 * sure we read the 

[patch 24/99] btrfs: set_extent_uptodate can drop gfp_t argument

2011-11-23 Thread Jeff Mahoney
 Now that all of the callers of set_extent_uptodate use GFP_NOFS or
 GFP_ATOMIC, we can drop the gfp_t argument entirely and allow
 set_extent_uptodate to always pass GFP_NOFS to set_extent_bit or
 GFP_ATOMIC to set_extent_bit_atomic.

 Since the extent io code will probably never be used outside of a file
 system, this is generally ok. If there are uptodate callers, they can add
 their own version or re-genericize it.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |   16 
 fs/btrfs/extent_io.h |5 ++---
 fs/btrfs/inode.c |2 +-
 3 files changed, 11 insertions(+), 12 deletions(-)

--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1214,17 +1214,17 @@ void set_extent_new(struct extent_io_tre
 }
 
 int set_extent_uptodate_atomic(struct extent_io_tree *tree, u64 start, u64 end,
-  struct extent_state **cached_state, gfp_t mask)
+  struct extent_state **cached_state)
 {
return set_extent_bit_atomic(tree, start, end, EXTENT_UPTODATE, NULL,
-cached_state, mask);
+cached_state, GFP_ATOMIC);
 }
 
 void set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
-struct extent_state **cached_state, gfp_t mask)
+struct extent_state **cached_state)
 {
set_extent_bit(tree, start, end, EXTENT_UPTODATE, NULL, cached_state,
-  mask);
+  GFP_NOFS);
 }
 
 static void clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
@@ -2391,7 +2391,7 @@ static void end_bio_extent_readpage(stru
 
if (uptodate) {
ret = set_extent_uptodate_atomic(tree, start, end,
-cached, GFP_ATOMIC);
+cached);
BUG_ON(ret  0);
}
ret = unlock_extent_cached_atomic(tree, start, end, cached);
@@ -2617,7 +2617,7 @@ static int __extent_read_full_page(struc
flush_dcache_page(page);
kunmap_atomic(userpage, KM_USER0);
set_extent_uptodate(tree, cur, cur + iosize - 1,
-   cached, GFP_NOFS);
+   cached);
unlock_extent_cached(tree, cur, cur + iosize - 1,
 cached);
break;
@@ -2667,7 +2667,7 @@ static int __extent_read_full_page(struc
kunmap_atomic(userpage, KM_USER0);
 
set_extent_uptodate(tree, cur, cur + iosize - 1,
-   cached, GFP_NOFS);
+   cached);
unlock_extent_cached(tree, cur, cur + iosize - 1,
 cached);
cur = cur + iosize;
@@ -3937,7 +3937,7 @@ int set_extent_buffer_uptodate(struct ex
 
if (eb_straddles_pages(eb))
set_extent_uptodate(tree, eb-start, eb-start + eb-len - 1,
-   NULL, GFP_NOFS);
+   NULL);
for (i = 0; i  num_pages; i++) {
page = extent_buffer_page(eb, i);
if ((i == 0  (eb-start  (PAGE_CACHE_SIZE - 1))) ||
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -231,10 +231,9 @@ void set_extent_bit(struct extent_io_tre
gfp_t mask);
 int __must_check set_extent_uptodate_atomic(struct extent_io_tree *tree,
u64 start, u64 end,
-   struct extent_state **cached_state,
-   gfp_t mask);
+   struct extent_state **cached_state);
 void set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
-struct extent_state **cached_state, gfp_t mask);
+struct extent_state **cached_state);
 void set_extent_new(struct extent_io_tree *tree, u64 start, u64 end);
 void set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end);
 void clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end);
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5021,7 +5021,7 @@ again:
btrfs_mark_buffer_dirty(leaf);
}
set_extent_uptodate(io_tree, em-start,
-   extent_map_end(em) - 1, NULL, GFP_NOFS);
+   extent_map_end(em) - 1, NULL);
goto insert;
} else {
printk(KERN_ERR btrfs unknown found_type %d\n, found_type);


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in

[patch 27/99] btrfs: set_extent_bit should return -ENOMEM on GFP_ATOMIC failures

2011-11-23 Thread Jeff Mahoney
 The only failure condition is for GFP_ATOMIC allocations. Push up to
 callers which are already handling it.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent_io.c |   26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

Index: linux-3.0-SLE11-SP2/fs/btrfs/extent_io.c
===
--- linux-3.0-SLE11-SP2.orig/fs/btrfs/extent_io.c   2011-11-21 
14:09:59.0 -0500
+++ linux-3.0-SLE11-SP2/fs/btrfs/extent_io.c2011-11-21 14:11:54.0 
-0500
@@ -765,6 +765,9 @@ static void uncache_state(struct extent_
  * part of the range already has the desired bits set.  The start of the
  * existing range is returned in failed_start in this case.
  *
+ * It may also fail with -ENOMEM if memory cannot be obtained for extent_state
+ * structures when called with mask == GFP_ATOMIC.
+ *
  * [start, end] is inclusive This takes the tree lock.
  */
 
@@ -803,7 +806,11 @@ again:
if (!node) {
assert_atomic_alloc(prealloc, mask);
prealloc = alloc_extent_state_atomic(prealloc);
-   BUG_ON(!prealloc);
+   if (!prealloc) {
+   err = -ENOMEM;
+   goto out;
+   }
+
err = insert_state(tree, prealloc, start, end, bits);
if (err)
extent_io_tree_panic(tree, err);
@@ -873,7 +880,11 @@ hit_next:
 
assert_atomic_alloc(prealloc, mask);
prealloc = alloc_extent_state_atomic(prealloc);
-   BUG_ON(!prealloc);
+   if (!prealloc) {
+   err = -ENOMEM;
+   goto out;
+   }
+
err = split_state(tree, state, prealloc, start);
if (err)
extent_io_tree_panic(tree, err);
@@ -907,7 +918,10 @@ hit_next:
 
assert_atomic_alloc(prealloc, mask);
prealloc = alloc_extent_state_atomic(prealloc);
-   BUG_ON(!prealloc);
+   if (!prealloc) {
+   err = -ENOMEM;
+   goto out;
+   }
 
/*
 * Avoid to free 'prealloc' if it can be merged with
@@ -938,7 +952,11 @@ hit_next:
 
assert_atomic_alloc(prealloc, mask);
prealloc = alloc_extent_state_atomic(prealloc);
-   BUG_ON(!prealloc);
+   if (!prealloc) {
+   err = -ENOMEM;
+   goto out;
+   }
+
err = split_state(tree, state, prealloc, end + 1);
if (err)
extent_io_tree_panic(tree, err);


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 23/99] btrfs: set_extent_new can drop gfp_t argument

2011-11-23 Thread Jeff Mahoney
 Now that all of the callers of set_extent_new use GFP_NOFS, we can
 drop the gfp_t argument entirely and allow set_extent_new to always
 pass GFP_NOFS.

 Since the extent io code will probably never be used outside of a file
 system, this is generally ok. If there are new callers, they can add
 their own version or re-genericize it.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/extent-tree.c |2 +-
 fs/btrfs/extent_io.c   |5 ++---
 fs/btrfs/extent_io.h   |3 +--
 3 files changed, 4 insertions(+), 6 deletions(-)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5868,7 +5868,7 @@ struct extent_buffer *btrfs_init_new_buf
buf-start + buf-len - 1);
else
set_extent_new(root-dirty_log_pages, buf-start,
-   buf-start + buf-len - 1, GFP_NOFS);
+   buf-start + buf-len - 1);
} else {
set_extent_dirty(trans-transaction-dirty_pages, buf-start,
 buf-start + buf-len - 1);
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1203,10 +1203,9 @@ void clear_extent_dirty(struct extent_io
 EXTENT_DO_ACCOUNTING, 0, 0, NULL);
 }
 
-void set_extent_new(struct extent_io_tree *tree, u64 start, u64 end,
-   gfp_t mask)
+void set_extent_new(struct extent_io_tree *tree, u64 start, u64 end)
 {
-   set_extent_bit(tree, start, end, EXTENT_NEW, NULL, NULL, mask);
+   set_extent_bit(tree, start, end, EXTENT_NEW, NULL, NULL, GFP_NOFS);
 }
 
 int set_extent_uptodate_atomic(struct extent_io_tree *tree, u64 start, u64 end,
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -235,8 +235,7 @@ int __must_check set_extent_uptodate_ato
gfp_t mask);
 void set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
 struct extent_state **cached_state, gfp_t mask);
-void set_extent_new(struct extent_io_tree *tree, u64 start, u64 end,
-   gfp_t mask);
+void set_extent_new(struct extent_io_tree *tree, u64 start, u64 end);
 void set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end);
 void clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end);
 int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 19/99] btrfs: lock_extent can drop gfp_t argument

2011-11-23 Thread Jeff Mahoney
 All of the callers of lock_extent call it with gfp_t == GFP_NOFS.

 This patch simplifies the call sites by calling clear_extent_bit with
 GFP_NOFS from lock_extent itself.

 Since the extent io code will probably never be used outside of a file
 system, this is generally ok. If there are new callers, they can add
 their own version or re-genericize it.

Signed-off-by: Jeff Mahoney je...@suse.com
---
 fs/btrfs/compression.c  |2 +-
 fs/btrfs/disk-io.c  |2 +-
 fs/btrfs/extent_io.c|   19 ++-
 fs/btrfs/extent_io.h|4 ++--
 fs/btrfs/file.c |7 +++
 fs/btrfs/free-space-cache.c |2 +-
 fs/btrfs/inode.c|   27 +++
 fs/btrfs/ioctl.c|7 +++
 fs/btrfs/relocation.c   |8 
 9 files changed, 36 insertions(+), 42 deletions(-)

--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -497,7 +497,7 @@ static noinline int add_ra_bio_pages(str
 * sure they map to this compressed extent on disk.
 */
set_page_extent_mapped(page);
-   lock_extent(tree, last_offset, end, GFP_NOFS);
+   lock_extent(tree, last_offset, end);
read_lock(em_tree-lock);
em = lookup_extent_mapping(em_tree, last_offset,
   PAGE_CACHE_SIZE);
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -331,7 +331,7 @@ static int verify_parent_transid(struct
return 0;
 
lock_extent_bits(io_tree, eb-start, eb-start + eb-len - 1,
-0, cached_state, GFP_NOFS);
+0, cached_state);
if (extent_buffer_uptodate(io_tree, eb, cached_state) 
btrfs_header_generation(eb) == parent_transid) {
ret = 0;
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1239,15 +1239,16 @@ static void clear_extent_uptodate(struct
  * us if waiting is desired.
  */
 int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
-int bits, struct extent_state **cached_state, gfp_t mask)
+int bits, struct extent_state **cached_state)
 {
int err;
u64 failed_start;
while (1) {
err = set_extent_bit_excl(tree, start, end,
  EXTENT_LOCKED | bits, EXTENT_LOCKED,
- failed_start, cached_state, mask);
-   if (err == -EEXIST  (mask  __GFP_WAIT)) {
+ failed_start, cached_state,
+ GFP_NOFS);
+   if (err == -EEXIST) {
wait_extent_bit(tree, failed_start, end, EXTENT_LOCKED);
start = failed_start;
} else {
@@ -1258,9 +1259,9 @@ int lock_extent_bits(struct extent_io_tr
return err;
 }
 
-int lock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask)
+int lock_extent(struct extent_io_tree *tree, u64 start, u64 end)
 {
-   return lock_extent_bits(tree, start, end, 0, NULL, mask);
+   return lock_extent_bits(tree, start, end, 0, NULL);
 }
 
 int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end)
@@ -1593,7 +1594,7 @@ again:
 
/* step three, lock the state bits for the whole range */
lock_extent_bits(tree, delalloc_start, delalloc_end,
-0, cached_state, GFP_NOFS);
+0, cached_state);
 
/* then test to make sure it is all still delalloc */
ret = test_range_bit(tree, delalloc_start, delalloc_end,
@@ -2584,7 +2585,7 @@ static int __extent_read_full_page(struc
 
end = page_end;
while (1) {
-   lock_extent(tree, start, end, GFP_NOFS);
+   lock_extent(tree, start, end);
ordered = btrfs_lookup_ordered_extent(inode, start);
if (!ordered)
break;
@@ -3287,7 +3288,7 @@ int extent_invalidatepage(struct extent_
if (start  end)
return 0;
 
-   lock_extent_bits(tree, start, end, 0, cached_state, GFP_NOFS);
+   lock_extent_bits(tree, start, end, 0, cached_state);
wait_on_page_writeback(page);
clear_extent_bit(tree, start, end,
 EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC |
@@ -3503,7 +3504,7 @@ int extent_fiemap(struct inode *inode, s
}
 
lock_extent_bits(BTRFS_I(inode)-io_tree, start, start + len, 0,
-cached_state, GFP_NOFS);
+cached_state);
 
em = get_extent_skip_holes(inode, start, last_for_get_extent,
   get_extent);
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -180,9 +180,9 @@ int try_release_extent_buffer(struct ext
 int try_release_extent_state(struct extent_map_tree *map,
 

  1   2   >