question about zfs written property

Jason Keltz jas at cse.yorku.ca
Mon Dec 9 18:58:48 UTC 2013


On 12/09/2013 01:24 PM, Matthew Ahrens wrote:
> Jason, I'm cc'ing the freebsd mailing list as well.  In general that 
> is a better forum for questions about how to use ZFS.
>
Thanks..
>
> On Mon, Dec 9, 2013 at 9:04 AM, Jason Keltz <jas at cse.yorku.ca 
> <mailto:jas at cse.yorku.ca>> wrote:
>
>     Hi..
>
>     I saw your names on the feature addition in illumos for the
>     "written" property for ZFS:
>
>     https://www.illumos.org/issues/1645
>
>     I had a question and was hoping you might have a moment to answer.
>
>     I'm rsyncing data from a Linux-based system to a ZFS backup and
>     archive server.  It's running FreeBSD, but it's the same ZFS code
>     base as illumos.  I'm seeing (what I think are) some weird numbers
>     looking at ZFS written property ...
>
>     For example:
>
>     Sat Dec  7 01:05:00 EST 2013 sync start
>     rsync://backup@forest-mrpriv/home9 /local/backup/home9
>     (189G/264G/1.41x)
>     Sat Dec  7 01:33:20 EST 2013 sync finish
>     rsync://backup@forest-mrpriv/home9 /local/backup/home9
>     (190G/265G/1.41x)
>     Sat Dec  7 01:33:20 EST 2013 sync elapsed 00h:28m:20s
>     rsync://backup@forest-mrpriv/home9 /local/backup/home9, 514M
>     unarchived
>     Sat Dec  7 06:32:58 EST 2013 archive create home9 daily 20131207
>     as pool1/backup/home9 at 20131207, 518M
>
>     In the third line, where you see "514M unarchived", I write out
>     the property of "written" after the rsync completes.  However,
>     when the archive (just a snapshot) runs (hours later), there's 4
>     MB more data!? Nothing touches the data after the rsync completes.
>       Both lines are probing the same property on the same dataset.
>      How can they get a different result?
>
>
> If you are getting the "written" property just after the rsync 
> completes, it's possible that there is still some data "in flight" 
> inside ZFS.  If you run "sync", that should flush out all the dirty 
> data and update the space accounting.  Unfortunately this is only 
> documented in the description of the "used" property, we should add 
> similar qualifiers to "available", "referenced", "written", 
> "logicalreferenced", etc.:
>
>          The amount of space used, available, or referenced  does
>
>          not  take  into account pending changes. Pending changes
>
>          are generally accounted for within a few  seconds.  Com-
>
>          mitting  a  change  to  a disk using fsync(3c) or O_SYNC
>
>          does not necessarily  guarantee that  the  space  usage
>
>          information is updated immediately.
>
>
Yes. I repeated the test. It takes an additional 3 seconds after my 6 MB 
rsync completes for "written" to produce the correct result. The result 
is repeatable.  It doesn't appear that running "sync" actually reduces 
the delay. A sleep() works though :)  (I know I could sure use one!)

Jason.



More information about the freebsd-fs mailing list