* exposing checksums to user-space programs
@ 2011-06-27 16:47 buff
0 siblings, 0 replies; only message in thread
From: buff @ 2011-06-27 16:47 UTC (permalink / raw)
To: linux-btrfs; +Cc: buff
Hi Folks (please cc: any replies to me),
I have modified GNU Make to use checksums rather than
timestamps. I would like the operating system and/or
filesystem to compute and provide the checksums, because it
can safely cache them.
Since btrfs checksums its files, I am trying to transfer its
checksums to user space. I believe I saw a thread where
Chris Mason said he didn't want to expose checksums, but
then I found a patch that sounds like it does what I want:
http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg01182.html
In the thread, Chris said he would take the patch, but it
evidently never made it to distribution. I applied the
patch to kernel 2.6.30.8, which is old but available on one
of my expendable laptops. I created a btrfs filesystem on a
USB thumb drive and copied a file to it. Then, I cobbled
together this example user-space program:
http://cs.boisestate.edu/~buff/files/trycsum.c
which produces this output:
spruce$ sudo mount /mnt/sdb1
spruce$ trycsum /mnt/sdb1/yum.list
File /mnt/sdb1/yum.list has 1 extents:
# Logical Physical Length Flags
0: 0000000000000000 0000000000c00000 000000000015b000 0001
sizeof(args)=420
size=0
csum[0]=0000007b
spruce$
The "size=0" tells me the file's one extent has no
checksum. However:
spruce$ sudo btrfs-debug-tree /dev/sdb1 | grep -i csum
item 0 key (18446744073709551606 EXTENT_CSUM 12582912) itemoff 2607 itemsize 1388
extent csum item
spruce$
suggests it has a checksum.
I traced the function defined in the patch, with printk()
calls. It seemed be accepting and processing its arguments
correctly.
I'm not a kernel-hacking expert, but I was hoping someone
could tell me what I'm doing wrong or give me some
direction. Thanks!
-- Jim
PS: I think I also noticed that a small file has no
checksum, and a big file has no checksum until after a
umount/mount. Is this true?
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-27 16:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-27 16:47 exposing checksums to user-space programs buff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).