[Top] [All Lists]

Fragmentation and hole punching

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Fragmentation and hole punching
From: "Bradley C. Kuszmaul" <kuszmaul@xxxxxxxxx>
Date: Sat, 5 Jan 2013 19:52:46 -0500
Cc: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=S9PDfQQSp1yjGjxNKabDHQizJtdy1Ct1Cnh4pt15dlU=; b=pILDIgPxhU1xWjoK5UG+7KBabFHDCW5lB42uQ/WMggFeDolTpzXWQH6RAAgFtY51tW 9CzbbB0ALJxdBEZspM5OrxpxDoZjhYTbVF9wVq/J9tBzUX0siZVOHWENsEW2Qb4DX9rl AKkKr3Lj4OramGT43ZutEXsNTAvcrwdgW8eon+TR3r/0RJ9dYmLAUm3ulbCXFIfl5tRY UE0YKDgfG/vhF3/h8ibUcOOadxhH6+PVNmZXTKliPEywz0BjL5xzi/26Gbjx8JUDdveB xKNj4VA1DGJwm1YGfXks0YsI37kAIPetfqYZIYY92WQ8tNbAej1UKIiTCYOTuzary7Wu FpHg==
I'm using hole punching now in my code.  Should I have any concerns about fragmentation?

Here's how I use it:
 I perform pwrite() operations of various sizes.  These are "blocks" in my application.  These blocks are always 4KB-aligned, but they are of many different sizes.  Most writes are near a megabyte in size, but hardly ever exactly a megabyte.
 I also punch holes.  The holes always correspond exactly to a previously written pwrite().
 A pwrite() always writes into a hole.  (It never overwrites current data).

For example I might write
 1MB at offset 1MB
then write 3MB at offset 2MB
then punch a hole of size 1MB at offset 1MB
then do some more activity elsewhere in the file
then write 512K at an offset of 1MB (partially filling the hole that I had punched)

I have a lot of experience running this code on xfs without the hole punching.  The pattern of the pwrite()'s are the same with or without hole punching.  So I'd hope that the hole punching didn't make things any worse, and maybe made things better.

Can I expect that this will work reasonably well?  

By the way, all of your help has been outstanding.

<Prev in Thread] Current Thread [Next in Thread>