Btrfs v0.13
Hello everyone,
Btrfs v0.13 is now available for download from:
http://oss.oracle.com/projects/btrfs/
We took another short break from the multi-device code to make the minor mods required to compile on 2.6.25, fix some problematic bugs and do more tuning.
The most important fix is for file data checksumming errors. These might show up on .o files from compiles or other files where seeky writes were done
internally to fill it up. The end result was a bunch of zeros in the file
where people expected their data to be. Thanks to Yan Zheng for tracking it down.
GregKH provided most of the 2.6.25 port with some sysfs updates. Since the sysfs files are not used much and Greg has offered additional cleanups, I've disabled the btrfs sysfs interface on kernels older than 2.6.25. This way he won't have to back port any of his changes.
Optimizations and other fixes:
* File data checksumming done in larger chunks, resulting in fewer btree searches and fewer kmap calls.
* CPU Optimizations for back reference removal
* CPU Optimizations for block allocation, and much more efficient searching through the free space cache.
* Allocation optimizations, the free space clustering code was not properly allocating from a cluster once it found it. For normal mounts the fix improves metadata writeback, for mount -o ssd it improves everything.
* Unaligned access fixes from Dave Miller
* Btree reads are done in larger bios when possible
* i_block accounting is fixed
-chris
Quoted 9 lines · Chris Mason
Hello everyone,
Btrfs v0.13 is now available for download from:
http://oss.oracle.com/projects/btrfs/
We took another short break from the multi-device code to make the minor mods required to compile on 2.6.25, fix some problematic bugs and do more tuning.
Sorry, I should have added:
v0.13 has no disk format changes since v0.12.
-chris
* Chris Mason <[email protected]>:
Quoted 3 lines
Hello everyone,
Btrfs v0.13 is now available for download from:
Hi Chris,
Following are two patches that allow btrfs-progs to build on ia64, and prevent a SEGV when trying to do a mkfs.btrfs.
I've gotten as far as successfully creating a btrfs filesystem (at least that's what btrfsck tells me), but haven't been able to mount it yet, probably because of the sector size issue.
/ac
* Alex Chiang <[email protected]>:
Quoted 4 lines
I've gotten as far as successfully creating a btrfs filesystem (at least that's what btrfsck tells me), but haven't been able to mount it yet, probably because of the sector size issue.
Oh, and for those curious, here's the output of btrfsck:
[root@canola btrfs-progs-unstable]# btrfsck /dev/cciss/c2d1 found device 1 on /dev/cciss/c2d1
lowest devid now 1
found Btrfs on /dev/cciss/c2d1 with 1 devices opening /dev/cciss/c2d1 devid 1 fd 4
found 102400 bytes used err is 0
total csum bytes: 0
total tree bytes: 81920
btree space waste bytes: 79462
file data blocks allocated: 0
referenced 0
[yes, that's working over the cciss block device ;)]
/ac
From: Alex Chiang <[email protected]>
Date: Mon, 31 Mar 2008 14:26:33 -0600
Quoted 3 lines
I've gotten as far as successfully creating a btrfs filesystem (at least that's what btrfsck tells me), but haven't been able to mount it yet, probably because of the sector size issue.
You should be able to make a filesystem with a sector size >= PAGE_SIZE and it should work just fine. Please give it a try.
* David Miller <[email protected]>:
Quoted 10 lines
From: Alex Chiang <[email protected]>
Date: Mon, 31 Mar 2008 14:26:33 -0600Quoted 3 lines
I've gotten as far as successfully creating a btrfs filesystem (at least that's what btrfsck tells me), but haven't been able to mount it yet, probably because of the sector size issue.
You should be able to make a filesystem with a sector size >=
PAGE_SIZEand it should work just fine. Please give it a try.
Hrm, I'm having issues still. First, here's a patch for mkfs.btrfs to allow the user to pass in a different sector size. Bug report follows...
/ac
Quoted 1 line
From
f955af8deb68a00d92326a283491ea088f996a53Mon Sep 17 00:00:00 2001
From: Alex Chiang <[email protected]>
Date: Mon, 31 Mar 2008 16:41:21 -0600
Subject: [PATCH] Teach mkfs.btrfs about configurable sectorsizes
Currently, btrfs assumes PAGE_SIZE <= sectorsize, and sectorsize is hardcoded to 4K in mkfs.btrfs.
Give mkfs.btrfs a new command line option to specify a different sector size. The syntax follows mke2fs's -E extended-options syntax, and the code is taken from mke2fs.
--- mkfs.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 74 insertions(+), 2 deletions(-)
mkfs.c +74 -2
@@ -137,15 +137,76 @@ err:return ret; } +struct btrfs_params { +u32 sectorsize; +}; + +/* +* Shameless ripped from mke2fs +*/ +static void parse_extended_opts (struct btrfs_params *param,const char *opts) +{ +char *buf, *token, *next, *p, *arg; +int len; +int r_usage =0 ; + + len =strlen (opts); + buf =malloc (len+1 ); +if (!buf) { +fprintf (stderr,"Couldn't allocate memory to parse options!\n" ); +exit (1 ); + } +strcpy (buf, opts); +for (token = buf; token && *token; token = next) { + p =strchr (token,',' ); + next =0 ; +if (p) { + *p =0 ; + next = p+1 ; + } + arg =strchr (token,'=' ); +if (arg) { + *arg =0 ; + arg++; + } +if (strcmp (token,"sectorsize" ) ==0 ) { +if (!arg) { + r_usage++; +continue ; + } + param->sectorsize =strtoul (arg, &p,0 ); +if (*p || (param->sectorsize ==0 )) { +fprintf (stderr, +"Invalid sectorsize parameter: %s\n" , + arg); + r_usage++; +continue ; + } + }else { + r_usage++; + } + } +if (r_usage) { +fprintf (stderr,"\nBad options specified.\n\n" +"Extended options are separated by commas, " +"and may take an argument which\n" +"\tis set off by an equals ('=') sign.\n\n" +"Valid extended options are:\n" +"\tsectorsize=<sector size in bytes>\n\n" ); +exit (1 ); + } +} +static void print_usage (void ) { -fprintf (stderr,"usage: mkfs.btrfs [ -l leafsize ] [ -n nodesize] dev [ blocks ]\n" ); +fprintf (stderr,"usage: mkfs.btrfs [ -l leafsize ] [ -n nodesize] [ -E sectorsize=<sectorsize> ] dev [ blocks ]\n" );exit (1 ); }int main (int ac,char **av) {char *file; +char *extended_opts =0 ;u64 block_count =0 ;u64 dev_block_count =0 ;int fd;
@@ -160,10 +221,11 @@ int main(int ac, char **av)int zero_end =1 ;struct btrfs_root *root;struct btrfs_trans_handle *trans; +struct btrfs_params fs_params;while (1 ) {int c; - c =getopt (ac, av,"b:l:n:s:" ); + c =getopt (ac, av,"b:l:n:s:E:" );if (c <0 )break ;switch (c) {
@@ -180,10 +242,19 @@ int main(int ac, char **av) block_count =parse_size (optarg); zero_end =0 ;break ; +case 'E' : +memset (&fs_params,0 , +sizeof (struct btrfs_params )); + extended_opts = optarg; +break ;default :print_usage (); } } +if (extended_opts) { +parse_extended_opts (&fs_params, extended_opts); + sectorsize = fs_params.sectorsize; + }if (leafsize < sectorsize || (leafsize & (sectorsize -1 ))) {fprintf (stderr,"Illegal leafsize %u\n" , leafsize);exit (1 );
@@ -192,6 +263,7 @@ int main(int ac, char **av)fprintf (stderr,"Illegal nodesize %u\n" , nodesize);exit (1 ); } + ac = ac - optind;if (ac ==0 )print_usage ();
Signature · 1 line
1.5.3.1.g1e61
* Alex Chiang <[email protected]>:
Quoted 8 lines
* David Miller <[email protected]>:
Quoted 7 lines
From: Alex Chiang <[email protected]>
Date: Mon, 31 Mar 2008 14:26:33 -0600Quoted 3 lines
I've gotten as far as successfully creating a btrfs filesystem (at least that's what btrfsck tells me), but haven't been able to mount it yet, probably because of the sector size issue.
Quoted 6 lines
Quoted 3 lines
You should be able to make a filesystem with a sector size >=
PAGE_SIZEand it should work just fine. Please give it a try.Hrm, I'm having issues still. First, here's a patch for mkfs.btrfs to allow the user to pass in a different sector size.
Whoops, whitespace was screwed up on that patch. Here's try #2.
/ac
From: Alex Chiang <[email protected]>
Subject: [PATCH] Teach mkfs.btrfs about configurable sectorsizes
Currently, btrfs assumes PAGE_SIZE <= sectorsize, and sectorsize is hardcoded to 4K in mkfs.btrfs.
Give mkfs.btrfs a new command line option to specify a different sector size. The syntax follows mke2fs's -E extended-options syntax, and the code is taken from mke2fs.
--- mkfs.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 74 insertions(+), 2 deletions(-)
mkfs.c +74 -2
@@ -137,15 +137,76 @@ err:return ret; } +struct btrfs_params { +u32 sectorsize; +}; + +/* +* Shameless ripped from mke2fs +*/ +static void parse_extended_opts (struct btrfs_params *param,const char *opts) +{ +char *buf, *token, *next, *p, *arg; +int len; +int r_usage =0 ; + + len =strlen (opts); + buf =malloc (len+1 ); +if (!buf) { +fprintf (stderr,"Couldn't allocate memory to parse options!\n" ); +exit (1 ); + } +strcpy (buf, opts); +for (token = buf; token && *token; token = next) { + p =strchr (token,',' ); + next =0 ; +if (p) { + *p =0 ; + next = p+1 ; + } + arg =strchr (token,'=' ); +if (arg) { + *arg =0 ; + arg++; + } +if (strcmp (token,"sectorsize" ) ==0 ) { +if (!arg) { + r_usage++; +continue ; + } + param->sectorsize =strtoul (arg, &p,0 ); +if (*p || (param->sectorsize ==0 )) { +fprintf (stderr, +"Invalid sectorsize parameter: %s\n" , + arg); + r_usage++; +continue ; + } + }else { + r_usage++; + } + } +if (r_usage) { +fprintf (stderr,"\nBad options specified.\n\n" +"Extended options are separated by commas, " +"and may take an argument which\n" +"\tis set off by an equals ('=') sign.\n\n" +"Valid extended options are:\n" +"\tsectorsize=<sector size in bytes>\n\n" ); +exit (1 ); + } +} +static void print_usage (void ) { -fprintf (stderr,"usage: mkfs.btrfs [ -l leafsize ] [ -n nodesize] dev [ blocks ]\n" ); +fprintf (stderr,"usage: mkfs.btrfs [ -l leafsize ] [ -n nodesize] [ -E sectorsize=<sectorsize> ] dev [ blocks ]\n" );exit (1 ); }int main (int ac,char **av) {char *file; +char *extended_opts =0 ;u64 block_count =0 ;u64 dev_block_count =0 ;int fd;
@@ -160,10 +221,11 @@ int main(int ac, char **av)int zero_end =1 ;struct btrfs_root *root;struct btrfs_trans_handle *trans; +struct btrfs_params fs_params;while (1 ) {int c; - c =getopt (ac, av,"b:l:n:s:" ); + c =getopt (ac, av,"b:l:n:s:E:" );if (c <0 )break ;switch (c) {
@@ -180,10 +242,19 @@ int main(int ac, char **av) block_count =parse_size (optarg); zero_end =0 ;break ; +case 'E' : +memset (&fs_params,0 , +sizeof (struct btrfs_params )); + extended_opts = optarg; +break ;default :print_usage (); } } +if (extended_opts) { +parse_extended_opts (&fs_params, extended_opts); + sectorsize = fs_params.sectorsize; + }if (leafsize < sectorsize || (leafsize & (sectorsize -1 ))) {fprintf (stderr,"Illegal leafsize %u\n" , leafsize);exit (1 );
@@ -192,6 +263,7 @@ int main(int ac, char **av)fprintf (stderr,"Illegal nodesize %u\n" , nodesize);exit (1 ); } + ac = ac - optind;if (ac ==0 )print_usage ();
Signature · 1 line
1.5.3.1.g1e61
Quoted 8 lines · Alex Chiang
* David Miller <[email protected]>:
Quoted 7 lines
From: Alex Chiang <[email protected]>
Date: Mon, 31 Mar 2008 14:26:33 -0600Quoted 3 lines
I've gotten as far as successfully creating a btrfs filesystem (at least that's what btrfsck tells me), but haven't been able to mount it yet, probably because of the sector size issue.
Quoted 6 lines
Quoted 3 lines
You should be able to make a filesystem with a sector size >=
PAGE_SIZEand it should work just fine. Please give it a try.Hrm, I'm having issues still. First, here's a patch for mkfs.btrfs to allow the user to pass in a different sector size.
I did this a little differently, switching to getopt_long in mkfs.btrfs and using [-s | --sectorsize ] for sectorsize. -s used to be stripesize, but that needs to be redone for the multi-device code anyway.
You can pull down integrated versions of your patches from:
http://www.kernel.org/hg/btrfs/kernel-unstable
http://www.kernel.org/hg/btrfs/progs-unstable
Make sure to update both, there are minor format changes hidden in the unstable tree since you last used it.
-chris
* David Miller <[email protected]>:
Quoted 10 lines
From: Alex Chiang <[email protected]>
Date: Mon, 31 Mar 2008 14:26:33 -0600Quoted 3 lines
I've gotten as far as successfully creating a btrfs filesystem (at least that's what btrfsck tells me), but haven't been able to mount it yet, probably because of the sector size issue.
You should be able to make a filesystem with a sector size >=
PAGE_SIZEand it should work just fine. Please give it a try.
So, using the patch from my last mail, I created a btrfs, but was unable to mount it...
[root@canola btrfs]# getconf PAGESIZE
16384
[root@canola btrfs]# mkfs.btrfs -E sectorsize=16384 /dev/cciss/c2d1 found device 1 on /dev/cciss/c2d1
lowest devid now 1
found Btrfs on /dev/cciss/c2d1 with 1 devices
opening /dev/cciss/c2d1 devid 1 fd 5
alloc chunk size 8388608 from dev 1
alloc chunk size 8388608 from dev 1
fs created on /dev/cciss/c2d1 nodesize 16384 leafsize 16384 sectorsize 16384 bytes 73372631040
[root@canola btrfs]# mount -t btrfs /dev/cciss/c2d1 /mnt/btrfs
mount: /dev/cciss/c2d1: can't read superblock
And from /var/log/messages:
Mar 31 16:50:23 canola kernel: btrfs: cciss/c2d1 checksum verify failed on 16384 wanted A76CDD59 found 4A0E371 from_this_trans 0 Mar 31 16:50:23 canola kernel: btrfs: valid FS not found on cciss/c2d1 Mar 31 16:50:23 canola kernel: btrfs: open_ctree failed
Any hints?
/ac
* Alex Chiang <[email protected]>:
Quoted 8 lines
* David Miller <[email protected]>:
Quoted 7 lines
From: Alex Chiang <[email protected]>
Date: Mon, 31 Mar 2008 14:26:33 -0600Quoted 3 lines
I've gotten as far as successfully creating a btrfs filesystem (at least that's what btrfsck tells me), but haven't been able to mount it yet, probably because of the sector size issue.
Quoted 6 lines
Quoted 3 lines
You should be able to make a filesystem with a sector size >=
PAGE_SIZEand it should work just fine. Please give it a try.So, using the patch from my last mail, I created a btrfs, but was unable to mount it...
It turns out I am an idiot.
At some point, I got confused which btrfs trees I was working in, and gotten switched up to where I had insmod'ed btrfs v0.13, but was trying to mount a filesystem created with btrfs-progs-unstable. Of course, I got a version mismatch when it went to check for BTRFS_MAGIC and mount failed.
Moving to btrfs-unstable allowed me to mount the filesystem.
[root@canola btrfs-unstable]# mount -t btrfs /dev/cciss/c2d1 /mnt/btrfs
scan one opens /dev/cciss/c2d1
found device 1 on /dev/cciss/c2d1
lowest devid now 1
scan one closes bdev /dev/cciss/c2d1
opening /dev/cciss/c2d1 devid 1
lowest bdev /dev/cciss/c2d1
Sorry for the noise.
/ac
Quoted 10 lines · Alex Chiang
Quoted 2 lines
So, using the patch from my last mail, I created a btrfs, but was unable to mount it...
At some point, I got confused which btrfs trees I was working in, and gotten switched up to where I had insmod'ed btrfs v0.13, but was trying to mount a filesystem created with btrfs-progs-unstable. Of course, I got a version mismatch when it went to check for
BTRFS_MAGICand mount failed.Moving to btrfs-unstable allowed me to mount the filesystem.
This is a very easy mistake to make, a long standing TODO is to make sane format revision fields. I'll include this in the multi-device code. Thanks for all the patches so far.
-chris
Quoted 5 lines · Alex Chiang
* Chris Mason <[email protected]>:
Quoted 3 lines
Hello everyone,
Btrfs v0.13 is now available for download from:
Quoted 9 lines
Hi Chris,
Following are two patches that allow btrfs-progs to build on ia64, and prevent a SEGV when trying to do a mkfs.btrfs.
I've gotten as far as successfully creating a btrfs filesystem (at least that's what btrfsck tells me), but haven't been able to mount it yet, probably because of the sector size issue.
Great, thanks I'll take these two. The kernel side needs the same hash.c fix, but I've already got that change made locally.
-chris
* Chris Mason <[email protected]>:
Quoted 3 lines
Great, thanks I'll take these two. The kernel side needs the same
hash.cfix, but I've already got that change made locally.
Here's a patch for the kernel side.
/ac
Subject: [PATCH] btrfs: Stop trashing 'name' arg of btrfs_name_hash
From: Alex Chiang <[email protected]>
In btrfs_name_hash, Local variable 'buf' is declared as
__u32 buf[2];
but we then try to do this:
buf[0] = 0x67452301;
buf[1] = 0xefcdab89;
buf[2] = 0x98badcfe;
buf[3] = 0x10325476;Oops. Fix buf to be the proper size.
hash.c +1 -1
@@ -81,7 +81,7 @@ u64 btrfs_name_hash(const char *name, in__u32 hash;__u32 minor_hash =0 ;const char *p; -__u32 in[8 ], buf[2 ]; +__u32 in[8 ], buf[4 ];u64 hash_result;if (len ==1 && *name =='.' ) {
PATCH 1/2 btrfs-progs: Fix printf format casting errors
In reply to Chris MasonFrom: Alex Chiang <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
We get lots of warnings of the flavor:
utils.c:441: warning: format '%Lu' expects type 'long long unsigned int' but argument 2 has type 'u64'
And thanks to -Werror, the build fails. Clean up these printfs by properly casting the arg to the format specified.
--- ctree.c | 5 +++-- disk-io.c | 7 ++++--- extent-tree.c | 24 +++++++++++++++--------- extent_io.c | 3 ++- file-item.c | 8 +++++--- inode-map.c | 3 ++- root-tree.c | 5 ++++- utils.c | 2 +- volumes.c | 14 +++++++++----- 9 files changed, 45 insertions(+), 26 deletions(-)
ctree.c +3 -2
@@ -237,8 +237,9 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans,} */ if (trans->transid != root->fs_info->generation) { -printk (KERN_CRIT "trans %Lu running %Lu\n" , trans->transid, - root->fs_info->generation); +printk (KERN_CRIT "trans %llu running %llu\n" , + (unsigned long long )trans->transid, + (unsigned long long )root->fs_info->generation);WARN_ON (1 ); }if (btrfs_header_generation (buf) == trans->transid) {
disk-io.c +4 -3
@@ -84,7 +84,8 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,if (verify) {if (memcmp_extent_buffer (buf, result,0 ,BTRFS_CRC32_SIZE )) { -printk ("checksum verify failed on %llu\n" , buf->start); +printk ("checksum verify failed on %llu\n" , + (unsigned long long )buf->start);return 1 ; } }else {
@@ -429,8 +430,8 @@ struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr)fprintf (stderr,"No valid Btrfs found on %s\n" , path);return NULL ; } -fprintf (stderr,"found Btrfs on %s with %Lu devices\n" , path, - total_devs); +fprintf (stderr,"found Btrfs on %s with %lu devices\n" , path, + (unsigned long )total_devs);if (total_devs !=1 ) { ret =btrfs_scan_for_fsid (fs_devices, total_devs,1 );
extent-tree.c +15 -9
@@ -225,7 +225,8 @@ again: out: cache =btrfs_lookup_block_group (root->fs_info, search_start);if (!cache) { -printk ("Unable to find block group for %Lu\n" , search_start); +printk ("Unable to find block group for %llu\n" , + (unsigned long long )search_start);WARN_ON (1 ); }return -ENOSPC ;
@@ -680,7 +681,8 @@ static int lookup_extent_ref(struct btrfs_trans_handle *trans, goto out;if (ret !=0 ) {btrfs_print_leaf (root, path->nodes[0 ]); -printk ("failed to find block number %Lu\n" , bytenr); +printk ("failed to find block number %llu\n" , + (unsigned long long )bytenr);BUG (); } l = path->nodes[0 ];
@@ -1046,7 +1048,7 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans, ret =btrfs_alloc_chunk (trans, extent_root, &start, &num_bytes, flags);if (ret == -ENOSPC ) { -printk ("space info full %Lu\n" , flags); +printk ("space info full %llu\n" , (unsigned long long )flags); space_info->full =1 ;return 0 ; }
@@ -1315,10 +1317,13 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root }else {btrfs_print_leaf (extent_root, path->nodes[0 ]);WARN_ON (1 ); -printk ("Unable to find ref byte nr %Lu root %Lu " -" gen %Lu owner %Lu offset %Lu\n" , bytenr, - root_objectid, ref_generation, owner_objectid, - owner_offset); +printk ("Unable to find ref byte nr %llu root %llu " +" gen %llu owner %llu offset %llu\n" , + (unsigned long long )bytenr, + (unsigned long long )root_objectid, + (unsigned long long )ref_generation, + (unsigned long long )owner_objectid, + (unsigned long long )owner_offset); }if (!found_extent) {btrfs_release_path (extent_root, path);
@@ -1720,8 +1725,9 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans, update_block: ret =update_block_group (trans, root, ins->objectid, ins->offset,1 ,0 );if (ret) { -printk ("update block group failed for %Lu %Lu\n" , - ins->objectid, ins->offset); +printk ("update block group failed for %llu %llu\n" , + (unsigned long long )ins->objectid, + (unsigned long long )ins->offset);BUG (); }return 0 ;
extent_io.c +2 -1
@@ -68,7 +68,8 @@ void extent_io_tree_cleanup(struct extent_io_tree *tree) eb = list_entry(tree->lru.next, struct extent_buffer, lru);if (eb->refs !=1 ) {fprintf (stderr,"extent buffer leak: " -"start %Lu len %u\n" , eb->start, eb->len); +"start %llu len %u\n" , + (unsigned long long )eb->start, eb->len); eb->refs =1 ; }free_extent_buffer (eb);
file-item.c +5 -3
@@ -136,7 +136,8 @@ int btrfs_insert_inline_extent(struct btrfs_trans_handle *trans, err = ret;btrfs_print_leaf (root, leaf);printk ("found wasn't inline offset %llu inode %llu\n" , - offset, objectid); + (unsigned long long )offset, + (unsigned long long )objectid); goto fail; } found_size = btrfs_file_extent_inline_len(leaf,
@@ -386,8 +387,9 @@ found: csum_result =btrfs_csum_data (root, data, csum_result, len);btrfs_csum_final (csum_result, (char *)&csum_result);if (csum_result ==0 ) { -printk ("csum result is 0 for inode %Lu offset %Lu\n" , - objectid, offset); +printk ("csum result is 0 for inode %llu offset %llu\n" , + (unsigned long long )objectid, + (unsigned long long )offset); } write_extent_buffer(leaf, &csum_result, (unsigned long)item,
inode-map.c +2 -1
@@ -72,7 +72,8 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans, path =btrfs_alloc_path ();BUG_ON (!path); search_start = root->last_inode_alloc; - search_start =max (search_start,BTRFS_FIRST_FREE_OBJECTID ); + search_start =max ((unsigned long long )search_start, +BTRFS_FIRST_FREE_OBJECTID ); search_key.objectid = search_start; search_key.offset =0 ;
root-tree.c +4 -1
@@ -183,7 +183,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, goto out;if (ret) {btrfs_print_leaf (root, path->nodes[0 ]); -printk ("failed to del %Lu %u %Lu\n" , key->objectid, key->type, key->offset); +printk ("failed to del %llu %u %llu\n" , + (unsigned long long )key->objectid, + key->type, + (unsigned long long )key->offset); }BUG_ON (ret !=0 );
utils.c +1 -1
@@ -438,7 +438,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,memcpy (disk_super, super,sizeof (*disk_super)); -printf ("adding device id %Lu\n" , device.devid); +printf ("adding device id %llu\n" , (unsigned long long )device.devid);btrfs_set_stack_device_id (dev_item, device.devid);btrfs_set_stack_device_type (dev_item, device.type);btrfs_set_stack_device_io_align (dev_item, device.io_align);
volumes.c +9 -5
@@ -121,7 +121,7 @@ static int device_list_add(const char *path, }if (fs_devices->lowest_devid > devid) { fs_devices->lowest_devid = devid; -printk ("lowest devid now %Lu\n" , devid); +printk ("lowest devid now %llu\n" , (unsigned long long )devid); } *fs_devices_ret = fs_devices;return 0 ;
@@ -151,7 +151,8 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, int flags)list_for_each (cur, head) { device = list_entry(cur, struct btrfs_device, dev_list); fd =open (device->name, flags); -printk ("opening %s devid %Lu fd %d\n" , device->name, device->devid, fd); +printk ("opening %s devid %llu fd %d\n" , device->name, + (unsigned long long )device->devid, fd);if (fd <0 ) { ret = -errno; goto fail;
@@ -195,7 +196,7 @@ int btrfs_scan_one_device(int fd, const char *path, } devid =le64_to_cpu (disk_super->dev_item.devid); *total_devs =btrfs_super_num_devices (disk_super); -printk ("found device %Lu on %s\n" , devid, path); +printk ("found device %llu on %s\n" , (unsigned long long )devid, path); ret =device_list_add (path, disk_super, devid, fs_devices_ret); error_brelse:
@@ -639,7 +640,9 @@ again: key.objectid, calc_size, &dev_offset);BUG_ON (ret); -printk ("alloc chunk size %Lu from dev %Lu\n" , calc_size, device->devid); +printk ("alloc chunk size %llu from dev %llu\n" , + (unsigned long long )calc_size, + (unsigned long long )device->devid); device->bytes_used += calc_size; ret =btrfs_update_device (trans, device);BUG_ON (ret);
@@ -838,7 +841,8 @@ static int read_one_dev(struct btrfs_root *root, devid =btrfs_device_id (leaf, dev_item); device =btrfs_find_device (root, devid);if (!device) { -printk ("warning devid %Lu not found already\n" , devid); +printk ("warning devid %llu not found already\n" , + (unsigned long long )devid); device =kmalloc (sizeof (*device),GFP_NOFS );if (!device)return -ENOMEM ;
Signature · 1 line
1.5.3.1.g1e61
PATCH 2/2 btrfs-progs: Stop stomping on 'name' input parameter
In reply to Chris MasonIn btrfs_name_hash, Local variable 'buf' is declared as
__u32 buf[2];
but we then try to do this:
buf[0] = 0x67452301; buf[1] = 0xefcdab89; buf[2] = 0x98badcfe; buf[3] = 0x10325476;
Oops. Fix buf to be the proper size.
--- hash.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hash.c +1 -1
@@ -80,7 +80,7 @@ u64 btrfs_name_hash(const char *name, int len)__u32 hash;__u32 minor_hash =0 ;const char *p; -__u32 in[8 ], buf[2 ]; +__u32 in[8 ], buf[4 ];u64 hash_result;/* Initialize the default seed for the hash checksum functions */
Signature · 1 line
1.5.3.1.g1e61
Quoted 5 lines · Chris Mason
Hello everyone,
Btrfs v0.13 is now available for download from:
Hi Chris,
I am trying btrfs for the first time. Sorry :(
Not able to compile btrfs-progs. Where should I
get this uuid.h from ?
Thanks,
Badari
3b155:~/btrfs-progs-0.13 # make
ls mkfs.cmkfs.c
gcc -Wp,-MMD,./.mkfs.o.d,-MT,mkfs.o -Wall -fno-strict-aliasing - D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -c mkfs.c mkfs.c:30:23: uuid/uuid.h: No such file or directory
Quoted 5 lines · Badari Pulavarty
Quoted 4 lines · Chris Mason
Hello everyone,
Btrfs v0.13 is now available for download from:
Quoted 7 lines
Quoted 1 line
Hi Chris,
I am trying btrfs for the first time. Sorry :(
Not able to compile btrfs-progs. Where should I
get thisuuid.hfrom ?
Never mind. Found the answer :)
Thanks,
Badari
Quoted 18 lines
Thanks,
Badari3b155:~/btrfs-progs-0.13 # make
lsmkfs.cmkfs.c
gcc-Wp,-MMD,./.mkfs.o.d,-MT,mkfs.o-Wall -fno-strict-aliasing - D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -Werror -cmkfs.cmkfs.c:30:23:uuid/uuid.h: No such file or directory--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
PATCH 1/1 btrfs - replace div_long_long_rem()
In reply to Chris MasonHi Chris,
While compiling btrfs against 2.6.25-rc8-mm1, ran into this. div_long_long_rem() is removed in -mm. Replace with div_u64_rem().
Thanks,
Badari
div_long_long_rem() API is being removed (patch in -mm). Replace div_long_long_rem() with div_u64_rem().
--- extent-tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
extent-tree.c +3 -2
@@ -19,6 +19,7 @@#include <linux/sched.h> #include <linux/crc32c.h> #include <linux/pagemap.h> +#include <linux/math64.h> #include "hash.h" #include "ctree.h" #include "disk-io.h"
@@ -2653,7 +2654,7 @@u64 nr =0 ;u64 cur_byte;u64 old_size; -unsigned long rem; +u32 rem;struct btrfs_block_group_cache *cache;struct btrfs_block_group_item *item;struct btrfs_fs_info *info = root->fs_info;
@@ -2691,7 +2692,7 @@ struct btrfs_block_group_item);btrfs_set_disk_block_group_used (leaf, item,0 ); -div_long_long_rem (nr,3 , &rem); +div_u64_rem (nr,3 , &rem);if (rem) {btrfs_set_disk_block_group_flags (leaf, item,BTRFS_BLOCK_GROUP_DATA );