Skip to content

Commit

Permalink
[PATCH] reiserfs: fix unaligned bitmap usage
Browse files Browse the repository at this point in the history
The bitmaps associated with generation numbers for directory entries
are declared as an array of ints. On some platforms, this causes alignment
exceptions.

The following patch uses the standard bitmap declaration macros to
declare the bitmaps, fixing the problem.

Originally from Takashi Iwai.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
jeffmahoney authored and Linus Torvalds committed Mar 2, 2006
1 parent c499ec2 commit 3af1efe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions fs/reiserfs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static int linear_search_in_dir_item(struct cpu_key *key,
/* mark, that this generation number is used */
if (de->de_gen_number_bit_string)
set_bit(GET_GENERATION_NUMBER(deh_offset(deh)),
(unsigned long *)de->de_gen_number_bit_string);
de->de_gen_number_bit_string);

// calculate pointer to name and namelen
de->de_entry_num = i;
Expand Down Expand Up @@ -431,7 +431,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
struct reiserfs_de_head *deh;
INITIALIZE_PATH(path);
struct reiserfs_dir_entry de;
int bit_string[MAX_GENERATION_NUMBER / (sizeof(int) * 8) + 1];
DECLARE_BITMAP(bit_string, MAX_GENERATION_NUMBER + 1);
int gen_number;
char small_buf[32 + DEH_SIZE]; /* 48 bytes now and we avoid kmalloc
if we create file with short name */
Expand Down Expand Up @@ -486,7 +486,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,

/* find the proper place for the new entry */
memset(bit_string, 0, sizeof(bit_string));
de.de_gen_number_bit_string = (char *)bit_string;
de.de_gen_number_bit_string = bit_string;
retval = reiserfs_find_entry(dir, name, namelen, &path, &de);
if (retval != NAME_NOT_FOUND) {
if (buffer != small_buf)
Expand All @@ -508,7 +508,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
}

gen_number =
find_first_zero_bit((unsigned long *)bit_string,
find_first_zero_bit(bit_string,
MAX_GENERATION_NUMBER + 1);
if (gen_number > MAX_GENERATION_NUMBER) {
/* there is no free generation number */
Expand Down
2 changes: 1 addition & 1 deletion include/linux/reiserfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ struct reiserfs_dir_entry {
int de_entrylen;
int de_namelen;
char *de_name;
char *de_gen_number_bit_string;
unsigned long *de_gen_number_bit_string;

__u32 de_dir_id;
__u32 de_objectid;
Expand Down

0 comments on commit 3af1efe

Please sign in to comment.