Properly cast to avoid compiler warnings, fixes FTBFS on alpha and ia64.
Subsystems (2)
PATCH 1/4 Properly cast to avoid compiler warnings, fixes FTBFS on alpha and ia64.
Bug-Debian: http://bugs.debian.org/539433
Bug-Debian: http://bugs.debian.org/583768
Authors:
Luca Bruno <[email protected]>
Alexander Kurtz <[email protected]> Daniel Baumann <[email protected]>
--- btrfs-convert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
btrfs-convert.c +1 -1
@@ -2441,7 +2441,7 @@ static int do_rollback(const char *devname) ext2_root =btrfs_read_fs_root (root->fs_info, &key);if (!ext2_root ||IS_ERR (ext2_root)) {fprintf (stderr,"unable to open subvol %llu\n" , - key.objectid); + (unsigned long long ) key.objectid); goto fail; }
Signature · 1 line
2.1.0.rc1
PATCH 2/4 Fixes FTBFS with --no-add-needed.
From: Luk Claes <[email protected]>
Bug-Debian: http://bugs.debian.org/554059
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -26,7 +26,7 @@ TESTS = fsck-tests.sh convert-tests.sh INSTALL = install prefix ?= /usr/local bindir = $(prefix)/bin -lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -L. +lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -lcom_err -L. libdir ?= $(prefix)/lib incdir = $(prefix)/include/btrfs LIBS = $(lib_LIBS) $(libs_static)
Signature · 1 line
2.1.0.rc1
Re: [PATCH 2/4] Fixes FTBFS with --no-add-needed.
Makefile TESTS = fsck-tests.sh convert-tests.sh · line 29
Quoted 8 lines · Dimitri John Ledkov
Makefile +1
-1@@ -26,7 +26,7 @@ TESTS = fsck-tests.sh convert-tests.sh INSTALL = install prefix ?= /usr/local bindir = $(prefix)/bin -lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -L. +lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -lcom_err -L.
This will add the com_err library to all binaries, while it's actually used only by the btrfs-convert utility and this dependency has been properly added in ef85e7e285daf (released in 3.12).
One can add a per-target libraries like
btrfs_convert_libs = -lext2fs -lcom_err
Also please be more descriptive what the actual error is in the changelog itself so I don't have to look it up in the referenced bug.
PATCH 3/4 Fixing unaligned memory accesses.
In reply to Dimitri John LedkovFrom: Shawn Landen <[email protected]>
Bug-Debian: http://bugs.debian.org/656955
--- ctree.h | 18 ++++++++++++++---- volumes.c | 5 +++-- 2 files changed, 17 insertions(+), 6 deletions(-)
ctree.h +14 -4
@@ -19,6 +19,8 @@#ifndef __BTRFS__#define __BTRFS__ +#include <stdint.h> +#if BTRFS_FLAT_INCLUDES #include "list.h" #include "kerncompat.h"
@@ -1191,13 +1193,17 @@ struct btrfs_root { static inline u##bits btrfs_##name(const struct extent_buffer *eb) \ { \ const struct btrfs_header *h = (struct btrfs_header *)eb->data; \ - return le##bits##_to_cpu(h->member); \ + uint##bits##_t t; \ + memcpy(&t, &h->member, sizeof(h->member)); \ + return le##bits##_to_cpu(t); \ } \ static inline void btrfs_set_##name(struct extent_buffer *eb, \ u##bits val) \ { \ struct btrfs_header *h = (struct btrfs_header *)eb->data; \ - h->member = cpu_to_le##bits(val); \ + uint##bits##_t t; \ + t = cpu_to_le##bits(val); \ + memcpy(&h->member, &t, sizeof(h->member)); \ }#define BTRFS_SETGET_FUNCS (name, type, member, bits) \
@@ -1219,11 +1225,15 @@ static inline void btrfs_set_##name(struct extent_buffer *eb, \#define BTRFS_SETGET_STACK_FUNCS (name, type, member, bits) \ static inline u##bits btrfs_##name(const type *s) \ { \ - return le##bits##_to_cpu(s->member); \ + uint##bits##_t t; \ + memcpy(&t, &s->member, sizeof(s->member)); \ + return le##bits##_to_cpu(t); \ } \ static inline void btrfs_set_##name(type *s, u##bits val) \ { \ - s->member = cpu_to_le##bits(val); \ + uint##bits##_t t; \ + t = cpu_to_le##bits(val); \ + memcpy(&s->member, &t, sizeof(s->member)); \ } BTRFS_SETGET_FUNCS(device_type, struct btrfs_dev_item, type, 64);
volumes.c +3 -2
@@ -472,10 +472,11 @@ static int find_next_chunk(struct btrfs_root *root, u64 objectid, u64 *offset)if (found_key.objectid != objectid) *offset =0 ;else { +u64 t; chunk =btrfs_item_ptr (path->nodes[0 ], path->slots[0 ], struct btrfs_chunk); - *offset = found_key.offset + -btrfs_chunk_length (path->nodes[0 ], chunk); + t = found_key.offset +btrfs_chunk_length (path->nodes[0 ], chunk); +memcpy (offset, &t,sizeof (found_key.offset)); } } ret =0 ;
Signature · 1 line
2.1.0.rc1
Re: [PATCH 3/4] Fixing unaligned memory accesses.
Quoted 3 lines · Dimitri John Ledkov
From: Shawn Landen <[email protected]>
Bug-Debian: http://bugs.debian.org/656955
The bug seems old (2012) and agains 0.19. We've fixed a few unaligned access bugs in the meantime. Can you please retest with 3.16?
Quoted 12 lines
ctree.h +2
-0@@ -19,6 +19,8 @@#ifndef __BTRFS__#define __BTRFS__ +#include <stdint.h> +#if BTRFS_FLAT_INCLUDES #include "list.h" #include "kerncompat.h"
ctree.h struct btrfs_root { · line 1198
Quoted 7 lines
ctree.h +3
-1@@ -1191,13 +1193,17 @@ struct btrfs_root { static inline u##bits btrfs_##name(const struct extent_buffer *eb) \ { \ const struct btrfs_header *h = (struct btrfs_header *)eb->data; \ - return le##bits##_to_cpu(h->member); \ + uint##bits##_t t; \ + memcpy(&t, &h->member, sizeof(h->member)); \ + return le##bits##_to_cpu(t); \
The change to memcpy is safe, the compiler is smart enough to not emit any memcpy call for x86_64 and there's no change to the leXX_to_cpu macros.
However, I'd like to check first if this is really necessary due to the old version in the bugreport. I'd prefer using the u8/.../u64 types instead of the stdint.h ones, for sake of consistency with the rest of the codebase.
volumes.c static int find_next_chunk(struct btrfs_root *root, u64 objectid, u64 *offset) · line 479
Quoted 13 lines
volumes.c +3
-2@@ -472,10 +472,11 @@ static int find_next_chunk(struct btrfs_root *root, u64 objectid, u64 *offset)if (found_key.objectid != objectid) *offset =0 ;else { +u64 t; chunk =btrfs_item_ptr (path->nodes[0 ], path->slots[0 ], struct btrfs_chunk); - *offset = found_key.offset + -btrfs_chunk_length (path->nodes[0 ], chunk); + t = found_key.offset +btrfs_chunk_length (path->nodes[0 ], chunk); +memcpy (offset, &t,sizeof (found_key.offset));
That's not enough, there are more direct assignments to *offset in that function. The preferred way is to add 'put_unaligned' helper into kerncompat.h and use it.
PATCH 4/4 Default to acting like fsck.
In reply to Dimitri John LedkovInspect arguments, if we are not called as btrfs, then assume we are called to act like fsck.
Bug-Debian: http://bugs.debian.org/712078
--- btrfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
btrfs.c +1 -1
@@ -222,7 +222,7 @@ int main(int argc, char **argv)else bname = argv[0 ]; -if (!strcmp (bname,"btrfsck" )) { +if (strcmp (bname,"btrfs" ) !=0 ) { argv[0 ] ="check" ; }else { argc--;
Signature · 1 line
2.1.0.rc1
Re: [PATCH 4/4] Default to acting like fsck.
Quoted 3 lines · Dimitri John Ledkov
Inspect arguments, if we are not called as btrfs, then assume we are called to act like fsck.
[...]
btrfs.c int main(int argc, char **argv) · line 225
Quoted 2 lines
btrfs.c +1
-1-if (!strcmp (bname,"btrfsck" )) { +if (strcmp (bname,"btrfs" ) !=0 ) {
That's assuming a lot.
Silently (!) breaking people's btrfs-3.15_patched-DontRandomlyPanicV2 is a recipe for needless hair-pulling. Is there a reason for not using something less like strstr(bname, "fsck") that I am missing?
Regards,
T G-R
Re: [PATCH 4/4] Default to acting like fsck.
Quoted 5 lines · Tobias Geerinckx-Rice
Quoted 3 lines · Dimitri John Ledkov
Inspect arguments, if we are not called as btrfs, then assume we are called to act like fsck.
[...]
Quoted 9 lines
btrfs.c int main(int argc, char **argv) · line 225
Quoted 2 lines
btrfs.c +1
-1-if (!strcmp (bname,"btrfsck" )) { +if (strcmp (bname,"btrfs" ) !=0 ) {That's assuming a lot.
Silently (!) breaking people's btrfs-3.15_patched-DontRandomlyPanicV2 is a recipe for needless hair-pulling. Is there a reason for not using something less like
strstr(bname, "fsck")that I am missing?
Quite. This is verbatim patch as I have currently applied in Debian packaging, and it was a fast fix to prevent breakage we had at one point.
Indeed using "strstr(bname, "fsck")" would be better and sufficient to resolve the problem we encountered (specifically fsck.btrfs -> btrfs not acting like btrfs). Also using strstr, would fix btrfsck.my-build to act like fsck tool.
I'll update this one patch.
Signature · 3 lines
Regards, Dimitri.
Re: [PATCH 4/4] Default to acting like fsck.
Quoted 17 lines · Dimitri John Ledkov
Quoted 5 lines · Tobias Geerinckx-Rice
Quoted 3 lines · Dimitri John Ledkov
Inspect arguments, if we are not called as btrfs, then assume we are called to act like fsck.
[...]
Quoted 9 lines
btrfs.c int main(int argc, char **argv) · line 225
Quoted 2 lines
btrfs.c +1
-1-if (!strcmp (bname,"btrfsck" )) { +if (strcmp (bname,"btrfs" ) !=0 ) {That's assuming a lot.
Silently (!) breaking people's btrfs-3.15_patched-DontRandomlyPanicV2 is a recipe for needless hair-pulling. Is there a reason for not using something less like
strstr(bname, "fsck")that I am missing?
Quoted 8 lines
Quite. This is verbatim patch as I have currently applied in Debian packaging, and it was a fast fix to prevent breakage we had at one point.
Indeed using "
strstr(bname, "fsck")" would be better and sufficient to resolve the problem we encountered (specifically fsck.btrfs -> btrfs not acting like btrfs). Also using strstr, would fix btrfsck.my-build to act like fsck tool.
The intention was to provide backward compatibility shortcut for 'btrfsck' -> 'btrfs check' and nothing else. The referenced bug is again for 0.19 but there's an upstream-shipped stub fsck.btrfs (since 3.14) that should avoid any packaging tricks.