Skip to contentSkip to conversation

btrfs-transaction blocked for more than 120 seconds

DISCUSSION Duncan 2 participants 3 messages Jan 5, 2014 – Jan 8, 2014 1 message not in the archive Btrfs file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): ADin1n00P0VAdqd01DioM9

Duncan

author
#1 lore raw
Quoted 8 lines · On Sun, 05 Jan 2014 08:42:46 -0500 Jim Salter <[email protected]> wrote:
Quoted 3 lines · Marc MERLIN

On Fri, Jan 03, 2014 at 09:34:10PM +0000, Duncan wrote:
Yes, I got that. That why I ran btrfs defrag on the files after that

Why are you trying to defrag an SSD? There's no seek penalty for moving between fragmented blocks, so defrag isn't really desirable in the first place.

[I normally try to reply directly to list but don't believe I've seen this there yet, but got it direct-mailed so will reply-all in response.]

There's no seek penalty so the overall problem is dramatically lessened as that's the significant part of it on spinning rust, correct, but...

SSDs do remain IOPS-bound, and tens or hundreds of thousands of extents do exact an IOPS (as well as general extent bookkeeping) toll, too.

That's why I ended up enabling autodefrag here when I was first setting up, even tho I'm on SSD. (Only after asking the list basically the same question, what good it is autodefrag on SSD, tho.)

Luckily I don't happen to deal with any of the internal-write-in-huge-files scenarios, however, and I enabled autodefrag to cover the internal-write-in-small-file scenarios BEFORE I started putting any data on the filesystems at all, so I'm basically covered, here, without actually having to do chattr +C on anything.

Quoted 4 lines

That doesn't change the fact that the described lockup sounds like a bug not a feature of course, but I think the answer to your personal issue on that particular machine is "don't defrag a solid state drive".

I now believe the lockup must be due to processing the hundreds of thousands of extents on all those snapshots, too, in addition to doing it on the main volume. I don't actually make very extensive use of snapshots here anyway, so I didn't think about that aspect originally, but that's gotta be what's throwing the real spanner in the works, turning a possibly long but workable normal defrag (O(1)) into a lockup scenario (O(n)) where virtually no progress is made as currently coded.

Signature · 3 lines
Duncan - No HTML messages please, as they are filtered as spam.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman
#2 lore raw
Quoted 6 lines · Duncan

IIRC someone also mentioned problems with autodefrag and an about 3/4 gig systemd journal. My gut feeling (IOW, *NOT* benchmarked!) is that double- digit MiB files should /normally/ be fine, but somewhere in the lower triple digits, write-magnification could well become an issue, depending of course on exactly how much active writing the app is doing into the file.

When I defrag'ed my 83GB vm file with 156222 extents, it was not in use or being written to.

Quoted 4 lines

As I said there's more work going into tuning autodefrag ATM, but as it is, I couldn't really recommend making it a global default... tho maybe a distro could enable it by default on a no-VM desktop system (as opposed to a server). Certainly I'd recommend most desktop types enable it.

I use VMs on my desktop :) but point taken.

Quoted 6 lines · Chris Murphy
Quoted 4 lines

gandalfthegreat:/var/local/nobck/VirtualBox VMs/Win7# filefrag Win7.vdi Win7.vdi: 156222 extents found

Considering how virtualbox works, that's hardly surprising.

I haven't read anything so far indicating defrag applies to the VM container use case, rather nodatacow via xattr +C is the way to go. At least for now.

Yep, I'll convert the file, but since I found a pretty severe performance problem, does anyone care to get details off my system before I make the problem go away for me?

Quoted 1 line

It's better than a panic or corrupt data. So far the best combination

To be honest, I'd have taken a panic, it would have saved me 2H of waiting for a laptop to recover when it was never going to recover :( Data corruption, sure, obviously :)

Quoted 1 line

I've found, open to other suggestions though, is +C xattr on

So you're saying that defragmentation has known performance problems that can't get fixed for now, and that the solution is not to get fragmented or recreate the relevant files.
If so, I'll go ahead, I just wanted to make sure I didn't have useful debug state before clearing my problem.

Quoted 1 line

This may already be a known problem but it's worth sysrq+w, and then dmesg and posting those results if you haven't already.

No, I had not yet, but I'll do this.

Quoted 2 lines · Duncan

[I normally try to reply directly to list but don't believe I've seen this there yet, but got it direct-mailed so will reply-all in response.]

I like direct Cc on replies, makes my filter and mutt coloring happier :)
Dupes with the same message-id are what procmail and others were written for :)

Quoted 2 lines

I now believe the lockup must be due to processing the hundreds of thousands of extents on all those snapshots, too, in addition to doing

That's a good call. I do have this:

gandalfthegreat:/mnt/btrfs_pool1# ls var
var/                          var_hourly_20140105_16:00:01/
var_daily_20140102_00:01:01/  var_hourly_20140105_17:00:26/
var_daily_20140103_00:59:28/  var_weekly_20131208_00:02:02/
var_daily_20140104_00:01:01/  var_weekly_20131215_00:02:01/
var_daily_20140105_00:33:14/  var_weekly_20131229_00:02:02/
var_hourly_20140105_05:00:01/ var_weekly_20140105_00:33:14/
Quoted 6 lines

it on the main volume. I don't actually make very extensive use of snapshots here anyway, so I didn't think about that aspect originally, but that's gotta be what's throwing the real spanner in the works, turning a possibly long but workable normal defrag (O(1)) into a lockup scenario (O(n)) where virtually no progress is made as currently coded.

That is indeed what I'm seeing, so it's very possible you're right.

Marc

Signature · 4 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901
author
#3 lore raw

Marc MERLIN posted on Tue, 07 Jan 2014 19:22:58 -0800 as excerpted:

Quoted 10 lines · Duncan
Quoted 6 lines

IIRC someone also mentioned problems with autodefrag and an about 3/4 gig systemd journal. My gut feeling (IOW, *NOT* benchmarked!) is that double-digit MiB files should /normally/ be fine, but somewhere in the lower triple digits, write-magnification could well become an issue, depending of course on exactly how much active writing the app is doing into the file.

When I defrag'ed my 83GB vm file with 156222 extents, it was not in use or being written to.

Note the scale... I said double-digit _MiB_ should be fine, but somewhere in the triple-digits write magnification likely becomes a problem (this based on my memory of someone mentioning an issue with a 3/4 gig systemd journal file).

You then say 83 _GB_, which may or may not be GiB, but either way, it's three orders of magnitude above the scale I said should be fine, and two orders of magnitude above the scale at which I said problems likely start appearing.

So problems at that size are a given.

Quoted 9 lines · Chris Murphy
Quoted 2 lines

I've found, open to other suggestions though, is +C xattr on

So you're saying that defragmentation has known performance problems that can't get fixed for now, and that the solution is not to get fragmented or recreate the relevant files.
If so, I'll go ahead, I just wanted to make sure I didn't have useful debug state before clearing my problem.

Basically, yes. One of the devs said he's just starting to focus on it again now. So it's a known issue that'll take some work to make better. However, since he's focusing on it again now, now's the time to report stuff like the sysrq+w trace mentioned.

Quoted 9 lines · Duncan
Quoted 3 lines

[I normally try to reply directly to list but don't believe I've seen this there yet, but got it direct-mailed so will reply-all in response.]

I like direct Cc on replies, makes my filter and mutt coloring happier :)
Dupes with the same message-id are what procmail and others were written for :)

Some of us think this sort of list works best as a public newsgroup... such distributed discussion is what they were designed for, after all... and that keeps it separate from actual email. That's where gmane.org comes in with its list2news (as well as list2web) archiving service. We subscribe to our lists as newsgroups there, use a news/nntp client for it, and save our email client for actually handling (more private) email.

If you watch, you'll see links to particular messages on the gmane web interface posted from time to time. For those using gmane's list2news service (and obviously for those using its web interface as well) that's real easy, since gmane adds a header with the web link to messages it serves on the news interface as well. I've been using gmane for perhaps a decade now, but apparently it's more popular for people on this list than I might have expected from other lists, since I see more of those gmane web links posted.

But I've also noticed that a lot more people on this list want CCed/ direct-mailed too, not just to read it on the list. I generally do that when I see the explicit request, but /only/ when I see the explicit request.

Quoted 12 lines
Quoted 2 lines

I now believe the lockup must be due to processing the hundreds of thousands of extents on all those snapshots, too

That's a good call. I do have this:

gandalfthegreat:/mnt/btrfs_pool1# ls var var/                         
var_hourly_20140105_16:00:01/ var_daily_20140102_00:01:01/ 
var_hourly_20140105_17:00:26/ var_daily_20140103_00:59:28/ 
var_weekly_20131208_00:02:02/ var_daily_20140104_00:01:01/ 
var_weekly_20131215_00:02:01/ var_daily_20140105_00:33:14/ 
var_weekly_20131229_00:02:02/ var_hourly_20140105_05:00:01/
var_weekly_20140105_00:33:14/
Quoted 7 lines
Quoted 5 lines

I don't actually make very extensive use of
snapshots here anyway, so I didn't think about that aspect originally, but that's gotta be what's throwing the real spanner in the works, turning a possibly long but workable normal defrag (O(1)) into a lockup scenario (O(n)) where virtually no progress is made as currently coded.

That is indeed what I'm seeing, so it's very possible you're right.

That's where the evidence is pointing, ATM. Hopefully the defrag work they're doing now will turn snapshotted defrag back into O(1), too.

Signature · 3 lines
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman