aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2006-03-02 13:25:26 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-02 13:37:59 -0500
commit3af1efe8a301f5b1c813f5f761cb1e10d6175605 (patch)
tree3f2604369c0ea1a742a31eb29cae672b335826cc
parentc499ec24c31edf270e777a868ffd0daddcfe7ebd (diff)
[PATCH] reiserfs: fix unaligned bitmap usage
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>
-rw-r--r--fs/reiserfs/namei.c8
-rw-r--r--include/linux/reiserfs_fs.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index c8123308e060..284f7852de8b 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -247,7 +247,7 @@ static int linear_search_in_dir_item(struct cpu_key *key,
247 /* mark, that this generation number is used */ 247 /* mark, that this generation number is used */
248 if (de->de_gen_number_bit_string) 248 if (de->de_gen_number_bit_string)
249 set_bit(GET_GENERATION_NUMBER(deh_offset(deh)), 249 set_bit(GET_GENERATION_NUMBER(deh_offset(deh)),
250 (unsigned long *)de->de_gen_number_bit_string); 250 de->de_gen_number_bit_string);
251 251
252 // calculate pointer to name and namelen 252 // calculate pointer to name and namelen
253 de->de_entry_num = i; 253 de->de_entry_num = i;
@@ -431,7 +431,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
431 struct reiserfs_de_head *deh; 431 struct reiserfs_de_head *deh;
432 INITIALIZE_PATH(path); 432 INITIALIZE_PATH(path);
433 struct reiserfs_dir_entry de; 433 struct reiserfs_dir_entry de;
434 int bit_string[MAX_GENERATION_NUMBER / (sizeof(int) * 8) + 1]; 434 DECLARE_BITMAP(bit_string, MAX_GENERATION_NUMBER + 1);
435 int gen_number; 435 int gen_number;
436 char small_buf[32 + DEH_SIZE]; /* 48 bytes now and we avoid kmalloc 436 char small_buf[32 + DEH_SIZE]; /* 48 bytes now and we avoid kmalloc
437 if we create file with short name */ 437 if we create file with short name */
@@ -486,7 +486,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
486 486
487 /* find the proper place for the new entry */ 487 /* find the proper place for the new entry */
488 memset(bit_string, 0, sizeof(bit_string)); 488 memset(bit_string, 0, sizeof(bit_string));
489 de.de_gen_number_bit_string = (char *)bit_string; 489 de.de_gen_number_bit_string = bit_string;
490 retval = reiserfs_find_entry(dir, name, namelen, &path, &de); 490 retval = reiserfs_find_entry(dir, name, namelen, &path, &de);
491 if (retval != NAME_NOT_FOUND) { 491 if (retval != NAME_NOT_FOUND) {
492 if (buffer != small_buf) 492 if (buffer != small_buf)
@@ -508,7 +508,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
508 } 508 }
509 509
510 gen_number = 510 gen_number =
511 find_first_zero_bit((unsigned long *)bit_string, 511 find_first_zero_bit(bit_string,
512 MAX_GENERATION_NUMBER + 1); 512 MAX_GENERATION_NUMBER + 1);
513 if (gen_number > MAX_GENERATION_NUMBER) { 513 if (gen_number > MAX_GENERATION_NUMBER) {
514 /* there is no free generation number */ 514 /* there is no free generation number */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 7d51149bd793..dad78cecfd20 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1052,7 +1052,7 @@ struct reiserfs_dir_entry {
1052 int de_entrylen; 1052 int de_entrylen;
1053 int de_namelen; 1053 int de_namelen;
1054 char *de_name; 1054 char *de_name;
1055 char *de_gen_number_bit_string; 1055 unsigned long *de_gen_number_bit_string;
1056 1056
1057 __u32 de_dir_id; 1057 __u32 de_dir_id;
1058 __u32 de_objectid; 1058 __u32 de_objectid;