Linux Filesystems LOC

The XFS filesystem has taken a beating for being a big, complicated, foreign filesystem since it’s introduction, and there is no doubt that there is a fair bit of code in there.  But an interesting thing happened on the way to the Linux Kernel v3.0.0 – XFS developers have steadily reduced lines of code, while other up and coming filesystems such as Ext4 and BTRFS are steadily growing in LOC and complexity.  And XFS has been under constant improvement at the same time as well.

Some of this is to be expected when comparing a mature product to newer developments, but I still find it interesting.

Notes on the above graph :

  • Comments & whitespace were stripped with CLOC for LOC counts
  • EXT4 LOC includes jbd2 as well.

XFS is actually more heavily commented than EXT4 or BTRFS; XFS is about 39% comments, while EXT4 is about 33% and BTRFS is about 17%.

Another interesting metric is to use Simian to see how much duplicated code there might be:

  • xfs: Found 4806 duplicate lines in 561 blocks in 55 files
  • ext4+jbd2: Found 917 duplicate lines in 116 blocks in 23 files
  • btrfs: Found 2252 duplicate lines in 272 blocks in 31 files

Those high-level numbers aren’t terribly useful, but digging into them sometimes reveals a surprising amount of cut+paste in the course of development.

Other duplicate finders such as duplo and CPD are useful, too – these latter have free licenses.  They all behave a little bit differently…

(edit: Many of the xfs dups are actually a result of the many explicit #include directives in each C file).

JetWay JNC9C-550-LF and PicoPSU-90 problems


I got a Jetway JNC9C-550-LF mini-ITX mobile Atom board from Newegg to run, and the plan was to run it off a Pico-PSU 90W [amzn] power supply for maximum efficiency.  But I could not get the darned thing to boot on that power supply.  It worked ok on a 250W ATX ps, though.  I had originally gotten an 80W picoPSU, and that failed to boot, so I RMA’d it.  The folks at mini-box were very nice and helpful, but the 90W behaved exactly the same way.  I was stumped.  As a long shot, I asked Jetway tech support about it, and was rather astounded to get this reply:

Continue reading

New look

I didn’t intentionally change the layout… EPEL sprung a WordPress 3.1 upgrade on me, and it seems the old theme is gone (in addition  to needing a database upgrade before anything would even display, bleah!)  So you’ll have to stare at the lonely guy walking down the country road until I find something I like better. now thinks it’s a laptop


One of the legs of the main mirror of this box was starting to throw SMART errrors, and that makes me nervous, even when I can remap the sectors.  So when life gives you lemons, make lemonade!  I replaced the main root mirror with a couple new drives – 7200RPM seagate 250G laptop drives, on sale from newegg, the pair $90 with free shipping.

And now, the Kill A Watt [amzn] says the box uses only 41W, down from 51W.  That’ll save 7 kWh/month, 88kWh/year.  Not bad!  (though far from paying for themselves).  The 2 old drives are still there, waiting to be spun up when somebody wants to listen to the music on them.

What’s up with the Intel Atom?

Update: I’ve since built a box with a mobile atom CPU which fares much better, as described in this post.

So I was all fired up to lower the power consumption of, the humble server upon which you read this blog.  (And thank you for that, by the way.  You can count yourselves among the 3 finest people on the internet.)

I decided to swap out the old AMD Athlon for an Intel Atom – you know, that low-power, lower-performance wonder-chip from Intel.  I ordered a Gigabyte GA-D510UD from, for $90… it looked interesting because it had 4 SATA ports built-in, which should suffice for any amount of storage that I’d likely have connected directly to it. draws about 51W, which is really not too bad considering there are 2 active drives in it (a mirror) and one sleeping drive that gets backups occasionally.  It’s a AMD Athlon(tm) 64 Processor 3400+ in an old Compaq SR1710NX that I got cheap 5 years ago or so, and updated the cpu, memory, drives, etc…  These new low-power Atoms must be really great then, right?

So it gets here Friday, and I’m all excited… I take down the server, plug it in, and well, first off RHEL5 was not happy with it, bringing the drives up as /dev/hda, /dev/hdb… (remember those?), and and after a bit of fiddling to get the config right I decide to just put things back as they were, and play with the board offline.  Before doing so, I check the Kill A Watt [amzn] … hm, still 51W.  Odd.  Hopefully a newer distro will do some magic power stuff and make it all better.  It’s an atom right?  Low power and all?

So I put the RHEL6 beta on it, and get it all fired up, and re-check … hm, nope, still 36W or so with a single drive, subtract out that 8W, the board is pulling around 27W.  This is not the low power I’d hoped for!  So I start digging – oh look, the chip doesn’t support any P-states, and only 2 C-states:

Cn                Avg residency   P-states (frequencies)
C0 (cpu running)        ( 0.3%)     1.67 Ghz   100.0%
polling           0.0ms ( 0.0%)
C1              137.5ms (99.7%)

And sure enough, checking the Intel docs, only the chips designed for mobile use have the nice power features.

In short, the shiny new low-power Atom sure appears to use just as much power as my 5-year-old run of the mill AMD Athlon64 (in a low P-state, granted).  Sure, at full-tilt maybe it’s using less, but it runs at full-tilt all the time and my Athlon is able to throttle back almost all the time.

I’ll eat the restocking & shipping and send this thing back to newegg, bitterly disappointed.

I have higher hopes for swapping out the hard drives (one leg of the mirror is dying) to WD Caviar Green drives – I can save about 8kWh/month with those if the specs are accurate.  :)

Trim/discard at mkfs time

A little-hyped development in all the hype about “trim” for ssds:

  • Recent versions of mkfs.ext2, mkfs.ext3, mkfs.ext4, and mkfs.xfs all now trim all blocks in the target device before laying down the format, so regardless of whether you have a runtime trim solution, at least you get to start fresh!

Open-source power monitoring

I’ve been interested in doing power monitoring on the house for a while, the TED 5000 unit seems neat and the Brultech ECM1240 monitor also seems pretty good.  Both are around $200, but both have drawbacks.  The TED only monitors mains, and while the Brultech can monitor around 5 branch circuits, it lacks the simplicity of a built-in webserver like the TED.  Most of the software developed by the company, at least, is Windows- oriented.  But I’ve found some neat other projects that might be fun. Continue reading

Grrr nonfree software

Really wanted to try out Hulu Desktop on my Mythbox, so I can get the Daily Show on the big screen in a convenient/legit fashion.

Knew 64-bit flash was still dicey on linux (Helloooo Adobe?  1998 called, they want their software back!) so did:

# yum localinstall huludesktop-i386.rpm

and it pulled in some 32-bit libs, I installed flash, and it should be groovy right?  No.  I run it and it says sorry you don’t have flash.  I strace the thing and see it finding flash just fine but also see:

open("/lib/tls/i686/sse2/", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/i686/sse2", 0xfff02f3c) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/i686", 0xfff02f3c)     = -1 ENOENT (No such file or directory)
open("/lib/tls/sse2/", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/sse2", 0xfff02f3c)     = -1 ENOENT (No such file or directory)
open("/lib/tls/", O_RDONLY)   = -1 ENOENT (No such file or directory)

Hmmmm ok so we’ll just …

# yum install libXt.i586

Yay it works.  Booo Hulu for getting it wrong in a way less savvy users would never sort out.  I’ll just enter a bug in their Bugzil…. oh never mind.

Grrrr nonfree software.


Getting network stats off an Actiontec GT724R

My ISP got bought, moved, etc and suddenly my trusty old Cisco 678 DSL modem no longer sufficed.  Grr.  But oh well, Actiontec DSL modems aren’t that expensive, so I got a GT624R and things were groovy again.  But the Cisco supported SNMP so that I could gather network stats for mrtg; the Actiontec does not.  So I had to write my own script to get interface stats and output it in mrtg format, for anyone interested it’s below the jump.
Continue reading