فهرست منبع

reiserfs: run scripts/Lindent on reiserfs code

This was a pure indentation change, using:

	scripts/Lindent fs/reiserfs/*.c include/linux/reiserfs_*.h

to make reiserfs match the regular Linux indentation style.  As Jeff
Mahoney <jeffm@suse.com> writes:

 The ReiserFS code is a mix of a number of different coding styles, sometimes
 different even from line-to-line. Since the code has been relatively stable
 for quite some time and there are few outstanding patches to be applied, it
 is time to reformat the code to conform to the Linux style standard outlined
 in Documentation/CodingStyle.

 This patch contains the result of running scripts/Lindent against
 fs/reiserfs/*.c and include/linux/reiserfs_*.h. There are places where the
 code can be made to look better, but I'd rather keep those patches separate
 so that there isn't a subtle by-hand hand accident in the middle of a huge
 patch. To be clear: This patch is reformatting *only*.

 A number of patches may follow that continue to make the code more consistent
 with the Linux coding style.

 Hans wasn't particularly enthusiastic about these patches, but said he
 wouldn't really oppose them either.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds 20 سال پیش
والد
کامیت
bd4c625c06

+ 969 - 873
fs/reiserfs/bitmap.c

@@ -46,1125 +46,1221 @@
 #define TEST_OPTION(optname, s) \
     test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s))
 
-static inline void get_bit_address (struct super_block * s,
-				    b_blocknr_t block, int * bmap_nr, int * offset)
+static inline void get_bit_address(struct super_block *s,
+				   b_blocknr_t block, int *bmap_nr, int *offset)
 {
-    /* It is in the bitmap block number equal to the block
-     * number divided by the number of bits in a block. */
-    *bmap_nr = block / (s->s_blocksize << 3);
-    /* Within that bitmap block it is located at bit offset *offset. */
-    *offset = block & ((s->s_blocksize << 3) - 1 );
-    return;
+	/* It is in the bitmap block number equal to the block
+	 * number divided by the number of bits in a block. */
+	*bmap_nr = block / (s->s_blocksize << 3);
+	/* Within that bitmap block it is located at bit offset *offset. */
+	*offset = block & ((s->s_blocksize << 3) - 1);
+	return;
 }
 
 #ifdef CONFIG_REISERFS_CHECK
-int is_reusable (struct super_block * s, b_blocknr_t block, int bit_value)
+int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
 {
-    int i, j;
+	int i, j;
 
-    if (block == 0 || block >= SB_BLOCK_COUNT (s)) {
-	reiserfs_warning (s, "vs-4010: is_reusable: block number is out of range %lu (%u)",
-			  block, SB_BLOCK_COUNT (s));
-	return 0;
-    }
-
-    /* it can't be one of the bitmap blocks */
-    for (i = 0; i < SB_BMAP_NR (s); i ++)
-	if (block == SB_AP_BITMAP (s)[i].bh->b_blocknr) {
-	    reiserfs_warning (s, "vs: 4020: is_reusable: "
-			      "bitmap block %lu(%u) can't be freed or reused",
-			      block, SB_BMAP_NR (s));
-	    return 0;
+	if (block == 0 || block >= SB_BLOCK_COUNT(s)) {
+		reiserfs_warning(s,
+				 "vs-4010: is_reusable: block number is out of range %lu (%u)",
+				 block, SB_BLOCK_COUNT(s));
+		return 0;
 	}
-  
-    get_bit_address (s, block, &i, &j);
 
-    if (i >= SB_BMAP_NR (s)) {
-	reiserfs_warning (s, "vs-4030: is_reusable: there is no so many bitmap blocks: "
-			  "block=%lu, bitmap_nr=%d", block, i);
-	return 0;
-    }
+	/* it can't be one of the bitmap blocks */
+	for (i = 0; i < SB_BMAP_NR(s); i++)
+		if (block == SB_AP_BITMAP(s)[i].bh->b_blocknr) {
+			reiserfs_warning(s, "vs: 4020: is_reusable: "
+					 "bitmap block %lu(%u) can't be freed or reused",
+					 block, SB_BMAP_NR(s));
+			return 0;
+		}
 
-    if ((bit_value == 0 && 
-         reiserfs_test_le_bit(j, SB_AP_BITMAP(s)[i].bh->b_data)) ||
-	(bit_value == 1 && 
-	 reiserfs_test_le_bit(j, SB_AP_BITMAP (s)[i].bh->b_data) == 0)) {
-	reiserfs_warning (s, "vs-4040: is_reusable: corresponding bit of block %lu does not "
-			  "match required value (i==%d, j==%d) test_bit==%d",
-		block, i, j, reiserfs_test_le_bit (j, SB_AP_BITMAP (s)[i].bh->b_data));
+	get_bit_address(s, block, &i, &j);
 
-	return 0;
-    }
+	if (i >= SB_BMAP_NR(s)) {
+		reiserfs_warning(s,
+				 "vs-4030: is_reusable: there is no so many bitmap blocks: "
+				 "block=%lu, bitmap_nr=%d", block, i);
+		return 0;
+	}
 
-    if (bit_value == 0 && block == SB_ROOT_BLOCK (s)) {
-	reiserfs_warning (s, "vs-4050: is_reusable: this is root block (%u), "
-			  "it must be busy", SB_ROOT_BLOCK (s));
-	return 0;
-    }
+	if ((bit_value == 0 &&
+	     reiserfs_test_le_bit(j, SB_AP_BITMAP(s)[i].bh->b_data)) ||
+	    (bit_value == 1 &&
+	     reiserfs_test_le_bit(j, SB_AP_BITMAP(s)[i].bh->b_data) == 0)) {
+		reiserfs_warning(s,
+				 "vs-4040: is_reusable: corresponding bit of block %lu does not "
+				 "match required value (i==%d, j==%d) test_bit==%d",
+				 block, i, j, reiserfs_test_le_bit(j,
+								   SB_AP_BITMAP
+								   (s)[i].bh->
+								   b_data));
+
+		return 0;
+	}
 
-    return 1;
+	if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) {
+		reiserfs_warning(s,
+				 "vs-4050: is_reusable: this is root block (%u), "
+				 "it must be busy", SB_ROOT_BLOCK(s));
+		return 0;
+	}
+
+	return 1;
 }
-#endif /* CONFIG_REISERFS_CHECK */
+#endif				/* CONFIG_REISERFS_CHECK */
 
 /* searches in journal structures for a given block number (bmap, off). If block
    is found in reiserfs journal it suggests next free block candidate to test. */
-static inline  int is_block_in_journal (struct super_block * s, int bmap, int
-off, int *next)
+static inline int is_block_in_journal(struct super_block *s, int bmap, int
+				      off, int *next)
 {
-    b_blocknr_t tmp;
-
-    if (reiserfs_in_journal (s, bmap, off, 1, &tmp)) {
-	if (tmp) {              /* hint supplied */
-	    *next = tmp;
-	    PROC_INFO_INC( s, scan_bitmap.in_journal_hint );
-	} else {
-	    (*next) = off + 1;          /* inc offset to avoid looping. */
-	    PROC_INFO_INC( s, scan_bitmap.in_journal_nohint );
+	b_blocknr_t tmp;
+
+	if (reiserfs_in_journal(s, bmap, off, 1, &tmp)) {
+		if (tmp) {	/* hint supplied */
+			*next = tmp;
+			PROC_INFO_INC(s, scan_bitmap.in_journal_hint);
+		} else {
+			(*next) = off + 1;	/* inc offset to avoid looping. */
+			PROC_INFO_INC(s, scan_bitmap.in_journal_nohint);
+		}
+		PROC_INFO_INC(s, scan_bitmap.retry);
+		return 1;
 	}
-	PROC_INFO_INC( s, scan_bitmap.retry );
-	return 1;
-    }
-    return 0;
+	return 0;
 }
 
 /* it searches for a window of zero bits with given minimum and maximum lengths in one bitmap
  * block; */
-static int scan_bitmap_block (struct reiserfs_transaction_handle *th,
-			      int bmap_n, int *beg, int boundary, int min, int max, int unfm)
+static int scan_bitmap_block(struct reiserfs_transaction_handle *th,
+			     int bmap_n, int *beg, int boundary, int min,
+			     int max, int unfm)
 {
-    struct super_block *s = th->t_super;
-    struct reiserfs_bitmap_info *bi=&SB_AP_BITMAP(s)[bmap_n];
-    int end, next;
-    int org = *beg;
+	struct super_block *s = th->t_super;
+	struct reiserfs_bitmap_info *bi = &SB_AP_BITMAP(s)[bmap_n];
+	int end, next;
+	int org = *beg;
 
-    BUG_ON (!th->t_trans_id);
+	BUG_ON(!th->t_trans_id);
 
-    RFALSE(bmap_n >= SB_BMAP_NR (s), "Bitmap %d is out of range (0..%d)",bmap_n, SB_BMAP_NR (s) - 1);
-    PROC_INFO_INC( s, scan_bitmap.bmap );
+	RFALSE(bmap_n >= SB_BMAP_NR(s), "Bitmap %d is out of range (0..%d)",
+	       bmap_n, SB_BMAP_NR(s) - 1);
+	PROC_INFO_INC(s, scan_bitmap.bmap);
 /* this is unclear and lacks comments, explain how journal bitmaps
    work here for the reader.  Convey a sense of the design here. What
    is a window? */
 /* - I mean `a window of zero bits' as in description of this function - Zam. */
-  
-    if ( !bi ) {
-	reiserfs_warning (s, "NULL bitmap info pointer for bitmap %d", bmap_n);
-	return 0;
-    }
-    if (buffer_locked (bi->bh)) {
-       PROC_INFO_INC( s, scan_bitmap.wait );
-       __wait_on_buffer (bi->bh);
-    }
-
-    while (1) {
-	cont:
-	if (bi->free_count < min)
-		return 0; // No free blocks in this bitmap
-
-	/* search for a first zero bit -- beggining of a window */
-	*beg = reiserfs_find_next_zero_le_bit
-	        ((unsigned long*)(bi->bh->b_data), boundary, *beg);
-  
-	if (*beg + min > boundary) { /* search for a zero bit fails or the rest of bitmap block
-				      * cannot contain a zero window of minimum size */
-	    return 0;
-	}
 
-	if (unfm && is_block_in_journal(s,bmap_n, *beg, beg))
-	    continue;
-	/* first zero bit found; we check next bits */
-	for (end = *beg + 1;; end ++) {
-	    if (end >= *beg + max || end >= boundary || reiserfs_test_le_bit (end, bi->bh->b_data)) {
-		next = end;
-		break;
-	    }
-	    /* finding the other end of zero bit window requires looking into journal structures (in
-	     * case of searching for free blocks for unformatted nodes) */
-	    if (unfm && is_block_in_journal(s, bmap_n, end, &next))
-		break;
+	if (!bi) {
+		reiserfs_warning(s, "NULL bitmap info pointer for bitmap %d",
+				 bmap_n);
+		return 0;
+	}
+	if (buffer_locked(bi->bh)) {
+		PROC_INFO_INC(s, scan_bitmap.wait);
+		__wait_on_buffer(bi->bh);
 	}
 
-	/* now (*beg) points to beginning of zero bits window,
-	 * (end) points to one bit after the window end */
-	if (end - *beg >= min) { /* it seems we have found window of proper size */
-	    int i;
-	    reiserfs_prepare_for_journal (s, bi->bh, 1);
-	    /* try to set all blocks used checking are they still free */
-	    for (i = *beg; i < end; i++) {
-		/* It seems that we should not check in journal again. */
-		if (reiserfs_test_and_set_le_bit (i, bi->bh->b_data)) {
-		    /* bit was set by another process
-		     * while we slept in prepare_for_journal() */
-		    PROC_INFO_INC( s, scan_bitmap.stolen );
-		    if (i >= *beg + min)	{ /* we can continue with smaller set of allocated blocks,
-					   * if length of this set is more or equal to `min' */
-			end = i;
-			break;
-		    }
-		    /* otherwise we clear all bit were set ... */
-		    while (--i >= *beg)
-			reiserfs_test_and_clear_le_bit (i, bi->bh->b_data);
-		    reiserfs_restore_prepared_buffer (s, bi->bh);
-		    *beg = org;
-		    /* ... and search again in current block from beginning */
-		    goto cont;	
+	while (1) {
+	      cont:
+		if (bi->free_count < min)
+			return 0;	// No free blocks in this bitmap
+
+		/* search for a first zero bit -- beggining of a window */
+		*beg = reiserfs_find_next_zero_le_bit
+		    ((unsigned long *)(bi->bh->b_data), boundary, *beg);
+
+		if (*beg + min > boundary) {	/* search for a zero bit fails or the rest of bitmap block
+						 * cannot contain a zero window of minimum size */
+			return 0;
 		}
-	    }
-	    bi->free_count -= (end - *beg);
-	    journal_mark_dirty (th, s, bi->bh);
 
-	    /* free block count calculation */
-	    reiserfs_prepare_for_journal (s, SB_BUFFER_WITH_SB(s), 1);
-	    PUT_SB_FREE_BLOCKS(s, SB_FREE_BLOCKS(s) - (end - *beg));
-	    journal_mark_dirty (th, s, SB_BUFFER_WITH_SB(s));
+		if (unfm && is_block_in_journal(s, bmap_n, *beg, beg))
+			continue;
+		/* first zero bit found; we check next bits */
+		for (end = *beg + 1;; end++) {
+			if (end >= *beg + max || end >= boundary
+			    || reiserfs_test_le_bit(end, bi->bh->b_data)) {
+				next = end;
+				break;
+			}
+			/* finding the other end of zero bit window requires looking into journal structures (in
+			 * case of searching for free blocks for unformatted nodes) */
+			if (unfm && is_block_in_journal(s, bmap_n, end, &next))
+				break;
+		}
 
-	    return end - (*beg);
-	} else {
-	    *beg = next;
+		/* now (*beg) points to beginning of zero bits window,
+		 * (end) points to one bit after the window end */
+		if (end - *beg >= min) {	/* it seems we have found window of proper size */
+			int i;
+			reiserfs_prepare_for_journal(s, bi->bh, 1);
+			/* try to set all blocks used checking are they still free */
+			for (i = *beg; i < end; i++) {
+				/* It seems that we should not check in journal again. */
+				if (reiserfs_test_and_set_le_bit
+				    (i, bi->bh->b_data)) {
+					/* bit was set by another process
+					 * while we slept in prepare_for_journal() */
+					PROC_INFO_INC(s, scan_bitmap.stolen);
+					if (i >= *beg + min) {	/* we can continue with smaller set of allocated blocks,
+								 * if length of this set is more or equal to `min' */
+						end = i;
+						break;
+					}
+					/* otherwise we clear all bit were set ... */
+					while (--i >= *beg)
+						reiserfs_test_and_clear_le_bit
+						    (i, bi->bh->b_data);
+					reiserfs_restore_prepared_buffer(s,
+									 bi->
+									 bh);
+					*beg = org;
+					/* ... and search again in current block from beginning */
+					goto cont;
+				}
+			}
+			bi->free_count -= (end - *beg);
+			journal_mark_dirty(th, s, bi->bh);
+
+			/* free block count calculation */
+			reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s),
+						     1);
+			PUT_SB_FREE_BLOCKS(s, SB_FREE_BLOCKS(s) - (end - *beg));
+			journal_mark_dirty(th, s, SB_BUFFER_WITH_SB(s));
+
+			return end - (*beg);
+		} else {
+			*beg = next;
+		}
 	}
-    }
 }
 
-static int bmap_hash_id(struct super_block *s, u32 id) {
-    char * hash_in = NULL;
-    unsigned long hash;
-    unsigned bm;
-
-    if (id <= 2) {
-	bm = 1;
-    } else {
-        hash_in = (char *)(&id);
-        hash = keyed_hash(hash_in, 4);
-	bm = hash % SB_BMAP_NR(s);
-	if (!bm)
-	    bm = 1;
-    }
-    /* this can only be true when SB_BMAP_NR = 1 */
-    if (bm >= SB_BMAP_NR(s))
-    	bm = 0;
-    return bm;
+static int bmap_hash_id(struct super_block *s, u32 id)
+{
+	char *hash_in = NULL;
+	unsigned long hash;
+	unsigned bm;
+
+	if (id <= 2) {
+		bm = 1;
+	} else {
+		hash_in = (char *)(&id);
+		hash = keyed_hash(hash_in, 4);
+		bm = hash % SB_BMAP_NR(s);
+		if (!bm)
+			bm = 1;
+	}
+	/* this can only be true when SB_BMAP_NR = 1 */
+	if (bm >= SB_BMAP_NR(s))
+		bm = 0;
+	return bm;
 }
 
 /*
  * hashes the id and then returns > 0 if the block group for the
  * corresponding hash is full
  */
-static inline int block_group_used(struct super_block *s, u32 id) {
-    int bm;
-    bm = bmap_hash_id(s, id);
-    if (SB_AP_BITMAP(s)[bm].free_count > ((s->s_blocksize << 3) * 60 / 100) ) {
-        return 0;
-    }
-    return 1;
+static inline int block_group_used(struct super_block *s, u32 id)
+{
+	int bm;
+	bm = bmap_hash_id(s, id);
+	if (SB_AP_BITMAP(s)[bm].free_count > ((s->s_blocksize << 3) * 60 / 100)) {
+		return 0;
+	}
+	return 1;
 }
 
 /*
  * the packing is returned in disk byte order
  */
-__le32 reiserfs_choose_packing(struct inode *dir)
+__le32 reiserfs_choose_packing(struct inode * dir)
 {
-    __le32 packing;
-    if (TEST_OPTION(packing_groups, dir->i_sb)) {
-	u32 parent_dir = le32_to_cpu(INODE_PKEY(dir)->k_dir_id);
-	/*
-	 * some versions of reiserfsck expect packing locality 1 to be
-	 * special
-	 */
-	if (parent_dir == 1 || block_group_used(dir->i_sb,parent_dir))
-            packing = INODE_PKEY(dir)->k_objectid;
-        else
-            packing = INODE_PKEY(dir)->k_dir_id;
-    } else
-        packing = INODE_PKEY(dir)->k_objectid;
-    return packing;
+	__le32 packing;
+	if (TEST_OPTION(packing_groups, dir->i_sb)) {
+		u32 parent_dir = le32_to_cpu(INODE_PKEY(dir)->k_dir_id);
+		/*
+		 * some versions of reiserfsck expect packing locality 1 to be
+		 * special
+		 */
+		if (parent_dir == 1 || block_group_used(dir->i_sb, parent_dir))
+			packing = INODE_PKEY(dir)->k_objectid;
+		else
+			packing = INODE_PKEY(dir)->k_dir_id;
+	} else
+		packing = INODE_PKEY(dir)->k_objectid;
+	return packing;
 }
-  
+
 /* Tries to find contiguous zero bit window (given size) in given region of
  * bitmap and place new blocks there. Returns number of allocated blocks. */
-static int scan_bitmap (struct reiserfs_transaction_handle *th,
-			b_blocknr_t *start, b_blocknr_t finish,
-			int min, int max, int unfm, unsigned long file_block)
+static int scan_bitmap(struct reiserfs_transaction_handle *th,
+		       b_blocknr_t * start, b_blocknr_t finish,
+		       int min, int max, int unfm, unsigned long file_block)
 {
-    int nr_allocated=0;
-    struct super_block * s = th->t_super;
-    /* find every bm and bmap and bmap_nr in this file, and change them all to bitmap_blocknr
-     * - Hans, it is not a block number - Zam. */
-
-    int bm, off;
-    int end_bm, end_off;
-    int off_max = s->s_blocksize << 3;
-
-    BUG_ON (!th->t_trans_id);
-
-    PROC_INFO_INC( s, scan_bitmap.call ); 
-    if ( SB_FREE_BLOCKS(s) <= 0)
-	return 0; // No point in looking for more free blocks
-
-    get_bit_address (s, *start, &bm, &off);
-    get_bit_address (s, finish, &end_bm, &end_off);
-    if (bm > SB_BMAP_NR(s))
-        return 0;
-    if (end_bm > SB_BMAP_NR(s))
-        end_bm = SB_BMAP_NR(s);
-
-    /* When the bitmap is more than 10% free, anyone can allocate.
-     * When it's less than 10% free, only files that already use the
-     * bitmap are allowed. Once we pass 80% full, this restriction
-     * is lifted.
-     *
-     * We do this so that files that grow later still have space close to
-     * their original allocation. This improves locality, and presumably
-     * performance as a result.
-     *
-     * This is only an allocation policy and does not make up for getting a
-     * bad hint. Decent hinting must be implemented for this to work well.
-     */
-    if ( TEST_OPTION(skip_busy, s) && SB_FREE_BLOCKS(s) > SB_BLOCK_COUNT(s)/20 ) {
-	for (;bm < end_bm; bm++, off = 0) {
-	    if ( ( off && (!unfm || (file_block != 0))) || SB_AP_BITMAP(s)[bm].free_count > (s->s_blocksize << 3) / 10 )
-		nr_allocated = scan_bitmap_block(th, bm, &off, off_max, min, max, unfm);
-	    if (nr_allocated)
-		goto ret;
-        }
-	/* we know from above that start is a reasonable number */
-	get_bit_address (s, *start, &bm, &off);
-    }
-
-    for (;bm < end_bm; bm++, off = 0) {
-	nr_allocated = scan_bitmap_block(th, bm, &off, off_max, min, max, unfm);
-	if (nr_allocated)
-	    goto ret;
-    }
-
-    nr_allocated = scan_bitmap_block(th, bm, &off, end_off + 1, min, max, unfm);
-  
- ret:
-    *start = bm * off_max + off;
-    return nr_allocated;
+	int nr_allocated = 0;
+	struct super_block *s = th->t_super;
+	/* find every bm and bmap and bmap_nr in this file, and change them all to bitmap_blocknr
+	 * - Hans, it is not a block number - Zam. */
+
+	int bm, off;
+	int end_bm, end_off;
+	int off_max = s->s_blocksize << 3;
+
+	BUG_ON(!th->t_trans_id);
+
+	PROC_INFO_INC(s, scan_bitmap.call);
+	if (SB_FREE_BLOCKS(s) <= 0)
+		return 0;	// No point in looking for more free blocks
+
+	get_bit_address(s, *start, &bm, &off);
+	get_bit_address(s, finish, &end_bm, &end_off);
+	if (bm > SB_BMAP_NR(s))
+		return 0;
+	if (end_bm > SB_BMAP_NR(s))
+		end_bm = SB_BMAP_NR(s);
+
+	/* When the bitmap is more than 10% free, anyone can allocate.
+	 * When it's less than 10% free, only files that already use the
+	 * bitmap are allowed. Once we pass 80% full, this restriction
+	 * is lifted.
+	 *
+	 * We do this so that files that grow later still have space close to
+	 * their original allocation. This improves locality, and presumably
+	 * performance as a result.
+	 *
+	 * This is only an allocation policy and does not make up for getting a
+	 * bad hint. Decent hinting must be implemented for this to work well.
+	 */
+	if (TEST_OPTION(skip_busy, s)
+	    && SB_FREE_BLOCKS(s) > SB_BLOCK_COUNT(s) / 20) {
+		for (; bm < end_bm; bm++, off = 0) {
+			if ((off && (!unfm || (file_block != 0)))
+			    || SB_AP_BITMAP(s)[bm].free_count >
+			    (s->s_blocksize << 3) / 10)
+				nr_allocated =
+				    scan_bitmap_block(th, bm, &off, off_max,
+						      min, max, unfm);
+			if (nr_allocated)
+				goto ret;
+		}
+		/* we know from above that start is a reasonable number */
+		get_bit_address(s, *start, &bm, &off);
+	}
+
+	for (; bm < end_bm; bm++, off = 0) {
+		nr_allocated =
+		    scan_bitmap_block(th, bm, &off, off_max, min, max, unfm);
+		if (nr_allocated)
+			goto ret;
+	}
+
+	nr_allocated =
+	    scan_bitmap_block(th, bm, &off, end_off + 1, min, max, unfm);
+
+      ret:
+	*start = bm * off_max + off;
+	return nr_allocated;
 
 }
 
-static void _reiserfs_free_block (struct reiserfs_transaction_handle *th,
-				  struct inode *inode, b_blocknr_t block,
-				  int for_unformatted)
+static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
+				 struct inode *inode, b_blocknr_t block,
+				 int for_unformatted)
 {
-    struct super_block * s = th->t_super;
-    struct reiserfs_super_block * rs;
-    struct buffer_head * sbh;
-    struct reiserfs_bitmap_info *apbi;
-    int nr, offset;
+	struct super_block *s = th->t_super;
+	struct reiserfs_super_block *rs;
+	struct buffer_head *sbh;
+	struct reiserfs_bitmap_info *apbi;
+	int nr, offset;
 
-    BUG_ON (!th->t_trans_id);
+	BUG_ON(!th->t_trans_id);
 
-    PROC_INFO_INC( s, free_block );
+	PROC_INFO_INC(s, free_block);
 
-    rs = SB_DISK_SUPER_BLOCK (s);
-    sbh = SB_BUFFER_WITH_SB (s);
-    apbi = SB_AP_BITMAP(s);
+	rs = SB_DISK_SUPER_BLOCK(s);
+	sbh = SB_BUFFER_WITH_SB(s);
+	apbi = SB_AP_BITMAP(s);
 
-    get_bit_address (s, block, &nr, &offset);
+	get_bit_address(s, block, &nr, &offset);
 
-    if (nr >= sb_bmap_nr (rs)) {
-	reiserfs_warning (s, "vs-4075: reiserfs_free_block: "
-			  "block %lu is out of range on %s",
-			  block, reiserfs_bdevname (s));
-	return;
-    }
-
-    reiserfs_prepare_for_journal(s, apbi[nr].bh, 1 ) ;
-
-    /* clear bit for the given block in bit map */
-    if (!reiserfs_test_and_clear_le_bit (offset, apbi[nr].bh->b_data)) {
-	reiserfs_warning (s, "vs-4080: reiserfs_free_block: "
-			  "free_block (%s:%lu)[dev:blocknr]: bit already cleared",
-			  reiserfs_bdevname (s), block);
-    }
-    apbi[nr].free_count ++;
-    journal_mark_dirty (th, s, apbi[nr].bh);
-
-    reiserfs_prepare_for_journal(s, sbh, 1) ;
-    /* update super block */
-    set_sb_free_blocks( rs, sb_free_blocks(rs) + 1 );
-
-    journal_mark_dirty (th, s, sbh);
-    if (for_unformatted)
-        DQUOT_FREE_BLOCK_NODIRTY(inode, 1);
+	if (nr >= sb_bmap_nr(rs)) {
+		reiserfs_warning(s, "vs-4075: reiserfs_free_block: "
+				 "block %lu is out of range on %s",
+				 block, reiserfs_bdevname(s));
+		return;
+	}
+
+	reiserfs_prepare_for_journal(s, apbi[nr].bh, 1);
+
+	/* clear bit for the given block in bit map */
+	if (!reiserfs_test_and_clear_le_bit(offset, apbi[nr].bh->b_data)) {
+		reiserfs_warning(s, "vs-4080: reiserfs_free_block: "
+				 "free_block (%s:%lu)[dev:blocknr]: bit already cleared",
+				 reiserfs_bdevname(s), block);
+	}
+	apbi[nr].free_count++;
+	journal_mark_dirty(th, s, apbi[nr].bh);
+
+	reiserfs_prepare_for_journal(s, sbh, 1);
+	/* update super block */
+	set_sb_free_blocks(rs, sb_free_blocks(rs) + 1);
+
+	journal_mark_dirty(th, s, sbh);
+	if (for_unformatted)
+		DQUOT_FREE_BLOCK_NODIRTY(inode, 1);
 }
 
-void reiserfs_free_block (struct reiserfs_transaction_handle *th, 
-			  struct inode *inode, b_blocknr_t block,
-			  int for_unformatted)
+void reiserfs_free_block(struct reiserfs_transaction_handle *th,
+			 struct inode *inode, b_blocknr_t block,
+			 int for_unformatted)
 {
-    struct super_block * s = th->t_super;
+	struct super_block *s = th->t_super;
 
-    BUG_ON (!th->t_trans_id);
+	BUG_ON(!th->t_trans_id);
 
-    RFALSE(!s, "vs-4061: trying to free block on nonexistent device");
-    RFALSE(is_reusable (s, block, 1) == 0, "vs-4071: can not free such block");
-    /* mark it before we clear it, just in case */
-    journal_mark_freed(th, s, block) ;
-    _reiserfs_free_block(th, inode, block, for_unformatted) ;
+	RFALSE(!s, "vs-4061: trying to free block on nonexistent device");
+	RFALSE(is_reusable(s, block, 1) == 0,
+	       "vs-4071: can not free such block");
+	/* mark it before we clear it, just in case */
+	journal_mark_freed(th, s, block);
+	_reiserfs_free_block(th, inode, block, for_unformatted);
 }
 
 /* preallocated blocks don't need to be run through journal_mark_freed */
-static void reiserfs_free_prealloc_block (struct reiserfs_transaction_handle *th,
-			  struct inode *inode, b_blocknr_t block) {
-    RFALSE(!th->t_super, "vs-4060: trying to free block on nonexistent device");
-    RFALSE(is_reusable (th->t_super, block, 1) == 0, "vs-4070: can not free such block");
-    BUG_ON (!th->t_trans_id);
-    _reiserfs_free_block(th, inode, block, 1) ;
+static void reiserfs_free_prealloc_block(struct reiserfs_transaction_handle *th,
+					 struct inode *inode, b_blocknr_t block)
+{
+	RFALSE(!th->t_super,
+	       "vs-4060: trying to free block on nonexistent device");
+	RFALSE(is_reusable(th->t_super, block, 1) == 0,
+	       "vs-4070: can not free such block");
+	BUG_ON(!th->t_trans_id);
+	_reiserfs_free_block(th, inode, block, 1);
 }
 
-static void __discard_prealloc (struct reiserfs_transaction_handle * th,
-				struct reiserfs_inode_info *ei)
+static void __discard_prealloc(struct reiserfs_transaction_handle *th,
+			       struct reiserfs_inode_info *ei)
 {
-    unsigned long save = ei->i_prealloc_block ;
-    int dirty = 0;
-    struct inode *inode = &ei->vfs_inode;
-    BUG_ON (!th->t_trans_id);
+	unsigned long save = ei->i_prealloc_block;
+	int dirty = 0;
+	struct inode *inode = &ei->vfs_inode;
+	BUG_ON(!th->t_trans_id);
 #ifdef CONFIG_REISERFS_CHECK
-    if (ei->i_prealloc_count < 0)
-	reiserfs_warning (th->t_super, "zam-4001:%s: inode has negative prealloc blocks count.", __FUNCTION__ );
+	if (ei->i_prealloc_count < 0)
+		reiserfs_warning(th->t_super,
+				 "zam-4001:%s: inode has negative prealloc blocks count.",
+				 __FUNCTION__);
 #endif
-    while (ei->i_prealloc_count > 0) {
-	reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
-	ei->i_prealloc_block++;
-	ei->i_prealloc_count --;
-	dirty = 1;
-    }
-    if (dirty)
-    	reiserfs_update_sd(th, inode);
-    ei->i_prealloc_block = save;
-    list_del_init(&(ei->i_prealloc_list));
+	while (ei->i_prealloc_count > 0) {
+		reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
+		ei->i_prealloc_block++;
+		ei->i_prealloc_count--;
+		dirty = 1;
+	}
+	if (dirty)
+		reiserfs_update_sd(th, inode);
+	ei->i_prealloc_block = save;
+	list_del_init(&(ei->i_prealloc_list));
 }
 
 /* FIXME: It should be inline function */
-void reiserfs_discard_prealloc (struct reiserfs_transaction_handle *th, 
-				struct inode *inode)
+void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th,
+			       struct inode *inode)
 {
-    struct reiserfs_inode_info *ei = REISERFS_I(inode);
-    BUG_ON (!th->t_trans_id);
-    if (ei->i_prealloc_count)
-	__discard_prealloc(th, ei);
+	struct reiserfs_inode_info *ei = REISERFS_I(inode);
+	BUG_ON(!th->t_trans_id);
+	if (ei->i_prealloc_count)
+		__discard_prealloc(th, ei);
 }
 
-void reiserfs_discard_all_prealloc (struct reiserfs_transaction_handle *th)
+void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th)
 {
-    struct list_head * plist = &SB_JOURNAL(th->t_super)->j_prealloc_list;
+	struct list_head *plist = &SB_JOURNAL(th->t_super)->j_prealloc_list;
 
-    BUG_ON (!th->t_trans_id);
+	BUG_ON(!th->t_trans_id);
 
-    while (!list_empty(plist)) {
-	struct reiserfs_inode_info *ei;
-	ei = list_entry(plist->next, struct reiserfs_inode_info, i_prealloc_list);
+	while (!list_empty(plist)) {
+		struct reiserfs_inode_info *ei;
+		ei = list_entry(plist->next, struct reiserfs_inode_info,
+				i_prealloc_list);
 #ifdef CONFIG_REISERFS_CHECK
-	if (!ei->i_prealloc_count) {
-	    reiserfs_warning (th->t_super, "zam-4001:%s: inode is in prealloc list but has no preallocated blocks.", __FUNCTION__);
-	}
+		if (!ei->i_prealloc_count) {
+			reiserfs_warning(th->t_super,
+					 "zam-4001:%s: inode is in prealloc list but has no preallocated blocks.",
+					 __FUNCTION__);
+		}
 #endif
-	__discard_prealloc(th, ei);
-    }
+		__discard_prealloc(th, ei);
+	}
 }
 
-void reiserfs_init_alloc_options (struct super_block *s)
+void reiserfs_init_alloc_options(struct super_block *s)
 {
-    set_bit (_ALLOC_skip_busy, &SB_ALLOC_OPTS(s));
-    set_bit (_ALLOC_dirid_groups, &SB_ALLOC_OPTS(s));
-    set_bit (_ALLOC_packing_groups, &SB_ALLOC_OPTS(s));
+	set_bit(_ALLOC_skip_busy, &SB_ALLOC_OPTS(s));
+	set_bit(_ALLOC_dirid_groups, &SB_ALLOC_OPTS(s));
+	set_bit(_ALLOC_packing_groups, &SB_ALLOC_OPTS(s));
 }
 
 /* block allocator related options are parsed here */
-int reiserfs_parse_alloc_options(struct super_block * s, char * options)
+int reiserfs_parse_alloc_options(struct super_block *s, char *options)
 {
-    char * this_char, * value;
-
-    REISERFS_SB(s)->s_alloc_options.bits = 0; /* clear default settings */
-
-    while ( (this_char = strsep (&options, ":")) != NULL ) {
-	if ((value = strchr (this_char, '=')) != NULL)
-	    *value++ = 0;
-
-	if (!strcmp(this_char, "concentrating_formatted_nodes")) {
-	    int temp;
-	    SET_OPTION(concentrating_formatted_nodes);
-	    temp = (value && *value) ? simple_strtoul (value, &value, 0) : 10;
-	    if (temp <= 0 || temp > 100) {
-		REISERFS_SB(s)->s_alloc_options.border = 10;
-	    } else {
-		REISERFS_SB(s)->s_alloc_options.border = 100 / temp;
-	   }
-	    continue;
-	}
-	if (!strcmp(this_char, "displacing_large_files")) {
-	    SET_OPTION(displacing_large_files);
-	    REISERFS_SB(s)->s_alloc_options.large_file_size =
-		(value && *value) ? simple_strtoul (value, &value, 0) : 16;
-	    continue;
-	}
-	if (!strcmp(this_char, "displacing_new_packing_localities")) {
-	    SET_OPTION(displacing_new_packing_localities);
-	    continue;
-	};
-
-	if (!strcmp(this_char, "old_hashed_relocation")) {
-	    SET_OPTION(old_hashed_relocation);
-	    continue;
-	}
+	char *this_char, *value;
+
+	REISERFS_SB(s)->s_alloc_options.bits = 0;	/* clear default settings */
+
+	while ((this_char = strsep(&options, ":")) != NULL) {
+		if ((value = strchr(this_char, '=')) != NULL)
+			*value++ = 0;
+
+		if (!strcmp(this_char, "concentrating_formatted_nodes")) {
+			int temp;
+			SET_OPTION(concentrating_formatted_nodes);
+			temp = (value
+				&& *value) ? simple_strtoul(value, &value,
+							    0) : 10;
+			if (temp <= 0 || temp > 100) {
+				REISERFS_SB(s)->s_alloc_options.border = 10;
+			} else {
+				REISERFS_SB(s)->s_alloc_options.border =
+				    100 / temp;
+			}
+			continue;
+		}
+		if (!strcmp(this_char, "displacing_large_files")) {
+			SET_OPTION(displacing_large_files);
+			REISERFS_SB(s)->s_alloc_options.large_file_size =
+			    (value
+			     && *value) ? simple_strtoul(value, &value, 0) : 16;
+			continue;
+		}
+		if (!strcmp(this_char, "displacing_new_packing_localities")) {
+			SET_OPTION(displacing_new_packing_localities);
+			continue;
+		};
+
+		if (!strcmp(this_char, "old_hashed_relocation")) {
+			SET_OPTION(old_hashed_relocation);
+			continue;
+		}
 
-	if (!strcmp(this_char, "new_hashed_relocation")) {
-	    SET_OPTION(new_hashed_relocation);
-	    continue;
-	}
+		if (!strcmp(this_char, "new_hashed_relocation")) {
+			SET_OPTION(new_hashed_relocation);
+			continue;
+		}
 
-        if (!strcmp(this_char, "dirid_groups")) {
-	    SET_OPTION(dirid_groups);
-	    continue;
-        }
-        if (!strcmp(this_char, "oid_groups")) {
-	    SET_OPTION(oid_groups);
-	    continue;
-        }
-        if (!strcmp(this_char, "packing_groups")) {
-	    SET_OPTION(packing_groups);
-	    continue;
-        }
-	if (!strcmp(this_char, "hashed_formatted_nodes")) {
-	    SET_OPTION(hashed_formatted_nodes);
-	    continue;
-	}
+		if (!strcmp(this_char, "dirid_groups")) {
+			SET_OPTION(dirid_groups);
+			continue;
+		}
+		if (!strcmp(this_char, "oid_groups")) {
+			SET_OPTION(oid_groups);
+			continue;
+		}
+		if (!strcmp(this_char, "packing_groups")) {
+			SET_OPTION(packing_groups);
+			continue;
+		}
+		if (!strcmp(this_char, "hashed_formatted_nodes")) {
+			SET_OPTION(hashed_formatted_nodes);
+			continue;
+		}
 
-	if (!strcmp(this_char, "skip_busy")) {
-	    SET_OPTION(skip_busy);
-	    continue;
-	}
+		if (!strcmp(this_char, "skip_busy")) {
+			SET_OPTION(skip_busy);
+			continue;
+		}
 
-	if (!strcmp(this_char, "hundredth_slices")) {
-	    SET_OPTION(hundredth_slices);
-	    continue;
-	}
+		if (!strcmp(this_char, "hundredth_slices")) {
+			SET_OPTION(hundredth_slices);
+			continue;
+		}
 
-	if (!strcmp(this_char, "old_way")) {
-	    SET_OPTION(old_way);
-	    continue;
-	}
+		if (!strcmp(this_char, "old_way")) {
+			SET_OPTION(old_way);
+			continue;
+		}
 
-	if (!strcmp(this_char, "displace_based_on_dirid")) {
-	    SET_OPTION(displace_based_on_dirid);
-	    continue;
-	}
+		if (!strcmp(this_char, "displace_based_on_dirid")) {
+			SET_OPTION(displace_based_on_dirid);
+			continue;
+		}
 
-	if (!strcmp(this_char, "preallocmin")) {
-	    REISERFS_SB(s)->s_alloc_options.preallocmin =
-		(value && *value) ? simple_strtoul (value, &value, 0) : 4;
-	    continue;
-	}
+		if (!strcmp(this_char, "preallocmin")) {
+			REISERFS_SB(s)->s_alloc_options.preallocmin =
+			    (value
+			     && *value) ? simple_strtoul(value, &value, 0) : 4;
+			continue;
+		}
+
+		if (!strcmp(this_char, "preallocsize")) {
+			REISERFS_SB(s)->s_alloc_options.preallocsize =
+			    (value
+			     && *value) ? simple_strtoul(value, &value,
+							 0) :
+			    PREALLOCATION_SIZE;
+			continue;
+		}
 
-	if (!strcmp(this_char, "preallocsize")) {
-	    REISERFS_SB(s)->s_alloc_options.preallocsize =
-		(value && *value) ? simple_strtoul (value, &value, 0) : PREALLOCATION_SIZE;
-	    continue;
+		reiserfs_warning(s, "zam-4001: %s : unknown option - %s",
+				 __FUNCTION__, this_char);
+		return 1;
 	}
 
-	reiserfs_warning (s, "zam-4001: %s : unknown option - %s",
-			  __FUNCTION__ , this_char);
-	return 1;
-      }
-  
-    reiserfs_warning (s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s));
-    return 0;
+	reiserfs_warning(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s));
+	return 0;
 }
-  
-static inline void new_hashed_relocation (reiserfs_blocknr_hint_t * hint)
+
+static inline void new_hashed_relocation(reiserfs_blocknr_hint_t * hint)
 {
-    char * hash_in;
-    if (hint->formatted_node) {
-	    hash_in = (char*)&hint->key.k_dir_id;
-    } else {
-	if (!hint->inode) {
-	    //hint->search_start = hint->beg;
-	    hash_in = (char*)&hint->key.k_dir_id;
-	} else 
-	    if ( TEST_OPTION(displace_based_on_dirid, hint->th->t_super))
-		hash_in = (char *)(&INODE_PKEY(hint->inode)->k_dir_id);
-	    else
-		hash_in = (char *)(&INODE_PKEY(hint->inode)->k_objectid);
-      }
+	char *hash_in;
+	if (hint->formatted_node) {
+		hash_in = (char *)&hint->key.k_dir_id;
+	} else {
+		if (!hint->inode) {
+			//hint->search_start = hint->beg;
+			hash_in = (char *)&hint->key.k_dir_id;
+		} else
+		    if (TEST_OPTION(displace_based_on_dirid, hint->th->t_super))
+			hash_in = (char *)(&INODE_PKEY(hint->inode)->k_dir_id);
+		else
+			hash_in =
+			    (char *)(&INODE_PKEY(hint->inode)->k_objectid);
+	}
 
-    hint->search_start = hint->beg + keyed_hash(hash_in, 4) % (hint->end - hint->beg);
+	hint->search_start =
+	    hint->beg + keyed_hash(hash_in, 4) % (hint->end - hint->beg);
 }
 
 /*
  * Relocation based on dirid, hashing them into a given bitmap block
  * files. Formatted nodes are unaffected, a seperate policy covers them
  */
-static void
-dirid_groups (reiserfs_blocknr_hint_t *hint)
+static void dirid_groups(reiserfs_blocknr_hint_t * hint)
 {
-    unsigned long hash;
-    __u32 dirid = 0;
-    int bm = 0;
-    struct super_block *sb = hint->th->t_super;
-    if (hint->inode)
-	dirid = le32_to_cpu(INODE_PKEY(hint->inode)->k_dir_id);
-    else if (hint->formatted_node)
-        dirid = hint->key.k_dir_id;
-
-    if (dirid) {
-	bm = bmap_hash_id(sb, dirid);
-	hash = bm * (sb->s_blocksize << 3);
-	/* give a portion of the block group to metadata */
+	unsigned long hash;
+	__u32 dirid = 0;
+	int bm = 0;
+	struct super_block *sb = hint->th->t_super;
 	if (hint->inode)
-	    hash += sb->s_blocksize/2;
-	hint->search_start = hash;
-    }
+		dirid = le32_to_cpu(INODE_PKEY(hint->inode)->k_dir_id);
+	else if (hint->formatted_node)
+		dirid = hint->key.k_dir_id;
+
+	if (dirid) {
+		bm = bmap_hash_id(sb, dirid);
+		hash = bm * (sb->s_blocksize << 3);
+		/* give a portion of the block group to metadata */
+		if (hint->inode)
+			hash += sb->s_blocksize / 2;
+		hint->search_start = hash;
+	}
 }
 
 /*
  * Relocation based on oid, hashing them into a given bitmap block
  * files. Formatted nodes are unaffected, a seperate policy covers them
  */
-static void
-oid_groups (reiserfs_blocknr_hint_t *hint)
+static void oid_groups(reiserfs_blocknr_hint_t * hint)
 {
-    if (hint->inode) {
-	unsigned long hash;
-	__u32 oid;
-	__u32 dirid;
-	int bm;
-
-	dirid = le32_to_cpu(INODE_PKEY(hint->inode)->k_dir_id);
-
-	/* keep the root dir and it's first set of subdirs close to
-	 * the start of the disk
-	 */
-	if (dirid <= 2)
-	    hash = (hint->inode->i_sb->s_blocksize << 3);
-	else {
-	    oid = le32_to_cpu(INODE_PKEY(hint->inode)->k_objectid);
-	    bm = bmap_hash_id(hint->inode->i_sb, oid);
-	    hash = bm * (hint->inode->i_sb->s_blocksize << 3);
+	if (hint->inode) {
+		unsigned long hash;
+		__u32 oid;
+		__u32 dirid;
+		int bm;
+
+		dirid = le32_to_cpu(INODE_PKEY(hint->inode)->k_dir_id);
+
+		/* keep the root dir and it's first set of subdirs close to
+		 * the start of the disk
+		 */
+		if (dirid <= 2)
+			hash = (hint->inode->i_sb->s_blocksize << 3);
+		else {
+			oid = le32_to_cpu(INODE_PKEY(hint->inode)->k_objectid);
+			bm = bmap_hash_id(hint->inode->i_sb, oid);
+			hash = bm * (hint->inode->i_sb->s_blocksize << 3);
+		}
+		hint->search_start = hash;
 	}
-	hint->search_start = hash;
-    }
 }
 
 /* returns 1 if it finds an indirect item and gets valid hint info
  * from it, otherwise 0
  */
-static int get_left_neighbor(reiserfs_blocknr_hint_t *hint)
+static int get_left_neighbor(reiserfs_blocknr_hint_t * hint)
 {
-    struct path * path;
-    struct buffer_head * bh;
-    struct item_head * ih;
-    int pos_in_item;
-    __le32 * item;
-    int ret = 0;
-
-    if (!hint->path)		/* reiserfs code can call this function w/o pointer to path
+	struct path *path;
+	struct buffer_head *bh;
+	struct item_head *ih;
+	int pos_in_item;
+	__le32 *item;
+	int ret = 0;
+
+	if (!hint->path)	/* reiserfs code can call this function w/o pointer to path
 				 * structure supplied; then we rely on supplied search_start */
-	return 0;
-
-    path = hint->path;
-    bh = get_last_bh(path);
-    RFALSE( !bh, "green-4002: Illegal path specified to get_left_neighbor");
-    ih = get_ih(path);
-    pos_in_item = path->pos_in_item;
-    item = get_item (path);
-
-    hint->search_start = bh->b_blocknr;
-
-    if (!hint->formatted_node && is_indirect_le_ih (ih)) {
-	/* for indirect item: go to left and look for the first non-hole entry
-	   in the indirect item */
-	if (pos_in_item == I_UNFM_NUM (ih))
-	    pos_in_item--;
-//	    pos_in_item = I_UNFM_NUM (ih) - 1;
-	while (pos_in_item >= 0) {
-	    int t=get_block_num(item,pos_in_item);
-	    if (t) {
-		hint->search_start = t;
-		ret = 1;
-		break;
-	    }
-	    pos_in_item --;
+		return 0;
+
+	path = hint->path;
+	bh = get_last_bh(path);
+	RFALSE(!bh, "green-4002: Illegal path specified to get_left_neighbor");
+	ih = get_ih(path);
+	pos_in_item = path->pos_in_item;
+	item = get_item(path);
+
+	hint->search_start = bh->b_blocknr;
+
+	if (!hint->formatted_node && is_indirect_le_ih(ih)) {
+		/* for indirect item: go to left and look for the first non-hole entry
+		   in the indirect item */
+		if (pos_in_item == I_UNFM_NUM(ih))
+			pos_in_item--;
+//          pos_in_item = I_UNFM_NUM (ih) - 1;
+		while (pos_in_item >= 0) {
+			int t = get_block_num(item, pos_in_item);
+			if (t) {
+				hint->search_start = t;
+				ret = 1;
+				break;
+			}
+			pos_in_item--;
+		}
 	}
-    }
 
-    /* does result value fit into specified region? */
-    return ret;
+	/* does result value fit into specified region? */
+	return ret;
 }
 
 /* should be, if formatted node, then try to put on first part of the device
    specified as number of percent with mount option device, else try to put
    on last of device.  This is not to say it is good code to do so,
    but the effect should be measured.  */
-static inline void set_border_in_hint(struct super_block *s, reiserfs_blocknr_hint_t *hint)
+static inline void set_border_in_hint(struct super_block *s,
+				      reiserfs_blocknr_hint_t * hint)
 {
-    b_blocknr_t border = SB_BLOCK_COUNT(s) / REISERFS_SB(s)->s_alloc_options.border;
+	b_blocknr_t border =
+	    SB_BLOCK_COUNT(s) / REISERFS_SB(s)->s_alloc_options.border;
 
-    if (hint->formatted_node)
-	hint->end = border - 1;
-    else
-	hint->beg = border;
+	if (hint->formatted_node)
+		hint->end = border - 1;
+	else
+		hint->beg = border;
 }
 
-static inline void displace_large_file(reiserfs_blocknr_hint_t *hint)
+static inline void displace_large_file(reiserfs_blocknr_hint_t * hint)
 {
-    if ( TEST_OPTION(displace_based_on_dirid, hint->th->t_super))
-	hint->search_start = hint->beg + keyed_hash((char *)(&INODE_PKEY(hint->inode)->k_dir_id), 4) % (hint->end - hint->beg);
-    else
-	hint->search_start = hint->beg + keyed_hash((char *)(&INODE_PKEY(hint->inode)->k_objectid), 4) % (hint->end - hint->beg);
+	if (TEST_OPTION(displace_based_on_dirid, hint->th->t_super))
+		hint->search_start =
+		    hint->beg +
+		    keyed_hash((char *)(&INODE_PKEY(hint->inode)->k_dir_id),
+			       4) % (hint->end - hint->beg);
+	else
+		hint->search_start =
+		    hint->beg +
+		    keyed_hash((char *)(&INODE_PKEY(hint->inode)->k_objectid),
+			       4) % (hint->end - hint->beg);
 }
 
-static inline void hash_formatted_node(reiserfs_blocknr_hint_t *hint)
+static inline void hash_formatted_node(reiserfs_blocknr_hint_t * hint)
 {
-   char * hash_in;
+	char *hash_in;
 
-   if (!hint->inode)
-	hash_in = (char*)&hint->key.k_dir_id;
-    else if ( TEST_OPTION(displace_based_on_dirid, hint->th->t_super))
-	hash_in = (char *)(&INODE_PKEY(hint->inode)->k_dir_id);
-    else
-	hash_in = (char *)(&INODE_PKEY(hint->inode)->k_objectid);
+	if (!hint->inode)
+		hash_in = (char *)&hint->key.k_dir_id;
+	else if (TEST_OPTION(displace_based_on_dirid, hint->th->t_super))
+		hash_in = (char *)(&INODE_PKEY(hint->inode)->k_dir_id);
+	else
+		hash_in = (char *)(&INODE_PKEY(hint->inode)->k_objectid);
 
-	hint->search_start = hint->beg + keyed_hash(hash_in, 4) % (hint->end - hint->beg);
+	hint->search_start =
+	    hint->beg + keyed_hash(hash_in, 4) % (hint->end - hint->beg);
 }
 
-static inline int this_blocknr_allocation_would_make_it_a_large_file(reiserfs_blocknr_hint_t *hint)
+static inline int
+this_blocknr_allocation_would_make_it_a_large_file(reiserfs_blocknr_hint_t *
+						   hint)
 {
-    return hint->block == REISERFS_SB(hint->th->t_super)->s_alloc_options.large_file_size;
+	return hint->block ==
+	    REISERFS_SB(hint->th->t_super)->s_alloc_options.large_file_size;
 }
 
 #ifdef DISPLACE_NEW_PACKING_LOCALITIES
-static inline void displace_new_packing_locality (reiserfs_blocknr_hint_t *hint)
+static inline void displace_new_packing_locality(reiserfs_blocknr_hint_t * hint)
 {
-    struct in_core_key * key = &hint->key;
+	struct in_core_key *key = &hint->key;
 
-    hint->th->displace_new_blocks = 0;
-    hint->search_start = hint->beg + keyed_hash((char*)(&key->k_objectid),4) % (hint->end - hint->beg);
+	hint->th->displace_new_blocks = 0;
+	hint->search_start =
+	    hint->beg + keyed_hash((char *)(&key->k_objectid),
+				   4) % (hint->end - hint->beg);
 }
-  #endif
+#endif
 
-static inline int old_hashed_relocation (reiserfs_blocknr_hint_t * hint)
+static inline int old_hashed_relocation(reiserfs_blocknr_hint_t * hint)
 {
-    b_blocknr_t border;
-    u32 hash_in;
-    
-    if (hint->formatted_node || hint->inode == NULL) {
-	return 0;
-      }
+	b_blocknr_t border;
+	u32 hash_in;
 
-    hash_in = le32_to_cpu((INODE_PKEY(hint->inode))->k_dir_id);
-    border = hint->beg + (u32) keyed_hash(((char *) (&hash_in)), 4) % (hint->end - hint->beg - 1);
-    if (border > hint->search_start)
-	hint->search_start = border;
+	if (hint->formatted_node || hint->inode == NULL) {
+		return 0;
+	}
 
-    return 1;
-  }
-  
-static inline int old_way (reiserfs_blocknr_hint_t * hint)
-{
-    b_blocknr_t border;
-    
-    if (hint->formatted_node || hint->inode == NULL) {
-	return 0;
-    }
-  
-      border = hint->beg + le32_to_cpu(INODE_PKEY(hint->inode)->k_dir_id) % (hint->end  - hint->beg);
-    if (border > hint->search_start)
-	hint->search_start = border;
+	hash_in = le32_to_cpu((INODE_PKEY(hint->inode))->k_dir_id);
+	border =
+	    hint->beg + (u32) keyed_hash(((char *)(&hash_in)),
+					 4) % (hint->end - hint->beg - 1);
+	if (border > hint->search_start)
+		hint->search_start = border;
 
-    return 1;
+	return 1;
 }
 
-static inline void hundredth_slices (reiserfs_blocknr_hint_t * hint)
+static inline int old_way(reiserfs_blocknr_hint_t * hint)
 {
-    struct in_core_key * key = &hint->key;
-    b_blocknr_t slice_start;
+	b_blocknr_t border;
+
+	if (hint->formatted_node || hint->inode == NULL) {
+		return 0;
+	}
+
+	border =
+	    hint->beg +
+	    le32_to_cpu(INODE_PKEY(hint->inode)->k_dir_id) % (hint->end -
+							      hint->beg);
+	if (border > hint->search_start)
+		hint->search_start = border;
 
-    slice_start = (keyed_hash((char*)(&key->k_dir_id),4) % 100) * (hint->end / 100);
-    if ( slice_start > hint->search_start || slice_start + (hint->end / 100) <= hint->search_start) {
-	hint->search_start = slice_start;
-    }
+	return 1;
+}
+
+static inline void hundredth_slices(reiserfs_blocknr_hint_t * hint)
+{
+	struct in_core_key *key = &hint->key;
+	b_blocknr_t slice_start;
+
+	slice_start =
+	    (keyed_hash((char *)(&key->k_dir_id), 4) % 100) * (hint->end / 100);
+	if (slice_start > hint->search_start
+	    || slice_start + (hint->end / 100) <= hint->search_start) {
+		hint->search_start = slice_start;
+	}
 }
-  
-static void determine_search_start(reiserfs_blocknr_hint_t *hint,
-					  int amount_needed)
+
+static void determine_search_start(reiserfs_blocknr_hint_t * hint,
+				   int amount_needed)
 {
-    struct super_block *s = hint->th->t_super;
-    int unfm_hint;
+	struct super_block *s = hint->th->t_super;
+	int unfm_hint;
 
-    hint->beg = 0;
-    hint->end = SB_BLOCK_COUNT(s) - 1;
+	hint->beg = 0;
+	hint->end = SB_BLOCK_COUNT(s) - 1;
 
-    /* This is former border algorithm. Now with tunable border offset */
-    if (concentrating_formatted_nodes(s))
-	set_border_in_hint(s, hint);
+	/* This is former border algorithm. Now with tunable border offset */
+	if (concentrating_formatted_nodes(s))
+		set_border_in_hint(s, hint);
 
 #ifdef DISPLACE_NEW_PACKING_LOCALITIES
-    /* whenever we create a new directory, we displace it.  At first we will
-       hash for location, later we might look for a moderately empty place for
-       it */
-    if (displacing_new_packing_localities(s)
-	&& hint->th->displace_new_blocks) {
-	displace_new_packing_locality(hint);
-
-	/* we do not continue determine_search_start,
-	 * if new packing locality is being displaced */
-	return;
-    }				      
+	/* whenever we create a new directory, we displace it.  At first we will
+	   hash for location, later we might look for a moderately empty place for
+	   it */
+	if (displacing_new_packing_localities(s)
+	    && hint->th->displace_new_blocks) {
+		displace_new_packing_locality(hint);
+
+		/* we do not continue determine_search_start,
+		 * if new packing locality is being displaced */
+		return;
+	}
 #endif
-  
-    /* all persons should feel encouraged to add more special cases here and
-     * test them */
 
-    if (displacing_large_files(s) && !hint->formatted_node
-	&& this_blocknr_allocation_would_make_it_a_large_file(hint)) {
-	displace_large_file(hint);
-	return;
-    }
-
-    /* if none of our special cases is relevant, use the left neighbor in the
-       tree order of the new node we are allocating for */
-    if (hint->formatted_node && TEST_OPTION(hashed_formatted_nodes,s)) {
-        hash_formatted_node(hint);
-	return;
-    }
+	/* all persons should feel encouraged to add more special cases here and
+	 * test them */
 
-    unfm_hint = get_left_neighbor(hint);
+	if (displacing_large_files(s) && !hint->formatted_node
+	    && this_blocknr_allocation_would_make_it_a_large_file(hint)) {
+		displace_large_file(hint);
+		return;
+	}
 
-    /* Mimic old block allocator behaviour, that is if VFS allowed for preallocation,
-       new blocks are displaced based on directory ID. Also, if suggested search_start
-       is less than last preallocated block, we start searching from it, assuming that
-       HDD dataflow is faster in forward direction */
-    if ( TEST_OPTION(old_way, s)) {
-	if (!hint->formatted_node) {
-	    if ( !reiserfs_hashed_relocation(s))
-		old_way(hint);
-	    else if (!reiserfs_no_unhashed_relocation(s))
-		old_hashed_relocation(hint);
+	/* if none of our special cases is relevant, use the left neighbor in the
+	   tree order of the new node we are allocating for */
+	if (hint->formatted_node && TEST_OPTION(hashed_formatted_nodes, s)) {
+		hash_formatted_node(hint);
+		return;
+	}
 
-	    if ( hint->inode && hint->search_start < REISERFS_I(hint->inode)->i_prealloc_block)
-		hint->search_start = REISERFS_I(hint->inode)->i_prealloc_block;
+	unfm_hint = get_left_neighbor(hint);
+
+	/* Mimic old block allocator behaviour, that is if VFS allowed for preallocation,
+	   new blocks are displaced based on directory ID. Also, if suggested search_start
+	   is less than last preallocated block, we start searching from it, assuming that
+	   HDD dataflow is faster in forward direction */
+	if (TEST_OPTION(old_way, s)) {
+		if (!hint->formatted_node) {
+			if (!reiserfs_hashed_relocation(s))
+				old_way(hint);
+			else if (!reiserfs_no_unhashed_relocation(s))
+				old_hashed_relocation(hint);
+
+			if (hint->inode
+			    && hint->search_start <
+			    REISERFS_I(hint->inode)->i_prealloc_block)
+				hint->search_start =
+				    REISERFS_I(hint->inode)->i_prealloc_block;
+		}
+		return;
 	}
-	return;
-    }
 
-    /* This is an approach proposed by Hans */
-    if ( TEST_OPTION(hundredth_slices, s) && ! (displacing_large_files(s) && !hint->formatted_node)) {
-	hundredth_slices(hint);
-	return;
-    }
-
-    /* old_hashed_relocation only works on unformatted */
-    if (!unfm_hint && !hint->formatted_node &&
-        TEST_OPTION(old_hashed_relocation, s))
-    {
-	old_hashed_relocation(hint);
-    }
-    /* new_hashed_relocation works with both formatted/unformatted nodes */
-    if ((!unfm_hint || hint->formatted_node) &&
-        TEST_OPTION(new_hashed_relocation, s))
-    {
-	new_hashed_relocation(hint);
-    }
-    /* dirid grouping works only on unformatted nodes */
-    if (!unfm_hint && !hint->formatted_node && TEST_OPTION(dirid_groups,s))
-    {
-        dirid_groups(hint);
-    }
+	/* This is an approach proposed by Hans */
+	if (TEST_OPTION(hundredth_slices, s)
+	    && !(displacing_large_files(s) && !hint->formatted_node)) {
+		hundredth_slices(hint);
+		return;
+	}
 
+	/* old_hashed_relocation only works on unformatted */
+	if (!unfm_hint && !hint->formatted_node &&
+	    TEST_OPTION(old_hashed_relocation, s)) {
+		old_hashed_relocation(hint);
+	}
+	/* new_hashed_relocation works with both formatted/unformatted nodes */
+	if ((!unfm_hint || hint->formatted_node) &&
+	    TEST_OPTION(new_hashed_relocation, s)) {
+		new_hashed_relocation(hint);
+	}
+	/* dirid grouping works only on unformatted nodes */
+	if (!unfm_hint && !hint->formatted_node && TEST_OPTION(dirid_groups, s)) {
+		dirid_groups(hint);
+	}
 #ifdef DISPLACE_NEW_PACKING_LOCALITIES
-    if (hint->formatted_node && TEST_OPTION(dirid_groups,s))
-    {
-        dirid_groups(hint);
-    }
+	if (hint->formatted_node && TEST_OPTION(dirid_groups, s)) {
+		dirid_groups(hint);
+	}
 #endif
 
-    /* oid grouping works only on unformatted nodes */
-    if (!unfm_hint && !hint->formatted_node && TEST_OPTION(oid_groups,s))
-    {
-        oid_groups(hint);
-    }
-    return;
+	/* oid grouping works only on unformatted nodes */
+	if (!unfm_hint && !hint->formatted_node && TEST_OPTION(oid_groups, s)) {
+		oid_groups(hint);
+	}
+	return;
 }
 
 static int determine_prealloc_size(reiserfs_blocknr_hint_t * hint)
 {
-    /* make minimum size a mount option and benchmark both ways */
-    /* we preallocate blocks only for regular files, specific size */
-    /* benchmark preallocating always and see what happens */
-
-    hint->prealloc_size = 0;
-
-    if (!hint->formatted_node && hint->preallocate) {
-	if (S_ISREG(hint->inode->i_mode)
-	    && hint->inode->i_size >= REISERFS_SB(hint->th->t_super)->s_alloc_options.preallocmin * hint->inode->i_sb->s_blocksize)
-	    hint->prealloc_size = REISERFS_SB(hint->th->t_super)->s_alloc_options.preallocsize - 1;
-    }
-    return CARRY_ON;
+	/* make minimum size a mount option and benchmark both ways */
+	/* we preallocate blocks only for regular files, specific size */
+	/* benchmark preallocating always and see what happens */
+
+	hint->prealloc_size = 0;
+
+	if (!hint->formatted_node && hint->preallocate) {
+		if (S_ISREG(hint->inode->i_mode)
+		    && hint->inode->i_size >=
+		    REISERFS_SB(hint->th->t_super)->s_alloc_options.
+		    preallocmin * hint->inode->i_sb->s_blocksize)
+			hint->prealloc_size =
+			    REISERFS_SB(hint->th->t_super)->s_alloc_options.
+			    preallocsize - 1;
+	}
+	return CARRY_ON;
 }
 
 /* XXX I know it could be merged with upper-level function;
    but may be result function would be too complex. */
-static inline int allocate_without_wrapping_disk (reiserfs_blocknr_hint_t * hint,
-					 b_blocknr_t * new_blocknrs,
-					 b_blocknr_t start, b_blocknr_t finish,
-					 int min,
-					 int amount_needed, int prealloc_size)
+static inline int allocate_without_wrapping_disk(reiserfs_blocknr_hint_t * hint,
+						 b_blocknr_t * new_blocknrs,
+						 b_blocknr_t start,
+						 b_blocknr_t finish, int min,
+						 int amount_needed,
+						 int prealloc_size)
 {
-    int rest = amount_needed;
-    int nr_allocated;
-  
-    while (rest > 0 && start <= finish) {
-	nr_allocated = scan_bitmap (hint->th, &start, finish, min,
-				    rest + prealloc_size, !hint->formatted_node,
-				    hint->block);
-
-	if (nr_allocated == 0)	/* no new blocks allocated, return */
-	    break;
-	
-	/* fill free_blocknrs array first */
-	while (rest > 0 && nr_allocated > 0) {
-	    * new_blocknrs ++ = start ++;
-	    rest --; nr_allocated --;
-	}
+	int rest = amount_needed;
+	int nr_allocated;
+
+	while (rest > 0 && start <= finish) {
+		nr_allocated = scan_bitmap(hint->th, &start, finish, min,
+					   rest + prealloc_size,
+					   !hint->formatted_node, hint->block);
+
+		if (nr_allocated == 0)	/* no new blocks allocated, return */
+			break;
+
+		/* fill free_blocknrs array first */
+		while (rest > 0 && nr_allocated > 0) {
+			*new_blocknrs++ = start++;
+			rest--;
+			nr_allocated--;
+		}
 
-	/* do we have something to fill prealloc. array also ? */
-	if (nr_allocated > 0) {
-	    /* it means prealloc_size was greater that 0 and we do preallocation */
-	    list_add(&REISERFS_I(hint->inode)->i_prealloc_list,
-		     &SB_JOURNAL(hint->th->t_super)->j_prealloc_list);
-	    REISERFS_I(hint->inode)->i_prealloc_block = start;
-	    REISERFS_I(hint->inode)->i_prealloc_count = nr_allocated;
-	    break;
+		/* do we have something to fill prealloc. array also ? */
+		if (nr_allocated > 0) {
+			/* it means prealloc_size was greater that 0 and we do preallocation */
+			list_add(&REISERFS_I(hint->inode)->i_prealloc_list,
+				 &SB_JOURNAL(hint->th->t_super)->
+				 j_prealloc_list);
+			REISERFS_I(hint->inode)->i_prealloc_block = start;
+			REISERFS_I(hint->inode)->i_prealloc_count =
+			    nr_allocated;
+			break;
+		}
 	}
-    }
 
-    return (amount_needed - rest);
+	return (amount_needed - rest);
 }
 
 static inline int blocknrs_and_prealloc_arrays_from_search_start
-    (reiserfs_blocknr_hint_t *hint, b_blocknr_t *new_blocknrs, int amount_needed)
-{
-    struct super_block *s = hint->th->t_super;
-    b_blocknr_t start = hint->search_start;
-    b_blocknr_t finish = SB_BLOCK_COUNT(s) - 1;
-    int passno = 0;
-    int nr_allocated = 0;
-    int bigalloc = 0;
-
-    determine_prealloc_size(hint);
-    if (!hint->formatted_node) {
-        int quota_ret;
+    (reiserfs_blocknr_hint_t * hint, b_blocknr_t * new_blocknrs,
+     int amount_needed) {
+	struct super_block *s = hint->th->t_super;
+	b_blocknr_t start = hint->search_start;
+	b_blocknr_t finish = SB_BLOCK_COUNT(s) - 1;
+	int passno = 0;
+	int nr_allocated = 0;
+	int bigalloc = 0;
+
+	determine_prealloc_size(hint);
+	if (!hint->formatted_node) {
+		int quota_ret;
 #ifdef REISERQUOTA_DEBUG
-	reiserfs_debug (s, REISERFS_DEBUG_CODE, "reiserquota: allocating %d blocks id=%u", amount_needed, hint->inode->i_uid);
+		reiserfs_debug(s, REISERFS_DEBUG_CODE,
+			       "reiserquota: allocating %d blocks id=%u",
+			       amount_needed, hint->inode->i_uid);
 #endif
-	quota_ret = DQUOT_ALLOC_BLOCK_NODIRTY(hint->inode, amount_needed);
-	if (quota_ret)    /* Quota exceeded? */
-	    return QUOTA_EXCEEDED;
-	if (hint->preallocate && hint->prealloc_size ) {
+		quota_ret =
+		    DQUOT_ALLOC_BLOCK_NODIRTY(hint->inode, amount_needed);
+		if (quota_ret)	/* Quota exceeded? */
+			return QUOTA_EXCEEDED;
+		if (hint->preallocate && hint->prealloc_size) {
 #ifdef REISERQUOTA_DEBUG
-	    reiserfs_debug (s, REISERFS_DEBUG_CODE, "reiserquota: allocating (prealloc) %d blocks id=%u", hint->prealloc_size, hint->inode->i_uid);
+			reiserfs_debug(s, REISERFS_DEBUG_CODE,
+				       "reiserquota: allocating (prealloc) %d blocks id=%u",
+				       hint->prealloc_size, hint->inode->i_uid);
 #endif
-	    quota_ret = DQUOT_PREALLOC_BLOCK_NODIRTY(hint->inode, hint->prealloc_size);
-	    if (quota_ret)
-		hint->preallocate=hint->prealloc_size=0;
+			quota_ret =
+			    DQUOT_PREALLOC_BLOCK_NODIRTY(hint->inode,
+							 hint->prealloc_size);
+			if (quota_ret)
+				hint->preallocate = hint->prealloc_size = 0;
+		}
+		/* for unformatted nodes, force large allocations */
+		bigalloc = amount_needed;
 	}
-	/* for unformatted nodes, force large allocations */
-	bigalloc = amount_needed;
-    }
 
-    do {
-	/* in bigalloc mode, nr_allocated should stay zero until
-	 * the entire allocation is filled
-	 */
-	if (unlikely(bigalloc && nr_allocated)) {
-	    reiserfs_warning(s, "bigalloc is %d, nr_allocated %d\n",
-	    bigalloc, nr_allocated);
-	    /* reset things to a sane value */
-	    bigalloc = amount_needed - nr_allocated;
-	}
-	/*
-	 * try pass 0 and pass 1 looking for a nice big
-	 * contiguous allocation.  Then reset and look
-	 * for anything you can find.
-	 */
-	if (passno == 2 && bigalloc) {
-	    passno = 0;
-	    bigalloc = 0;
-	}
-	switch (passno++) {
-        case 0: /* Search from hint->search_start to end of disk */
-	    start = hint->search_start;
-	    finish = SB_BLOCK_COUNT(s) - 1;
-	    break;
-        case 1: /* Search from hint->beg to hint->search_start */
-	    start = hint->beg;
-	    finish = hint->search_start;
-	    break;
-	case 2: /* Last chance: Search from 0 to hint->beg */
-	    start = 0;
-	    finish = hint->beg;
-	    break;
-	default: /* We've tried searching everywhere, not enough space */
-	    /* Free the blocks */
-	    if (!hint->formatted_node) {
+	do {
+		/* in bigalloc mode, nr_allocated should stay zero until
+		 * the entire allocation is filled
+		 */
+		if (unlikely(bigalloc && nr_allocated)) {
+			reiserfs_warning(s, "bigalloc is %d, nr_allocated %d\n",
+					 bigalloc, nr_allocated);
+			/* reset things to a sane value */
+			bigalloc = amount_needed - nr_allocated;
+		}
+		/*
+		 * try pass 0 and pass 1 looking for a nice big
+		 * contiguous allocation.  Then reset and look
+		 * for anything you can find.
+		 */
+		if (passno == 2 && bigalloc) {
+			passno = 0;
+			bigalloc = 0;
+		}
+		switch (passno++) {
+		case 0:	/* Search from hint->search_start to end of disk */
+			start = hint->search_start;
+			finish = SB_BLOCK_COUNT(s) - 1;
+			break;
+		case 1:	/* Search from hint->beg to hint->search_start */
+			start = hint->beg;
+			finish = hint->search_start;
+			break;
+		case 2:	/* Last chance: Search from 0 to hint->beg */
+			start = 0;
+			finish = hint->beg;
+			break;
+		default:	/* We've tried searching everywhere, not enough space */
+			/* Free the blocks */
+			if (!hint->formatted_node) {
 #ifdef REISERQUOTA_DEBUG
-		reiserfs_debug (s, REISERFS_DEBUG_CODE, "reiserquota: freeing (nospace) %d blocks id=%u", amount_needed + hint->prealloc_size - nr_allocated, hint->inode->i_uid);
+				reiserfs_debug(s, REISERFS_DEBUG_CODE,
+					       "reiserquota: freeing (nospace) %d blocks id=%u",
+					       amount_needed +
+					       hint->prealloc_size -
+					       nr_allocated,
+					       hint->inode->i_uid);
 #endif
-		DQUOT_FREE_BLOCK_NODIRTY(hint->inode, amount_needed + hint->prealloc_size - nr_allocated);     /* Free not allocated blocks */
-	    }
-  	    while (nr_allocated --)
-		reiserfs_free_block(hint->th, hint->inode, new_blocknrs[nr_allocated], !hint->formatted_node);
-
-	    return NO_DISK_SPACE;
-	}
-    } while ((nr_allocated += allocate_without_wrapping_disk (hint,
-			    new_blocknrs + nr_allocated, start, finish,
-			    bigalloc ? bigalloc : 1,
-			    amount_needed - nr_allocated,
-			    hint->prealloc_size))
-			< amount_needed);
-    if ( !hint->formatted_node &&
-         amount_needed + hint->prealloc_size >
-	 nr_allocated + REISERFS_I(hint->inode)->i_prealloc_count) {
-    /* Some of preallocation blocks were not allocated */
+				DQUOT_FREE_BLOCK_NODIRTY(hint->inode, amount_needed + hint->prealloc_size - nr_allocated);	/* Free not allocated blocks */
+			}
+			while (nr_allocated--)
+				reiserfs_free_block(hint->th, hint->inode,
+						    new_blocknrs[nr_allocated],
+						    !hint->formatted_node);
+
+			return NO_DISK_SPACE;
+		}
+	} while ((nr_allocated += allocate_without_wrapping_disk(hint,
+								 new_blocknrs +
+								 nr_allocated,
+								 start, finish,
+								 bigalloc ?
+								 bigalloc : 1,
+								 amount_needed -
+								 nr_allocated,
+								 hint->
+								 prealloc_size))
+		 < amount_needed);
+	if (!hint->formatted_node &&
+	    amount_needed + hint->prealloc_size >
+	    nr_allocated + REISERFS_I(hint->inode)->i_prealloc_count) {
+		/* Some of preallocation blocks were not allocated */
 #ifdef REISERQUOTA_DEBUG
-	reiserfs_debug (s, REISERFS_DEBUG_CODE, "reiserquota: freeing (failed prealloc) %d blocks id=%u", amount_needed + hint->prealloc_size - nr_allocated - REISERFS_I(hint->inode)->i_prealloc_count, hint->inode->i_uid);
+		reiserfs_debug(s, REISERFS_DEBUG_CODE,
+			       "reiserquota: freeing (failed prealloc) %d blocks id=%u",
+			       amount_needed + hint->prealloc_size -
+			       nr_allocated -
+			       REISERFS_I(hint->inode)->i_prealloc_count,
+			       hint->inode->i_uid);
 #endif
-	DQUOT_FREE_BLOCK_NODIRTY(hint->inode, amount_needed +
-	                         hint->prealloc_size - nr_allocated -
-				 REISERFS_I(hint->inode)->i_prealloc_count);
-    }
+		DQUOT_FREE_BLOCK_NODIRTY(hint->inode, amount_needed +
+					 hint->prealloc_size - nr_allocated -
+					 REISERFS_I(hint->inode)->
+					 i_prealloc_count);
+	}
 
-    return CARRY_ON;
+	return CARRY_ON;
 }
 
 /* grab new blocknrs from preallocated list */
 /* return amount still needed after using them */
-static int use_preallocated_list_if_available (reiserfs_blocknr_hint_t *hint,
-					       b_blocknr_t *new_blocknrs, int amount_needed)
+static int use_preallocated_list_if_available(reiserfs_blocknr_hint_t * hint,
+					      b_blocknr_t * new_blocknrs,
+					      int amount_needed)
 {
-    struct inode * inode = hint->inode;
+	struct inode *inode = hint->inode;
 
-    if (REISERFS_I(inode)->i_prealloc_count > 0) {
-	while (amount_needed) {
+	if (REISERFS_I(inode)->i_prealloc_count > 0) {
+		while (amount_needed) {
 
-	    *new_blocknrs ++ = REISERFS_I(inode)->i_prealloc_block ++;
-	    REISERFS_I(inode)->i_prealloc_count --;
+			*new_blocknrs++ = REISERFS_I(inode)->i_prealloc_block++;
+			REISERFS_I(inode)->i_prealloc_count--;
 
-	    amount_needed --;
+			amount_needed--;
 
-	    if (REISERFS_I(inode)->i_prealloc_count <= 0) {
-		list_del(&REISERFS_I(inode)->i_prealloc_list);  
-		break;
-	    }
+			if (REISERFS_I(inode)->i_prealloc_count <= 0) {
+				list_del(&REISERFS_I(inode)->i_prealloc_list);
+				break;
+			}
+		}
 	}
-      }
-    /* return amount still needed after using preallocated blocks */
-    return amount_needed;
+	/* return amount still needed after using preallocated blocks */
+	return amount_needed;
 }
 
-int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *hint,
-			       b_blocknr_t * new_blocknrs, int amount_needed,
-			       int reserved_by_us /* Amount of blocks we have
-						      already reserved */)
+int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t * hint, b_blocknr_t * new_blocknrs, int amount_needed, int reserved_by_us	/* Amount of blocks we have
+																	   already reserved */ )
 {
-    int initial_amount_needed = amount_needed;
-    int ret;
-    struct super_block *s = hint->th->t_super;
-
-    /* Check if there is enough space, taking into account reserved space */
-    if ( SB_FREE_BLOCKS(s) - REISERFS_SB(s)->reserved_blocks <
-	 amount_needed - reserved_by_us)
-        return NO_DISK_SPACE;
-    /* should this be if !hint->inode &&  hint->preallocate? */
-    /* do you mean hint->formatted_node can be removed ? - Zam */
-    /* hint->formatted_node cannot be removed because we try to access
-       inode information here, and there is often no inode assotiated with
-       metadata allocations - green */
-
-    if (!hint->formatted_node && hint->preallocate) {
-	amount_needed = use_preallocated_list_if_available
+	int initial_amount_needed = amount_needed;
+	int ret;
+	struct super_block *s = hint->th->t_super;
+
+	/* Check if there is enough space, taking into account reserved space */
+	if (SB_FREE_BLOCKS(s) - REISERFS_SB(s)->reserved_blocks <
+	    amount_needed - reserved_by_us)
+		return NO_DISK_SPACE;
+	/* should this be if !hint->inode &&  hint->preallocate? */
+	/* do you mean hint->formatted_node can be removed ? - Zam */
+	/* hint->formatted_node cannot be removed because we try to access
+	   inode information here, and there is often no inode assotiated with
+	   metadata allocations - green */
+
+	if (!hint->formatted_node && hint->preallocate) {
+		amount_needed = use_preallocated_list_if_available
+		    (hint, new_blocknrs, amount_needed);
+		if (amount_needed == 0)	/* all blocknrs we need we got from
+					   prealloc. list */
+			return CARRY_ON;
+		new_blocknrs += (initial_amount_needed - amount_needed);
+	}
+
+	/* find search start and save it in hint structure */
+	determine_search_start(hint, amount_needed);
+	if (hint->search_start >= SB_BLOCK_COUNT(s))
+		hint->search_start = SB_BLOCK_COUNT(s) - 1;
+
+	/* allocation itself; fill new_blocknrs and preallocation arrays */
+	ret = blocknrs_and_prealloc_arrays_from_search_start
 	    (hint, new_blocknrs, amount_needed);
-	if (amount_needed == 0)	/* all blocknrs we need we got from
-                                   prealloc. list */
-	    return CARRY_ON;
-	new_blocknrs += (initial_amount_needed - amount_needed);
-    }
-
-    /* find search start and save it in hint structure */
-    determine_search_start(hint, amount_needed);
-    if (hint->search_start >= SB_BLOCK_COUNT(s))
-        hint->search_start = SB_BLOCK_COUNT(s) - 1;
-
-    /* allocation itself; fill new_blocknrs and preallocation arrays */
-    ret = blocknrs_and_prealloc_arrays_from_search_start
-	(hint, new_blocknrs, amount_needed);
-
-    /* we used prealloc. list to fill (partially) new_blocknrs array. If final allocation fails we
-     * need to return blocks back to prealloc. list or just free them. -- Zam (I chose second
-     * variant) */
-
-    if (ret != CARRY_ON) {
-	while (amount_needed ++ < initial_amount_needed) {
-	    reiserfs_free_block(hint->th, hint->inode, *(--new_blocknrs), 1);
+
+	/* we used prealloc. list to fill (partially) new_blocknrs array. If final allocation fails we
+	 * need to return blocks back to prealloc. list or just free them. -- Zam (I chose second
+	 * variant) */
+
+	if (ret != CARRY_ON) {
+		while (amount_needed++ < initial_amount_needed) {
+			reiserfs_free_block(hint->th, hint->inode,
+					    *(--new_blocknrs), 1);
+		}
 	}
-    }
-    return ret;
+	return ret;
 }
 
 /* These 2 functions are here to provide blocks reservation to the rest of kernel */
 /* Reserve @blocks amount of blocks in fs pointed by @sb. Caller must make sure
    there are actually this much blocks on the FS available */
-void reiserfs_claim_blocks_to_be_allocated( 
-				      struct super_block *sb, /* super block of
-							        filesystem where
-								blocks should be
-								reserved */
-				      int blocks /* How much to reserve */
-					  )
+void reiserfs_claim_blocks_to_be_allocated(struct super_block *sb,	/* super block of
+									   filesystem where
+									   blocks should be
+									   reserved */
+					   int blocks	/* How much to reserve */
+    )
 {
 
-    /* Fast case, if reservation is zero - exit immediately. */
-    if ( !blocks )
-	return;
+	/* Fast case, if reservation is zero - exit immediately. */
+	if (!blocks)
+		return;
 
-    spin_lock(&REISERFS_SB(sb)->bitmap_lock);
-    REISERFS_SB(sb)->reserved_blocks += blocks;
-    spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
+	spin_lock(&REISERFS_SB(sb)->bitmap_lock);
+	REISERFS_SB(sb)->reserved_blocks += blocks;
+	spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
 }
 
 /* Unreserve @blocks amount of blocks in fs pointed by @sb */
-void reiserfs_release_claimed_blocks( 
-				struct super_block *sb, /* super block of
-							  filesystem where
-							  blocks should be
-							  reserved */
-				int blocks /* How much to unreserve */
-					  )
+void reiserfs_release_claimed_blocks(struct super_block *sb,	/* super block of
+								   filesystem where
+								   blocks should be
+								   reserved */
+				     int blocks	/* How much to unreserve */
+    )
 {
 
-    /* Fast case, if unreservation is zero - exit immediately. */
-    if ( !blocks )
-	return;
+	/* Fast case, if unreservation is zero - exit immediately. */
+	if (!blocks)
+		return;
 
-    spin_lock(&REISERFS_SB(sb)->bitmap_lock);
-    REISERFS_SB(sb)->reserved_blocks -= blocks;
-    spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
-    RFALSE( REISERFS_SB(sb)->reserved_blocks < 0, "amount of blocks reserved became zero?");
+	spin_lock(&REISERFS_SB(sb)->bitmap_lock);
+	REISERFS_SB(sb)->reserved_blocks -= blocks;
+	spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
+	RFALSE(REISERFS_SB(sb)->reserved_blocks < 0,
+	       "amount of blocks reserved became zero?");
 }
 
 /* This function estimates how much pages we will be able to write to FS
    used for reiserfs_file_write() purposes for now. */
-int reiserfs_can_fit_pages ( struct super_block *sb /* superblock of filesystem
-						       to estimate space */ )
+int reiserfs_can_fit_pages(struct super_block *sb	/* superblock of filesystem
+							   to estimate space */ )
 {
 	int space;
 
 	spin_lock(&REISERFS_SB(sb)->bitmap_lock);
-	space = (SB_FREE_BLOCKS(sb) - REISERFS_SB(sb)->reserved_blocks) >> ( PAGE_CACHE_SHIFT - sb->s_blocksize_bits);
+	space =
+	    (SB_FREE_BLOCKS(sb) -
+	     REISERFS_SB(sb)->reserved_blocks) >> (PAGE_CACHE_SHIFT -
+						   sb->s_blocksize_bits);
 	spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
 
-	return space>0?space:0;
+	return space > 0 ? space : 0;
 }

+ 255 - 233
fs/reiserfs/dir.c

@@ -12,264 +12,286 @@
 #include <linux/buffer_head.h>
 #include <asm/uaccess.h>
 
-extern struct reiserfs_key  MIN_KEY;
+extern struct reiserfs_key MIN_KEY;
 
-static int reiserfs_readdir (struct file *, void *, filldir_t);
-static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) ;
+static int reiserfs_readdir(struct file *, void *, filldir_t);
+static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
+			      int datasync);
 
 struct file_operations reiserfs_dir_operations = {
-    .read	= generic_read_dir,
-    .readdir	= reiserfs_readdir,
-    .fsync	= reiserfs_dir_fsync,
-    .ioctl	= reiserfs_ioctl,
+	.read = generic_read_dir,
+	.readdir = reiserfs_readdir,
+	.fsync = reiserfs_dir_fsync,
+	.ioctl = reiserfs_ioctl,
 };
 
-static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) {
-  struct inode *inode = dentry->d_inode;
-  int err;
-  reiserfs_write_lock(inode->i_sb);
-  err = reiserfs_commit_for_inode(inode) ;
-  reiserfs_write_unlock(inode->i_sb) ;
-  if (err < 0)
-      return err;
-  return 0;
+static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
+			      int datasync)
+{
+	struct inode *inode = dentry->d_inode;
+	int err;
+	reiserfs_write_lock(inode->i_sb);
+	err = reiserfs_commit_for_inode(inode);
+	reiserfs_write_unlock(inode->i_sb);
+	if (err < 0)
+		return err;
+	return 0;
 }
 
-
 #define store_ih(where,what) copy_item_head (where, what)
 
 //
-static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldir)
+static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 {
-    struct inode *inode = filp->f_dentry->d_inode;
-    struct cpu_key pos_key;	/* key of current position in the directory (key of directory entry) */
-    INITIALIZE_PATH (path_to_entry);
-    struct buffer_head * bh;
-    int item_num, entry_num;
-    const struct reiserfs_key * rkey;
-    struct item_head * ih, tmp_ih;
-    int search_res;
-    char * local_buf;
-    loff_t next_pos;
-    char small_buf[32] ; /* avoid kmalloc if we can */
-    struct reiserfs_dir_entry de;
-    int ret = 0;
-
-    reiserfs_write_lock(inode->i_sb);
-
-    reiserfs_check_lock_depth(inode->i_sb, "readdir") ;
-
-    /* form key for search the next directory entry using f_pos field of
-       file structure */
-    make_cpu_key (&pos_key, inode, (filp->f_pos) ? (filp->f_pos) : DOT_OFFSET,
-		  TYPE_DIRENTRY, 3);
-    next_pos = cpu_key_k_offset (&pos_key);
-
-    /*  reiserfs_warning (inode->i_sb, "reiserfs_readdir 1: f_pos = %Ld", filp->f_pos);*/
-
-    path_to_entry.reada = PATH_READA;
-    while (1) {
-    research:
-	/* search the directory item, containing entry with specified key */
-	search_res = search_by_entry_key (inode->i_sb, &pos_key, &path_to_entry, &de);
-	if (search_res == IO_ERROR) {
-	    // FIXME: we could just skip part of directory which could
-	    // not be read
-	    ret = -EIO;
-	    goto out;
-	}
-	entry_num = de.de_entry_num;
-	bh = de.de_bh;
-	item_num = de.de_item_num;
-	ih = de.de_ih;
-	store_ih (&tmp_ih, ih);
-		
-	/* we must have found item, that is item of this directory, */
-	RFALSE( COMP_SHORT_KEYS (&(ih->ih_key), &pos_key),
-		"vs-9000: found item %h does not match to dir we readdir %K",
-		ih, &pos_key);
-	RFALSE( item_num > B_NR_ITEMS (bh) - 1,
-		"vs-9005 item_num == %d, item amount == %d", 
-		item_num, B_NR_ITEMS (bh));
-      
-	/* and entry must be not more than number of entries in the item */
-	RFALSE( I_ENTRY_COUNT (ih) < entry_num,
-		"vs-9010: entry number is too big %d (%d)", 
-		entry_num, I_ENTRY_COUNT (ih));
-
-	if (search_res == POSITION_FOUND || entry_num < I_ENTRY_COUNT (ih)) {
-	    /* go through all entries in the directory item beginning from the entry, that has been found */
-	    struct reiserfs_de_head * deh = B_I_DEH (bh, ih) + entry_num;
-
-	    for (; entry_num < I_ENTRY_COUNT (ih); entry_num ++, deh ++) {
-		int d_reclen;
-		char * d_name;
-		off_t d_off;
-		ino_t d_ino;
-
-		if (!de_visible (deh))
-		    /* it is hidden entry */
-		    continue;
-		d_reclen = entry_length (bh, ih, entry_num);
-		d_name = B_I_DEH_ENTRY_FILE_NAME (bh, ih, deh);
-		if (!d_name[d_reclen - 1])
-		    d_reclen = strlen (d_name);
-	
-		if (d_reclen > REISERFS_MAX_NAME(inode->i_sb->s_blocksize)){
-		    /* too big to send back to VFS */
-		    continue ;
-		}
-
-                /* Ignore the .reiserfs_priv entry */
-                if (reiserfs_xattrs (inode->i_sb) &&
-                    !old_format_only(inode->i_sb) &&
-                    filp->f_dentry == inode->i_sb->s_root &&
-                    REISERFS_SB(inode->i_sb)->priv_root &&
-                    REISERFS_SB(inode->i_sb)->priv_root->d_inode &&
-                    deh_objectid(deh) == le32_to_cpu (INODE_PKEY(REISERFS_SB(inode->i_sb)->priv_root->d_inode)->k_objectid)) {
-                  continue;
-                }
-
-		d_off = deh_offset (deh);
-		filp->f_pos = d_off ;
-		d_ino = deh_objectid (deh);
-		if (d_reclen <= 32) {
-		  local_buf = small_buf ;
-		} else {
-		    local_buf = reiserfs_kmalloc(d_reclen, GFP_NOFS, inode->i_sb) ;
-		    if (!local_buf) {
-			pathrelse (&path_to_entry);
-			ret = -ENOMEM ;
+	struct inode *inode = filp->f_dentry->d_inode;
+	struct cpu_key pos_key;	/* key of current position in the directory (key of directory entry) */
+	INITIALIZE_PATH(path_to_entry);
+	struct buffer_head *bh;
+	int item_num, entry_num;
+	const struct reiserfs_key *rkey;
+	struct item_head *ih, tmp_ih;
+	int search_res;
+	char *local_buf;
+	loff_t next_pos;
+	char small_buf[32];	/* avoid kmalloc if we can */
+	struct reiserfs_dir_entry de;
+	int ret = 0;
+
+	reiserfs_write_lock(inode->i_sb);
+
+	reiserfs_check_lock_depth(inode->i_sb, "readdir");
+
+	/* form key for search the next directory entry using f_pos field of
+	   file structure */
+	make_cpu_key(&pos_key, inode,
+		     (filp->f_pos) ? (filp->f_pos) : DOT_OFFSET, TYPE_DIRENTRY,
+		     3);
+	next_pos = cpu_key_k_offset(&pos_key);
+
+	/*  reiserfs_warning (inode->i_sb, "reiserfs_readdir 1: f_pos = %Ld", filp->f_pos); */
+
+	path_to_entry.reada = PATH_READA;
+	while (1) {
+	      research:
+		/* search the directory item, containing entry with specified key */
+		search_res =
+		    search_by_entry_key(inode->i_sb, &pos_key, &path_to_entry,
+					&de);
+		if (search_res == IO_ERROR) {
+			// FIXME: we could just skip part of directory which could
+			// not be read
+			ret = -EIO;
 			goto out;
-		    }
-		    if (item_moved (&tmp_ih, &path_to_entry)) {
-			reiserfs_kfree(local_buf, d_reclen, inode->i_sb) ;
-			goto research;
-		    }
-		}
-		// Note, that we copy name to user space via temporary
-		// buffer (local_buf) because filldir will block if
-		// user space buffer is swapped out. At that time
-		// entry can move to somewhere else
-		memcpy (local_buf, d_name, d_reclen);
-		if (filldir (dirent, local_buf, d_reclen, d_off, d_ino, 
-		             DT_UNKNOWN) < 0) {
-		    if (local_buf != small_buf) {
-			reiserfs_kfree(local_buf, d_reclen, inode->i_sb) ;
-		    }
-		    goto end;
 		}
-		if (local_buf != small_buf) {
-		    reiserfs_kfree(local_buf, d_reclen, inode->i_sb) ;
+		entry_num = de.de_entry_num;
+		bh = de.de_bh;
+		item_num = de.de_item_num;
+		ih = de.de_ih;
+		store_ih(&tmp_ih, ih);
+
+		/* we must have found item, that is item of this directory, */
+		RFALSE(COMP_SHORT_KEYS(&(ih->ih_key), &pos_key),
+		       "vs-9000: found item %h does not match to dir we readdir %K",
+		       ih, &pos_key);
+		RFALSE(item_num > B_NR_ITEMS(bh) - 1,
+		       "vs-9005 item_num == %d, item amount == %d",
+		       item_num, B_NR_ITEMS(bh));
+
+		/* and entry must be not more than number of entries in the item */
+		RFALSE(I_ENTRY_COUNT(ih) < entry_num,
+		       "vs-9010: entry number is too big %d (%d)",
+		       entry_num, I_ENTRY_COUNT(ih));
+
+		if (search_res == POSITION_FOUND
+		    || entry_num < I_ENTRY_COUNT(ih)) {
+			/* go through all entries in the directory item beginning from the entry, that has been found */
+			struct reiserfs_de_head *deh =
+			    B_I_DEH(bh, ih) + entry_num;
+
+			for (; entry_num < I_ENTRY_COUNT(ih);
+			     entry_num++, deh++) {
+				int d_reclen;
+				char *d_name;
+				off_t d_off;
+				ino_t d_ino;
+
+				if (!de_visible(deh))
+					/* it is hidden entry */
+					continue;
+				d_reclen = entry_length(bh, ih, entry_num);
+				d_name = B_I_DEH_ENTRY_FILE_NAME(bh, ih, deh);
+				if (!d_name[d_reclen - 1])
+					d_reclen = strlen(d_name);
+
+				if (d_reclen >
+				    REISERFS_MAX_NAME(inode->i_sb->
+						      s_blocksize)) {
+					/* too big to send back to VFS */
+					continue;
+				}
+
+				/* Ignore the .reiserfs_priv entry */
+				if (reiserfs_xattrs(inode->i_sb) &&
+				    !old_format_only(inode->i_sb) &&
+				    filp->f_dentry == inode->i_sb->s_root &&
+				    REISERFS_SB(inode->i_sb)->priv_root &&
+				    REISERFS_SB(inode->i_sb)->priv_root->d_inode
+				    && deh_objectid(deh) ==
+				    le32_to_cpu(INODE_PKEY
+						(REISERFS_SB(inode->i_sb)->
+						 priv_root->d_inode)->
+						k_objectid)) {
+					continue;
+				}
+
+				d_off = deh_offset(deh);
+				filp->f_pos = d_off;
+				d_ino = deh_objectid(deh);
+				if (d_reclen <= 32) {
+					local_buf = small_buf;
+				} else {
+					local_buf =
+					    reiserfs_kmalloc(d_reclen, GFP_NOFS,
+							     inode->i_sb);
+					if (!local_buf) {
+						pathrelse(&path_to_entry);
+						ret = -ENOMEM;
+						goto out;
+					}
+					if (item_moved(&tmp_ih, &path_to_entry)) {
+						reiserfs_kfree(local_buf,
+							       d_reclen,
+							       inode->i_sb);
+						goto research;
+					}
+				}
+				// Note, that we copy name to user space via temporary
+				// buffer (local_buf) because filldir will block if
+				// user space buffer is swapped out. At that time
+				// entry can move to somewhere else
+				memcpy(local_buf, d_name, d_reclen);
+				if (filldir
+				    (dirent, local_buf, d_reclen, d_off, d_ino,
+				     DT_UNKNOWN) < 0) {
+					if (local_buf != small_buf) {
+						reiserfs_kfree(local_buf,
+							       d_reclen,
+							       inode->i_sb);
+					}
+					goto end;
+				}
+				if (local_buf != small_buf) {
+					reiserfs_kfree(local_buf, d_reclen,
+						       inode->i_sb);
+				}
+				// next entry should be looked for with such offset
+				next_pos = deh_offset(deh) + 1;
+
+				if (item_moved(&tmp_ih, &path_to_entry)) {
+					goto research;
+				}
+			}	/* for */
 		}
 
-		// next entry should be looked for with such offset
-		next_pos = deh_offset (deh) + 1;
+		if (item_num != B_NR_ITEMS(bh) - 1)
+			// end of directory has been reached
+			goto end;
+
+		/* item we went through is last item of node. Using right
+		   delimiting key check is it directory end */
+		rkey = get_rkey(&path_to_entry, inode->i_sb);
+		if (!comp_le_keys(rkey, &MIN_KEY)) {
+			/* set pos_key to key, that is the smallest and greater
+			   that key of the last entry in the item */
+			set_cpu_key_k_offset(&pos_key, next_pos);
+			continue;
+		}
 
-		if (item_moved (&tmp_ih, &path_to_entry)) {
-		    goto research;
+		if (COMP_SHORT_KEYS(rkey, &pos_key)) {
+			// end of directory has been reached
+			goto end;
 		}
-	    } /* for */
-	}
-
-	if (item_num != B_NR_ITEMS (bh) - 1)
-	    // end of directory has been reached
-	    goto end;
-
-	/* item we went through is last item of node. Using right
-	   delimiting key check is it directory end */
-	rkey = get_rkey (&path_to_entry, inode->i_sb);
-	if (! comp_le_keys (rkey, &MIN_KEY)) {
-	    /* set pos_key to key, that is the smallest and greater
-	       that key of the last entry in the item */
-	    set_cpu_key_k_offset (&pos_key, next_pos);
-	    continue;
-	}
-
-	if ( COMP_SHORT_KEYS (rkey, &pos_key)) {
-	    // end of directory has been reached
-	    goto end;
-	}
-	
-	/* directory continues in the right neighboring block */
-	set_cpu_key_k_offset (&pos_key, le_key_k_offset (KEY_FORMAT_3_5, rkey));
-
-    } /* while */
-
-
- end:
-    filp->f_pos = next_pos;
-    pathrelse (&path_to_entry);
-    reiserfs_check_path(&path_to_entry) ;
- out:
-    reiserfs_write_unlock(inode->i_sb);
-    return ret;
+
+		/* directory continues in the right neighboring block */
+		set_cpu_key_k_offset(&pos_key,
+				     le_key_k_offset(KEY_FORMAT_3_5, rkey));
+
+	}			/* while */
+
+      end:
+	filp->f_pos = next_pos;
+	pathrelse(&path_to_entry);
+	reiserfs_check_path(&path_to_entry);
+      out:
+	reiserfs_write_unlock(inode->i_sb);
+	return ret;
 }
 
 /* compose directory item containing "." and ".." entries (entries are
    not aligned to 4 byte boundary) */
 /* the last four params are LE */
-void make_empty_dir_item_v1 (char * body, __le32 dirid, __le32 objid,
-			     __le32 par_dirid, __le32 par_objid)
+void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid,
+			    __le32 par_dirid, __le32 par_objid)
 {
-    struct reiserfs_de_head * deh;
-
-    memset (body, 0, EMPTY_DIR_SIZE_V1);
-    deh = (struct reiserfs_de_head *)body;
-    
-    /* direntry header of "." */
-    put_deh_offset( &(deh[0]), DOT_OFFSET );
-    /* these two are from make_le_item_head, and are are LE */
-    deh[0].deh_dir_id = dirid;
-    deh[0].deh_objectid = objid;
-    deh[0].deh_state = 0; /* Endian safe if 0 */
-    put_deh_location( &(deh[0]), EMPTY_DIR_SIZE_V1 - strlen( "." ));
-    mark_de_visible(&(deh[0]));
-  
-    /* direntry header of ".." */
-    put_deh_offset( &(deh[1]), DOT_DOT_OFFSET);
-    /* key of ".." for the root directory */
-    /* these two are from the inode, and are are LE */
-    deh[1].deh_dir_id = par_dirid;
-    deh[1].deh_objectid = par_objid;
-    deh[1].deh_state = 0; /* Endian safe if 0 */
-    put_deh_location( &(deh[1]), deh_location( &(deh[0]) ) - strlen( ".." ) );
-    mark_de_visible(&(deh[1]));
-
-    /* copy ".." and "." */
-    memcpy (body + deh_location( &(deh[0]) ), ".", 1);
-    memcpy (body + deh_location( &(deh[1]) ), "..", 2);
+	struct reiserfs_de_head *deh;
+
+	memset(body, 0, EMPTY_DIR_SIZE_V1);
+	deh = (struct reiserfs_de_head *)body;
+
+	/* direntry header of "." */
+	put_deh_offset(&(deh[0]), DOT_OFFSET);
+	/* these two are from make_le_item_head, and are are LE */
+	deh[0].deh_dir_id = dirid;
+	deh[0].deh_objectid = objid;
+	deh[0].deh_state = 0;	/* Endian safe if 0 */
+	put_deh_location(&(deh[0]), EMPTY_DIR_SIZE_V1 - strlen("."));
+	mark_de_visible(&(deh[0]));
+
+	/* direntry header of ".." */
+	put_deh_offset(&(deh[1]), DOT_DOT_OFFSET);
+	/* key of ".." for the root directory */
+	/* these two are from the inode, and are are LE */
+	deh[1].deh_dir_id = par_dirid;
+	deh[1].deh_objectid = par_objid;
+	deh[1].deh_state = 0;	/* Endian safe if 0 */
+	put_deh_location(&(deh[1]), deh_location(&(deh[0])) - strlen(".."));
+	mark_de_visible(&(deh[1]));
+
+	/* copy ".." and "." */
+	memcpy(body + deh_location(&(deh[0])), ".", 1);
+	memcpy(body + deh_location(&(deh[1])), "..", 2);
 }
 
 /* compose directory item containing "." and ".." entries */
-void make_empty_dir_item (char * body, __le32 dirid, __le32 objid,
-			  __le32 par_dirid, __le32 par_objid)
+void make_empty_dir_item(char *body, __le32 dirid, __le32 objid,
+			 __le32 par_dirid, __le32 par_objid)
 {
-    struct reiserfs_de_head * deh;
-
-    memset (body, 0, EMPTY_DIR_SIZE);
-    deh = (struct reiserfs_de_head *)body;
-    
-    /* direntry header of "." */
-    put_deh_offset( &(deh[0]), DOT_OFFSET );
-    /* these two are from make_le_item_head, and are are LE */
-    deh[0].deh_dir_id = dirid;
-    deh[0].deh_objectid = objid;
-    deh[0].deh_state = 0; /* Endian safe if 0 */
-    put_deh_location( &(deh[0]), EMPTY_DIR_SIZE - ROUND_UP( strlen( "." ) ) );
-    mark_de_visible(&(deh[0]));
-  
-    /* direntry header of ".." */
-    put_deh_offset( &(deh[1]), DOT_DOT_OFFSET );
-    /* key of ".." for the root directory */
-    /* these two are from the inode, and are are LE */
-    deh[1].deh_dir_id = par_dirid;
-    deh[1].deh_objectid = par_objid;
-    deh[1].deh_state = 0; /* Endian safe if 0 */
-    put_deh_location( &(deh[1]), deh_location( &(deh[0])) - ROUND_UP( strlen( ".." ) ) );
-    mark_de_visible(&(deh[1]));
-
-    /* copy ".." and "." */
-    memcpy (body + deh_location( &(deh[0]) ), ".", 1);
-    memcpy (body + deh_location( &(deh[1]) ), "..", 2);
+	struct reiserfs_de_head *deh;
+
+	memset(body, 0, EMPTY_DIR_SIZE);
+	deh = (struct reiserfs_de_head *)body;
+
+	/* direntry header of "." */
+	put_deh_offset(&(deh[0]), DOT_OFFSET);
+	/* these two are from make_le_item_head, and are are LE */
+	deh[0].deh_dir_id = dirid;
+	deh[0].deh_objectid = objid;
+	deh[0].deh_state = 0;	/* Endian safe if 0 */
+	put_deh_location(&(deh[0]), EMPTY_DIR_SIZE - ROUND_UP(strlen(".")));
+	mark_de_visible(&(deh[0]));
+
+	/* direntry header of ".." */
+	put_deh_offset(&(deh[1]), DOT_DOT_OFFSET);
+	/* key of ".." for the root directory */
+	/* these two are from the inode, and are are LE */
+	deh[1].deh_dir_id = par_dirid;
+	deh[1].deh_objectid = par_objid;
+	deh[1].deh_state = 0;	/* Endian safe if 0 */
+	put_deh_location(&(deh[1]),
+			 deh_location(&(deh[0])) - ROUND_UP(strlen("..")));
+	mark_de_visible(&(deh[1]));
+
+	/* copy ".." and "." */
+	memcpy(body + deh_location(&(deh[0])), ".", 1);
+	memcpy(body + deh_location(&(deh[1])), "..", 2);
 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1811 - 1266
fs/reiserfs/do_balan.c


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 819 - 723
fs/reiserfs/file.c


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 566 - 537
fs/reiserfs/fix_node.c


+ 83 - 110
fs/reiserfs/hashes.c

@@ -22,7 +22,6 @@
 #include <asm/types.h>
 #include <asm/bug.h>
 
-
 #define DELTA 0x9E3779B9
 #define FULLROUNDS 10		/* 32 is overkill, 16 is strong crypto */
 #define PARTROUNDS 6		/* 6 gets complete mixing */
@@ -48,105 +47,75 @@
 		h1 += b1;						\
 	} while(0)
 
-
 u32 keyed_hash(const signed char *msg, int len)
 {
-	u32 k[] = { 0x9464a485, 0x542e1a94, 0x3e846bff, 0xb75bcfc3}; 
+	u32 k[] = { 0x9464a485, 0x542e1a94, 0x3e846bff, 0xb75bcfc3 };
 
 	u32 h0 = k[0], h1 = k[1];
 	u32 a, b, c, d;
 	u32 pad;
 	int i;
- 
-	//	assert(len >= 0 && len < 256);
 
-	pad = (u32)len | ((u32)len << 8);
+	//      assert(len >= 0 && len < 256);
+
+	pad = (u32) len | ((u32) len << 8);
 	pad |= pad << 16;
 
-	while(len >= 16)
-	{
-		a = (u32)msg[ 0]      |
-		    (u32)msg[ 1] << 8 |
-		    (u32)msg[ 2] << 16|
-		    (u32)msg[ 3] << 24;
-		b = (u32)msg[ 4]      |
-		    (u32)msg[ 5] << 8 |
-		    (u32)msg[ 6] << 16|
-		    (u32)msg[ 7] << 24;
-		c = (u32)msg[ 8]      |
-		    (u32)msg[ 9] << 8 |
-		    (u32)msg[10] << 16|
-		    (u32)msg[11] << 24;
-		d = (u32)msg[12]      |
-		    (u32)msg[13] << 8 |
-		    (u32)msg[14] << 16|
-		    (u32)msg[15] << 24;
-		
+	while (len >= 16) {
+		a = (u32) msg[0] |
+		    (u32) msg[1] << 8 | (u32) msg[2] << 16 | (u32) msg[3] << 24;
+		b = (u32) msg[4] |
+		    (u32) msg[5] << 8 | (u32) msg[6] << 16 | (u32) msg[7] << 24;
+		c = (u32) msg[8] |
+		    (u32) msg[9] << 8 |
+		    (u32) msg[10] << 16 | (u32) msg[11] << 24;
+		d = (u32) msg[12] |
+		    (u32) msg[13] << 8 |
+		    (u32) msg[14] << 16 | (u32) msg[15] << 24;
+
 		TEACORE(PARTROUNDS);
 
 		len -= 16;
 		msg += 16;
 	}
 
-	if (len >= 12)
-	{
-		a = (u32)msg[ 0]      |
-		    (u32)msg[ 1] << 8 |
-		    (u32)msg[ 2] << 16|
-		    (u32)msg[ 3] << 24;
-		b = (u32)msg[ 4]      |
-		    (u32)msg[ 5] << 8 |
-		    (u32)msg[ 6] << 16|
-		    (u32)msg[ 7] << 24;
-		c = (u32)msg[ 8]      |
-		    (u32)msg[ 9] << 8 |
-		    (u32)msg[10] << 16|
-		    (u32)msg[11] << 24;
+	if (len >= 12) {
+		a = (u32) msg[0] |
+		    (u32) msg[1] << 8 | (u32) msg[2] << 16 | (u32) msg[3] << 24;
+		b = (u32) msg[4] |
+		    (u32) msg[5] << 8 | (u32) msg[6] << 16 | (u32) msg[7] << 24;
+		c = (u32) msg[8] |
+		    (u32) msg[9] << 8 |
+		    (u32) msg[10] << 16 | (u32) msg[11] << 24;
 
 		d = pad;
-		for(i = 12; i < len; i++)
-		{
+		for (i = 12; i < len; i++) {
 			d <<= 8;
 			d |= msg[i];
 		}
-	}
-	else if (len >= 8)
-	{
-		a = (u32)msg[ 0]      |
-		    (u32)msg[ 1] << 8 |
-		    (u32)msg[ 2] << 16|
-		    (u32)msg[ 3] << 24;
-		b = (u32)msg[ 4]      |
-		    (u32)msg[ 5] << 8 |
-		    (u32)msg[ 6] << 16|
-		    (u32)msg[ 7] << 24;
+	} else if (len >= 8) {
+		a = (u32) msg[0] |
+		    (u32) msg[1] << 8 | (u32) msg[2] << 16 | (u32) msg[3] << 24;
+		b = (u32) msg[4] |
+		    (u32) msg[5] << 8 | (u32) msg[6] << 16 | (u32) msg[7] << 24;
 
 		c = d = pad;
-		for(i = 8; i < len; i++)
-		{
+		for (i = 8; i < len; i++) {
 			c <<= 8;
 			c |= msg[i];
 		}
-	}
-	else if (len >= 4)
-	{
-		a = (u32)msg[ 0]      |
-		    (u32)msg[ 1] << 8 |
-		    (u32)msg[ 2] << 16|
-		    (u32)msg[ 3] << 24;
+	} else if (len >= 4) {
+		a = (u32) msg[0] |
+		    (u32) msg[1] << 8 | (u32) msg[2] << 16 | (u32) msg[3] << 24;
 
 		b = c = d = pad;
-		for(i = 4; i < len; i++)
-		{
+		for (i = 4; i < len; i++) {
 			b <<= 8;
 			b |= msg[i];
 		}
-	}
-	else
-	{
+	} else {
 		a = b = c = d = pad;
-		for(i = 0; i < len; i++)
-		{
+		for (i = 0; i < len; i++) {
 			a <<= 8;
 			a |= msg[i];
 		}
@@ -155,55 +124,59 @@ u32 keyed_hash(const signed char *msg, int len)
 	TEACORE(FULLROUNDS);
 
 /*	return 0;*/
-	return h0^h1;
+	return h0 ^ h1;
 }
 
 /* What follows in this file is copyright 2000 by Hans Reiser, and the
  * licensing of what follows is governed by reiserfs/README */
 
-u32 yura_hash (const signed char *msg, int len)
+u32 yura_hash(const signed char *msg, int len)
 {
-    int j, pow;
-    u32 a, c;
-    int i;
-    
-    for (pow=1,i=1; i < len; i++) pow = pow * 10; 
-    
-    if (len == 1) 
-	a = msg[0]-48;
-    else
-	a = (msg[0] - 48) * pow;
-    
-    for (i=1; i < len; i++) {
-	c = msg[i] - 48; 
-	for (pow=1,j=i; j < len-1; j++) pow = pow * 10; 
-	a = a + c * pow;
-    }
-    
-    for (; i < 40; i++) {
-	c = '0' - 48; 
-	for (pow=1,j=i; j < len-1; j++) pow = pow * 10; 
-	a = a + c * pow;
-    }
-    
-    for (; i < 256; i++) {
-	c = i; 
-	for (pow=1,j=i; j < len-1; j++) pow = pow * 10; 
-	a = a + c * pow;
-    }
-    
-    a = a << 7;
-    return a;
+	int j, pow;
+	u32 a, c;
+	int i;
+
+	for (pow = 1, i = 1; i < len; i++)
+		pow = pow * 10;
+
+	if (len == 1)
+		a = msg[0] - 48;
+	else
+		a = (msg[0] - 48) * pow;
+
+	for (i = 1; i < len; i++) {
+		c = msg[i] - 48;
+		for (pow = 1, j = i; j < len - 1; j++)
+			pow = pow * 10;
+		a = a + c * pow;
+	}
+
+	for (; i < 40; i++) {
+		c = '0' - 48;
+		for (pow = 1, j = i; j < len - 1; j++)
+			pow = pow * 10;
+		a = a + c * pow;
+	}
+
+	for (; i < 256; i++) {
+		c = i;
+		for (pow = 1, j = i; j < len - 1; j++)
+			pow = pow * 10;
+		a = a + c * pow;
+	}
+
+	a = a << 7;
+	return a;
 }
 
-u32 r5_hash (const signed char *msg, int len)
+u32 r5_hash(const signed char *msg, int len)
 {
-  u32 a=0;
-  while(*msg) { 
-    a += *msg << 4;
-    a += *msg >> 4;
-    a *= 11;
-    msg++;
-   } 
-  return a;
+	u32 a = 0;
+	while (*msg) {
+		a += *msg << 4;
+		a += *msg >> 4;
+		a *= 11;
+		msg++;
+	}
+	return a;
 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 463 - 459
fs/reiserfs/ibalance.c


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 865 - 803
fs/reiserfs/inode.c


+ 101 - 96
fs/reiserfs/ioctl.c

@@ -9,7 +9,7 @@
 #include <linux/pagemap.h>
 #include <linux/smp_lock.h>
 
-static int reiserfs_unpack (struct inode * inode, struct file * filp);
+static int reiserfs_unpack(struct inode *inode, struct file *filp);
 
 /*
 ** reiserfs_ioctl - handler for ioctl for inode
@@ -19,69 +19,72 @@ static int reiserfs_unpack (struct inode * inode, struct file * filp);
 **  2) REISERFS_IOC_[GS]ETFLAGS, REISERFS_IOC_[GS]ETVERSION
 **  3) That's all for a while ...
 */
-int reiserfs_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
-		unsigned long arg)
+int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
+		   unsigned long arg)
 {
 	unsigned int flags;
 
 	switch (cmd) {
-	    case REISERFS_IOC_UNPACK:
-		if( S_ISREG( inode -> i_mode ) ) {
-		if (arg)
-		    return reiserfs_unpack (inode, filp);
+	case REISERFS_IOC_UNPACK:
+		if (S_ISREG(inode->i_mode)) {
+			if (arg)
+				return reiserfs_unpack(inode, filp);
 			else
 				return 0;
 		} else
 			return -ENOTTY;
-	/* following two cases are taken from fs/ext2/ioctl.c by Remy
-	   Card (card@masi.ibp.fr) */
+		/* following two cases are taken from fs/ext2/ioctl.c by Remy
+		   Card (card@masi.ibp.fr) */
 	case REISERFS_IOC_GETFLAGS:
-		if (!reiserfs_attrs (inode->i_sb))
+		if (!reiserfs_attrs(inode->i_sb))
 			return -ENOTTY;
 
-		flags = REISERFS_I(inode) -> i_attrs;
-		i_attrs_to_sd_attrs( inode, ( __u16 * ) &flags );
-		return put_user(flags, (int __user *) arg);
-	case REISERFS_IOC_SETFLAGS: {
-		if (!reiserfs_attrs (inode->i_sb))
-			return -ENOTTY;
+		flags = REISERFS_I(inode)->i_attrs;
+		i_attrs_to_sd_attrs(inode, (__u16 *) & flags);
+		return put_user(flags, (int __user *)arg);
+	case REISERFS_IOC_SETFLAGS:{
+			if (!reiserfs_attrs(inode->i_sb))
+				return -ENOTTY;
 
-		if (IS_RDONLY(inode))
-			return -EROFS;
+			if (IS_RDONLY(inode))
+				return -EROFS;
 
-		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
-			return -EPERM;
+			if ((current->fsuid != inode->i_uid)
+			    && !capable(CAP_FOWNER))
+				return -EPERM;
 
-		if (get_user(flags, (int __user *) arg))
-			return -EFAULT;
+			if (get_user(flags, (int __user *)arg))
+				return -EFAULT;
 
-		if ( ( ( flags ^ REISERFS_I(inode) -> i_attrs) & ( REISERFS_IMMUTABLE_FL | REISERFS_APPEND_FL)) &&
-		     !capable( CAP_LINUX_IMMUTABLE ) )
-			return -EPERM;
-			
-		if( ( flags & REISERFS_NOTAIL_FL ) &&
-		    S_ISREG( inode -> i_mode ) ) {
+			if (((flags ^ REISERFS_I(inode)->
+			      i_attrs) & (REISERFS_IMMUTABLE_FL |
+					  REISERFS_APPEND_FL))
+			    && !capable(CAP_LINUX_IMMUTABLE))
+				return -EPERM;
+
+			if ((flags & REISERFS_NOTAIL_FL) &&
+			    S_ISREG(inode->i_mode)) {
 				int result;
 
-				result = reiserfs_unpack( inode, filp );
-				if( result )
+				result = reiserfs_unpack(inode, filp);
+				if (result)
 					return result;
+			}
+			sd_attrs_to_i_attrs(flags, inode);
+			REISERFS_I(inode)->i_attrs = flags;
+			inode->i_ctime = CURRENT_TIME_SEC;
+			mark_inode_dirty(inode);
+			return 0;
 		}
-		sd_attrs_to_i_attrs( flags, inode );
-		REISERFS_I(inode) -> i_attrs = flags;
-		inode->i_ctime = CURRENT_TIME_SEC;
-		mark_inode_dirty(inode);
-		return 0;
-	}
 	case REISERFS_IOC_GETVERSION:
-		return put_user(inode->i_generation, (int __user *) arg);
+		return put_user(inode->i_generation, (int __user *)arg);
 	case REISERFS_IOC_SETVERSION:
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EPERM;
 		if (IS_RDONLY(inode))
 			return -EROFS;
-		if (get_user(inode->i_generation, (int __user *) arg))
-			return -EFAULT;	
+		if (get_user(inode->i_generation, (int __user *)arg))
+			return -EFAULT;
 		inode->i_ctime = CURRENT_TIME_SEC;
 		mark_inode_dirty(inode);
 		return 0;
@@ -95,63 +98,65 @@ int reiserfs_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
 ** Function try to convert tail from direct item into indirect.
 ** It set up nopack attribute in the REISERFS_I(inode)->nopack
 */
-static int reiserfs_unpack (struct inode * inode, struct file * filp)
+static int reiserfs_unpack(struct inode *inode, struct file *filp)
 {
-    int retval = 0;
-    int index ;
-    struct page *page ;
-    struct address_space *mapping ;
-    unsigned long write_from ;
-    unsigned long blocksize = inode->i_sb->s_blocksize ;
-    	
-    if (inode->i_size == 0) {
-        REISERFS_I(inode)->i_flags |= i_nopack_mask;
-        return 0 ;
-    }
-    /* ioctl already done */
-    if (REISERFS_I(inode)->i_flags & i_nopack_mask) {
-        return 0 ;
-    }
-    reiserfs_write_lock(inode->i_sb);
-
-    /* we need to make sure nobody is changing the file size beneath
-    ** us
-    */
-    down(&inode->i_sem) ;
-
-    write_from = inode->i_size & (blocksize - 1) ;
-    /* if we are on a block boundary, we are already unpacked.  */
-    if ( write_from == 0) {
+	int retval = 0;
+	int index;
+	struct page *page;
+	struct address_space *mapping;
+	unsigned long write_from;
+	unsigned long blocksize = inode->i_sb->s_blocksize;
+
+	if (inode->i_size == 0) {
+		REISERFS_I(inode)->i_flags |= i_nopack_mask;
+		return 0;
+	}
+	/* ioctl already done */
+	if (REISERFS_I(inode)->i_flags & i_nopack_mask) {
+		return 0;
+	}
+	reiserfs_write_lock(inode->i_sb);
+
+	/* we need to make sure nobody is changing the file size beneath
+	 ** us
+	 */
+	down(&inode->i_sem);
+
+	write_from = inode->i_size & (blocksize - 1);
+	/* if we are on a block boundary, we are already unpacked.  */
+	if (write_from == 0) {
+		REISERFS_I(inode)->i_flags |= i_nopack_mask;
+		goto out;
+	}
+
+	/* we unpack by finding the page with the tail, and calling
+	 ** reiserfs_prepare_write on that page.  This will force a 
+	 ** reiserfs_get_block to unpack the tail for us.
+	 */
+	index = inode->i_size >> PAGE_CACHE_SHIFT;
+	mapping = inode->i_mapping;
+	page = grab_cache_page(mapping, index);
+	retval = -ENOMEM;
+	if (!page) {
+		goto out;
+	}
+	retval =
+	    mapping->a_ops->prepare_write(NULL, page, write_from, write_from);
+	if (retval)
+		goto out_unlock;
+
+	/* conversion can change page contents, must flush */
+	flush_dcache_page(page);
+	retval =
+	    mapping->a_ops->commit_write(NULL, page, write_from, write_from);
 	REISERFS_I(inode)->i_flags |= i_nopack_mask;
-	goto out ;
-    }
-
-    /* we unpack by finding the page with the tail, and calling
-    ** reiserfs_prepare_write on that page.  This will force a 
-    ** reiserfs_get_block to unpack the tail for us.
-    */
-    index = inode->i_size >> PAGE_CACHE_SHIFT ;
-    mapping = inode->i_mapping ;
-    page = grab_cache_page(mapping, index) ;
-    retval = -ENOMEM;
-    if (!page) {
-        goto out ;
-    }
-    retval = mapping->a_ops->prepare_write(NULL, page, write_from, write_from) ;
-    if (retval)
-        goto out_unlock ;
-
-    /* conversion can change page contents, must flush */
-    flush_dcache_page(page) ;
-    retval = mapping->a_ops->commit_write(NULL, page, write_from, write_from) ;
-    REISERFS_I(inode)->i_flags |= i_nopack_mask;
-
-out_unlock:
-    unlock_page(page) ;
-    page_cache_release(page) ;
-
-out:
-    up(&inode->i_sem) ;
-    reiserfs_write_unlock(inode->i_sb);
-    return retval;
+
+      out_unlock:
+	unlock_page(page);
+	page_cache_release(page);
+
+      out:
+	up(&inode->i_sem);
+	reiserfs_write_unlock(inode->i_sb);
+	return retval;
 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 464 - 495
fs/reiserfs/item_ops.c


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 692 - 632
fs/reiserfs/journal.c


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 632 - 571
fs/reiserfs/lbalance.c


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1315 - 1228
fs/reiserfs/namei.c


+ 152 - 151
fs/reiserfs/objectid.c

@@ -14,24 +14,24 @@
                          (__le32 *)((struct reiserfs_super_block_v1 *)(rs) + 1) :\
 			 (__le32 *)((rs) + 1))
 
-
 #ifdef CONFIG_REISERFS_CHECK
 
-static void check_objectid_map (struct super_block * s, __le32 * map)
+static void check_objectid_map(struct super_block *s, __le32 * map)
 {
-    if (le32_to_cpu (map[0]) != 1)
-	reiserfs_panic (s, "vs-15010: check_objectid_map: map corrupted: %lx",
-			( long unsigned int ) le32_to_cpu (map[0]));
+	if (le32_to_cpu(map[0]) != 1)
+		reiserfs_panic(s,
+			       "vs-15010: check_objectid_map: map corrupted: %lx",
+			       (long unsigned int)le32_to_cpu(map[0]));
 
-    // FIXME: add something else here
+	// FIXME: add something else here
 }
 
 #else
-static void check_objectid_map (struct super_block * s, __le32 * map)
-{;}
+static void check_objectid_map(struct super_block *s, __le32 * map)
+{;
+}
 #endif
 
-
 /* When we allocate objectids we allocate the first unused objectid.
    Each sequence of objectids in use (the odd sequences) is followed
    by a sequence of objectids not in use (the even sequences).  We
@@ -46,161 +46,162 @@ static void check_objectid_map (struct super_block * s, __le32 * map)
    interesting optimizations of layout could result from complicating
    objectid assignment, but we have deferred making them for now. */
 
-
 /* get unique object identifier */
-__u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th)
+__u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th)
 {
-    struct super_block * s = th->t_super;
-    struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s);
-    __le32 * map = objectid_map (s, rs);
-    __u32 unused_objectid;
-
-    BUG_ON (!th->t_trans_id);
+	struct super_block *s = th->t_super;
+	struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(s);
+	__le32 *map = objectid_map(s, rs);
+	__u32 unused_objectid;
+
+	BUG_ON(!th->t_trans_id);
+
+	check_objectid_map(s, map);
+
+	reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
+	/* comment needed -Hans */
+	unused_objectid = le32_to_cpu(map[1]);
+	if (unused_objectid == U32_MAX) {
+		reiserfs_warning(s, "%s: no more object ids", __FUNCTION__);
+		reiserfs_restore_prepared_buffer(s, SB_BUFFER_WITH_SB(s));
+		return 0;
+	}
 
-    check_objectid_map (s, map);
+	/* This incrementation allocates the first unused objectid. That
+	   is to say, the first entry on the objectid map is the first
+	   unused objectid, and by incrementing it we use it.  See below
+	   where we check to see if we eliminated a sequence of unused
+	   objectids.... */
+	map[1] = cpu_to_le32(unused_objectid + 1);
+
+	/* Now we check to see if we eliminated the last remaining member of
+	   the first even sequence (and can eliminate the sequence by
+	   eliminating its last objectid from oids), and can collapse the
+	   first two odd sequences into one sequence.  If so, then the net
+	   result is to eliminate a pair of objectids from oids.  We do this
+	   by shifting the entire map to the left. */
+	if (sb_oid_cursize(rs) > 2 && map[1] == map[2]) {
+		memmove(map + 1, map + 3,
+			(sb_oid_cursize(rs) - 3) * sizeof(__u32));
+		set_sb_oid_cursize(rs, sb_oid_cursize(rs) - 2);
+	}
 
-    reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
-                                /* comment needed -Hans */
-    unused_objectid = le32_to_cpu (map[1]);
-    if (unused_objectid == U32_MAX) {
-	reiserfs_warning (s, "%s: no more object ids", __FUNCTION__);
-	reiserfs_restore_prepared_buffer(s, SB_BUFFER_WITH_SB(s)) ;
-	return 0;
-    }
-
-    /* This incrementation allocates the first unused objectid. That
-       is to say, the first entry on the objectid map is the first
-       unused objectid, and by incrementing it we use it.  See below
-       where we check to see if we eliminated a sequence of unused
-       objectids.... */
-    map[1] = cpu_to_le32 (unused_objectid + 1);
-
-    /* Now we check to see if we eliminated the last remaining member of
-       the first even sequence (and can eliminate the sequence by
-       eliminating its last objectid from oids), and can collapse the
-       first two odd sequences into one sequence.  If so, then the net
-       result is to eliminate a pair of objectids from oids.  We do this
-       by shifting the entire map to the left. */
-    if (sb_oid_cursize(rs) > 2 && map[1] == map[2]) {
-	memmove (map + 1, map + 3, (sb_oid_cursize(rs) - 3) * sizeof(__u32));
-        set_sb_oid_cursize( rs, sb_oid_cursize(rs) - 2 );
-    }
-
-    journal_mark_dirty(th, s, SB_BUFFER_WITH_SB (s));
-    return unused_objectid;
+	journal_mark_dirty(th, s, SB_BUFFER_WITH_SB(s));
+	return unused_objectid;
 }
 
-
 /* makes object identifier unused */
-void reiserfs_release_objectid (struct reiserfs_transaction_handle *th, 
-				__u32 objectid_to_release)
+void reiserfs_release_objectid(struct reiserfs_transaction_handle *th,
+			       __u32 objectid_to_release)
 {
-    struct super_block * s = th->t_super;
-    struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s);
-    __le32 * map = objectid_map (s, rs);
-    int i = 0;
-
-    BUG_ON (!th->t_trans_id);
-    //return;
-    check_objectid_map (s, map);
-
-    reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
-    journal_mark_dirty(th, s, SB_BUFFER_WITH_SB (s)); 
-
-    /* start at the beginning of the objectid map (i = 0) and go to
-       the end of it (i = disk_sb->s_oid_cursize).  Linear search is
-       what we use, though it is possible that binary search would be
-       more efficient after performing lots of deletions (which is
-       when oids is large.)  We only check even i's. */
-    while (i < sb_oid_cursize(rs)) {
-	if (objectid_to_release == le32_to_cpu (map[i])) {
-	    /* This incrementation unallocates the objectid. */
-	    //map[i]++;
-	    map[i] = cpu_to_le32 (le32_to_cpu (map[i]) + 1);
-
-	    /* Did we unallocate the last member of an odd sequence, and can shrink oids? */
-	    if (map[i] == map[i+1]) {
-		/* shrink objectid map */
-		memmove (map + i, map + i + 2, 
-			 (sb_oid_cursize(rs) - i - 2) * sizeof (__u32));
-		//disk_sb->s_oid_cursize -= 2;
-                set_sb_oid_cursize( rs, sb_oid_cursize(rs) - 2 );
-
-		RFALSE( sb_oid_cursize(rs) < 2 || 
-		        sb_oid_cursize(rs) > sb_oid_maxsize(rs),
-		        "vs-15005: objectid map corrupted cur_size == %d (max == %d)",
-                        sb_oid_cursize(rs), sb_oid_maxsize(rs));
-	    }
-	    return;
+	struct super_block *s = th->t_super;
+	struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(s);
+	__le32 *map = objectid_map(s, rs);
+	int i = 0;
+
+	BUG_ON(!th->t_trans_id);
+	//return;
+	check_objectid_map(s, map);
+
+	reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
+	journal_mark_dirty(th, s, SB_BUFFER_WITH_SB(s));
+
+	/* start at the beginning of the objectid map (i = 0) and go to
+	   the end of it (i = disk_sb->s_oid_cursize).  Linear search is
+	   what we use, though it is possible that binary search would be
+	   more efficient after performing lots of deletions (which is
+	   when oids is large.)  We only check even i's. */
+	while (i < sb_oid_cursize(rs)) {
+		if (objectid_to_release == le32_to_cpu(map[i])) {
+			/* This incrementation unallocates the objectid. */
+			//map[i]++;
+			map[i] = cpu_to_le32(le32_to_cpu(map[i]) + 1);
+
+			/* Did we unallocate the last member of an odd sequence, and can shrink oids? */
+			if (map[i] == map[i + 1]) {
+				/* shrink objectid map */
+				memmove(map + i, map + i + 2,
+					(sb_oid_cursize(rs) - i -
+					 2) * sizeof(__u32));
+				//disk_sb->s_oid_cursize -= 2;
+				set_sb_oid_cursize(rs, sb_oid_cursize(rs) - 2);
+
+				RFALSE(sb_oid_cursize(rs) < 2 ||
+				       sb_oid_cursize(rs) > sb_oid_maxsize(rs),
+				       "vs-15005: objectid map corrupted cur_size == %d (max == %d)",
+				       sb_oid_cursize(rs), sb_oid_maxsize(rs));
+			}
+			return;
+		}
+
+		if (objectid_to_release > le32_to_cpu(map[i]) &&
+		    objectid_to_release < le32_to_cpu(map[i + 1])) {
+			/* size of objectid map is not changed */
+			if (objectid_to_release + 1 == le32_to_cpu(map[i + 1])) {
+				//objectid_map[i+1]--;
+				map[i + 1] =
+				    cpu_to_le32(le32_to_cpu(map[i + 1]) - 1);
+				return;
+			}
+
+			/* JDM comparing two little-endian values for equality -- safe */
+			if (sb_oid_cursize(rs) == sb_oid_maxsize(rs)) {
+				/* objectid map must be expanded, but there is no space */
+				PROC_INFO_INC(s, leaked_oid);
+				return;
+			}
+
+			/* expand the objectid map */
+			memmove(map + i + 3, map + i + 1,
+				(sb_oid_cursize(rs) - i - 1) * sizeof(__u32));
+			map[i + 1] = cpu_to_le32(objectid_to_release);
+			map[i + 2] = cpu_to_le32(objectid_to_release + 1);
+			set_sb_oid_cursize(rs, sb_oid_cursize(rs) + 2);
+			return;
+		}
+		i += 2;
 	}
 
-	if (objectid_to_release > le32_to_cpu (map[i]) && 
-	    objectid_to_release < le32_to_cpu (map[i + 1])) {
-	    /* size of objectid map is not changed */
-	    if (objectid_to_release + 1 == le32_to_cpu (map[i + 1])) {
-		//objectid_map[i+1]--;
-		map[i + 1] = cpu_to_le32 (le32_to_cpu (map[i + 1]) - 1);
-		return;
-	    }
-
-            /* JDM comparing two little-endian values for equality -- safe */
-	if (sb_oid_cursize(rs) == sb_oid_maxsize(rs)) {
-		/* objectid map must be expanded, but there is no space */
-		PROC_INFO_INC( s, leaked_oid );
-		return;
-	}
+	reiserfs_warning(s,
+			 "vs-15011: reiserfs_release_objectid: tried to free free object id (%lu)",
+			 (long unsigned)objectid_to_release);
+}
 
-	    /* expand the objectid map*/
-	    memmove (map + i + 3, map + i + 1, 
-		     (sb_oid_cursize(rs) - i - 1) * sizeof(__u32));
-	    map[i + 1] = cpu_to_le32 (objectid_to_release);
-	    map[i + 2] = cpu_to_le32 (objectid_to_release + 1);
-            set_sb_oid_cursize( rs, sb_oid_cursize(rs) + 2 );
-	    return;
+int reiserfs_convert_objectid_map_v1(struct super_block *s)
+{
+	struct reiserfs_super_block *disk_sb = SB_DISK_SUPER_BLOCK(s);
+	int cur_size = sb_oid_cursize(disk_sb);
+	int new_size = (s->s_blocksize - SB_SIZE) / sizeof(__u32) / 2 * 2;
+	int old_max = sb_oid_maxsize(disk_sb);
+	struct reiserfs_super_block_v1 *disk_sb_v1;
+	__le32 *objectid_map, *new_objectid_map;
+	int i;
+
+	disk_sb_v1 =
+	    (struct reiserfs_super_block_v1 *)(SB_BUFFER_WITH_SB(s)->b_data);
+	objectid_map = (__le32 *) (disk_sb_v1 + 1);
+	new_objectid_map = (__le32 *) (disk_sb + 1);
+
+	if (cur_size > new_size) {
+		/* mark everyone used that was listed as free at the end of the objectid
+		 ** map 
+		 */
+		objectid_map[new_size - 1] = objectid_map[cur_size - 1];
+		set_sb_oid_cursize(disk_sb, new_size);
+	}
+	/* move the smaller objectid map past the end of the new super */
+	for (i = new_size - 1; i >= 0; i--) {
+		objectid_map[i + (old_max - new_size)] = objectid_map[i];
 	}
-	i += 2;
-    }
 
-    reiserfs_warning (s, "vs-15011: reiserfs_release_objectid: tried to free free object id (%lu)",
-		      ( long unsigned ) objectid_to_release);
-}
+	/* set the max size so we don't overflow later */
+	set_sb_oid_maxsize(disk_sb, new_size);
 
+	/* Zero out label and generate random UUID */
+	memset(disk_sb->s_label, 0, sizeof(disk_sb->s_label));
+	generate_random_uuid(disk_sb->s_uuid);
 
-int reiserfs_convert_objectid_map_v1(struct super_block *s) {
-    struct reiserfs_super_block *disk_sb = SB_DISK_SUPER_BLOCK (s);
-    int cur_size = sb_oid_cursize(disk_sb);
-    int new_size = (s->s_blocksize - SB_SIZE) / sizeof(__u32) / 2 * 2 ;
-    int old_max = sb_oid_maxsize(disk_sb);
-    struct reiserfs_super_block_v1 *disk_sb_v1 ;
-    __le32 *objectid_map, *new_objectid_map ;
-    int i ;
-
-    disk_sb_v1=(struct reiserfs_super_block_v1 *)(SB_BUFFER_WITH_SB(s)->b_data);
-    objectid_map = (__le32 *)(disk_sb_v1 + 1) ;
-    new_objectid_map = (__le32 *)(disk_sb + 1) ;
-
-    if (cur_size > new_size) {
-	/* mark everyone used that was listed as free at the end of the objectid
-	** map 
-	*/
-	objectid_map[new_size - 1] = objectid_map[cur_size - 1] ;
-	set_sb_oid_cursize(disk_sb,new_size) ;
-    }
-    /* move the smaller objectid map past the end of the new super */
-    for (i = new_size - 1 ; i >= 0 ; i--) {
-        objectid_map[i + (old_max - new_size)] = objectid_map[i] ; 
-    }
-
-
-    /* set the max size so we don't overflow later */
-    set_sb_oid_maxsize(disk_sb,new_size) ;
-
-    /* Zero out label and generate random UUID */
-    memset(disk_sb->s_label, 0, sizeof(disk_sb->s_label)) ;
-    generate_random_uuid(disk_sb->s_uuid);
-
-    /* finally, zero out the unused chunk of the new super */
-    memset(disk_sb->s_unused, 0, sizeof(disk_sb->s_unused)) ;
-    return 0 ;
+	/* finally, zero out the unused chunk of the new super */
+	memset(disk_sb->s_unused, 0, sizeof(disk_sb->s_unused));
+	return 0;
 }
-

+ 514 - 489
fs/reiserfs/prints.c

@@ -15,168 +15,166 @@ static char error_buf[1024];
 static char fmt_buf[1024];
 static char off_buf[80];
 
-
-static char * reiserfs_cpu_offset (struct cpu_key * key)
+static char *reiserfs_cpu_offset(struct cpu_key *key)
 {
-  if (cpu_key_k_type(key) == TYPE_DIRENTRY)
-    sprintf (off_buf, "%Lu(%Lu)", 
-	     (unsigned long long)GET_HASH_VALUE (cpu_key_k_offset (key)),
-	     (unsigned long long)GET_GENERATION_NUMBER (cpu_key_k_offset (key)));
-  else
-    sprintf (off_buf, "0x%Lx", (unsigned long long)cpu_key_k_offset (key));
-  return off_buf;
+	if (cpu_key_k_type(key) == TYPE_DIRENTRY)
+		sprintf(off_buf, "%Lu(%Lu)",
+			(unsigned long long)
+			GET_HASH_VALUE(cpu_key_k_offset(key)),
+			(unsigned long long)
+			GET_GENERATION_NUMBER(cpu_key_k_offset(key)));
+	else
+		sprintf(off_buf, "0x%Lx",
+			(unsigned long long)cpu_key_k_offset(key));
+	return off_buf;
 }
 
-
-static char * le_offset (struct reiserfs_key * key)
+static char *le_offset(struct reiserfs_key *key)
 {
-  int version;
+	int version;
 
-  version = le_key_version (key);
-  if (le_key_k_type (version, key) == TYPE_DIRENTRY)
-    sprintf (off_buf, "%Lu(%Lu)", 
-	     (unsigned long long)GET_HASH_VALUE (le_key_k_offset (version, key)),
-	     (unsigned long long)GET_GENERATION_NUMBER (le_key_k_offset (version, key)));
-  else
-    sprintf (off_buf, "0x%Lx", (unsigned long long)le_key_k_offset (version, key));
-  return off_buf;
+	version = le_key_version(key);
+	if (le_key_k_type(version, key) == TYPE_DIRENTRY)
+		sprintf(off_buf, "%Lu(%Lu)",
+			(unsigned long long)
+			GET_HASH_VALUE(le_key_k_offset(version, key)),
+			(unsigned long long)
+			GET_GENERATION_NUMBER(le_key_k_offset(version, key)));
+	else
+		sprintf(off_buf, "0x%Lx",
+			(unsigned long long)le_key_k_offset(version, key));
+	return off_buf;
 }
 
-
-static char * cpu_type (struct cpu_key * key)
+static char *cpu_type(struct cpu_key *key)
 {
-    if (cpu_key_k_type (key) == TYPE_STAT_DATA)
-	return "SD";
-    if (cpu_key_k_type (key) == TYPE_DIRENTRY)
-	return "DIR";
-    if (cpu_key_k_type (key) == TYPE_DIRECT)
-	return "DIRECT";
-    if (cpu_key_k_type (key) == TYPE_INDIRECT)
-	return "IND";
-    return "UNKNOWN";
+	if (cpu_key_k_type(key) == TYPE_STAT_DATA)
+		return "SD";
+	if (cpu_key_k_type(key) == TYPE_DIRENTRY)
+		return "DIR";
+	if (cpu_key_k_type(key) == TYPE_DIRECT)
+		return "DIRECT";
+	if (cpu_key_k_type(key) == TYPE_INDIRECT)
+		return "IND";
+	return "UNKNOWN";
 }
 
-
-static char * le_type (struct reiserfs_key * key)
+static char *le_type(struct reiserfs_key *key)
 {
-    int version;
-    
-    version = le_key_version (key);
+	int version;
 
-    if (le_key_k_type (version, key) == TYPE_STAT_DATA)
-	return "SD";
-    if (le_key_k_type (version, key) == TYPE_DIRENTRY)
-	return "DIR";
-    if (le_key_k_type (version, key) == TYPE_DIRECT)
-	return "DIRECT";
-    if (le_key_k_type (version, key) == TYPE_INDIRECT)
-	return "IND";
-    return "UNKNOWN";
-}
+	version = le_key_version(key);
 
+	if (le_key_k_type(version, key) == TYPE_STAT_DATA)
+		return "SD";
+	if (le_key_k_type(version, key) == TYPE_DIRENTRY)
+		return "DIR";
+	if (le_key_k_type(version, key) == TYPE_DIRECT)
+		return "DIRECT";
+	if (le_key_k_type(version, key) == TYPE_INDIRECT)
+		return "IND";
+	return "UNKNOWN";
+}
 
 /* %k */
-static void sprintf_le_key (char * buf, struct reiserfs_key * key)
+static void sprintf_le_key(char *buf, struct reiserfs_key *key)
 {
-  if (key)
-    sprintf (buf, "[%d %d %s %s]", le32_to_cpu (key->k_dir_id),
-	     le32_to_cpu (key->k_objectid), le_offset (key), le_type (key));
-  else
-    sprintf (buf, "[NULL]");
+	if (key)
+		sprintf(buf, "[%d %d %s %s]", le32_to_cpu(key->k_dir_id),
+			le32_to_cpu(key->k_objectid), le_offset(key),
+			le_type(key));
+	else
+		sprintf(buf, "[NULL]");
 }
 
-
 /* %K */
-static void sprintf_cpu_key (char * buf, struct cpu_key * key)
+static void sprintf_cpu_key(char *buf, struct cpu_key *key)
 {
-  if (key)
-    sprintf (buf, "[%d %d %s %s]", key->on_disk_key.k_dir_id,
-	     key->on_disk_key.k_objectid, reiserfs_cpu_offset (key),
-             cpu_type (key));
-  else
-    sprintf (buf, "[NULL]");
+	if (key)
+		sprintf(buf, "[%d %d %s %s]", key->on_disk_key.k_dir_id,
+			key->on_disk_key.k_objectid, reiserfs_cpu_offset(key),
+			cpu_type(key));
+	else
+		sprintf(buf, "[NULL]");
 }
 
-static void sprintf_de_head( char *buf, struct reiserfs_de_head *deh )
+static void sprintf_de_head(char *buf, struct reiserfs_de_head *deh)
 {
-    if( deh )
-        sprintf( buf, "[offset=%d dir_id=%d objectid=%d location=%d state=%04x]", deh_offset(deh), deh_dir_id(deh),
-                 deh_objectid(deh), deh_location(deh), deh_state(deh) );
-    else
-        sprintf( buf, "[NULL]" );
+	if (deh)
+		sprintf(buf,
+			"[offset=%d dir_id=%d objectid=%d location=%d state=%04x]",
+			deh_offset(deh), deh_dir_id(deh), deh_objectid(deh),
+			deh_location(deh), deh_state(deh));
+	else
+		sprintf(buf, "[NULL]");
 
 }
 
-static void sprintf_item_head (char * buf, struct item_head * ih)
+static void sprintf_item_head(char *buf, struct item_head *ih)
 {
-    if (ih) {
-	strcpy (buf, (ih_version (ih) == KEY_FORMAT_3_6) ? "*3.6* " : "*3.5*");
-	sprintf_le_key (buf + strlen (buf), &(ih->ih_key));
-	sprintf (buf + strlen (buf), ", item_len %d, item_location %d, "
-		 "free_space(entry_count) %d",
-		 ih_item_len(ih), ih_location(ih), ih_free_space (ih));
-    } else
-	sprintf (buf, "[NULL]");
+	if (ih) {
+		strcpy(buf,
+		       (ih_version(ih) == KEY_FORMAT_3_6) ? "*3.6* " : "*3.5*");
+		sprintf_le_key(buf + strlen(buf), &(ih->ih_key));
+		sprintf(buf + strlen(buf), ", item_len %d, item_location %d, "
+			"free_space(entry_count) %d",
+			ih_item_len(ih), ih_location(ih), ih_free_space(ih));
+	} else
+		sprintf(buf, "[NULL]");
 }
 
-
-static void sprintf_direntry (char * buf, struct reiserfs_dir_entry * de)
+static void sprintf_direntry(char *buf, struct reiserfs_dir_entry *de)
 {
-  char name[20];
+	char name[20];
 
-  memcpy (name, de->de_name, de->de_namelen > 19 ? 19 : de->de_namelen);
-  name [de->de_namelen > 19 ? 19 : de->de_namelen] = 0;
-  sprintf (buf, "\"%s\"==>[%d %d]", name, de->de_dir_id, de->de_objectid);
+	memcpy(name, de->de_name, de->de_namelen > 19 ? 19 : de->de_namelen);
+	name[de->de_namelen > 19 ? 19 : de->de_namelen] = 0;
+	sprintf(buf, "\"%s\"==>[%d %d]", name, de->de_dir_id, de->de_objectid);
 }
 
-
-static void sprintf_block_head (char * buf, struct buffer_head * bh)
+static void sprintf_block_head(char *buf, struct buffer_head *bh)
 {
-  sprintf (buf, "level=%d, nr_items=%d, free_space=%d rdkey ",
-	   B_LEVEL (bh), B_NR_ITEMS (bh), B_FREE_SPACE (bh));
+	sprintf(buf, "level=%d, nr_items=%d, free_space=%d rdkey ",
+		B_LEVEL(bh), B_NR_ITEMS(bh), B_FREE_SPACE(bh));
 }
 
-
-static void sprintf_buffer_head (char * buf, struct buffer_head * bh) 
+static void sprintf_buffer_head(char *buf, struct buffer_head *bh)
 {
-  char b[BDEVNAME_SIZE];
+	char b[BDEVNAME_SIZE];
 
-  sprintf (buf, "dev %s, size %d, blocknr %llu, count %d, state 0x%lx, page %p, (%s, %s, %s)",
-	   bdevname (bh->b_bdev, b), bh->b_size,
-	   (unsigned long long)bh->b_blocknr,
-	   atomic_read (&(bh->b_count)),
-	   bh->b_state, bh->b_page,
-	   buffer_uptodate (bh) ? "UPTODATE" : "!UPTODATE",
-	   buffer_dirty (bh) ? "DIRTY" : "CLEAN",
-	   buffer_locked (bh) ? "LOCKED" : "UNLOCKED");
+	sprintf(buf,
+		"dev %s, size %d, blocknr %llu, count %d, state 0x%lx, page %p, (%s, %s, %s)",
+		bdevname(bh->b_bdev, b), bh->b_size,
+		(unsigned long long)bh->b_blocknr, atomic_read(&(bh->b_count)),
+		bh->b_state, bh->b_page,
+		buffer_uptodate(bh) ? "UPTODATE" : "!UPTODATE",
+		buffer_dirty(bh) ? "DIRTY" : "CLEAN",
+		buffer_locked(bh) ? "LOCKED" : "UNLOCKED");
 }
 
-
-static void sprintf_disk_child (char * buf, struct disk_child * dc)
+static void sprintf_disk_child(char *buf, struct disk_child *dc)
 {
-  sprintf (buf, "[dc_number=%d, dc_size=%u]", dc_block_number(dc), dc_size(dc));
+	sprintf(buf, "[dc_number=%d, dc_size=%u]", dc_block_number(dc),
+		dc_size(dc));
 }
 
-
-static char * is_there_reiserfs_struct (char * fmt, int * what, int * skip)
+static char *is_there_reiserfs_struct(char *fmt, int *what, int *skip)
 {
-  char * k = fmt;
+	char *k = fmt;
 
-  *skip = 0;
-  
-  while ((k = strchr (k, '%')) != NULL)
-  {
-    if (k[1] == 'k' || k[1] == 'K' || k[1] == 'h' || k[1] == 't' ||
-	      k[1] == 'z' || k[1] == 'b' || k[1] == 'y' || k[1] == 'a' ) {
-      *what = k[1];
-      break;
-    }
-    (*skip) ++;
-    k ++;
-  }
-  return k;
-}
+	*skip = 0;
 
+	while ((k = strchr(k, '%')) != NULL) {
+		if (k[1] == 'k' || k[1] == 'K' || k[1] == 'h' || k[1] == 't' ||
+		    k[1] == 'z' || k[1] == 'b' || k[1] == 'y' || k[1] == 'a') {
+			*what = k[1];
+			break;
+		}
+		(*skip)++;
+		k++;
+	}
+	return k;
+}
 
 /* debugging reiserfs we used to print out a lot of different
    variables, like keys, item headers, buffer heads etc. Values of
@@ -191,61 +189,64 @@ static char * is_there_reiserfs_struct (char * fmt, int * what, int * skip)
            key->k_offset, key->k_uniqueness); 
 */
 
-
-static void
-prepare_error_buf( const char *fmt, va_list args )
-{
-    char * fmt1 = fmt_buf;
-    char * k;
-    char * p = error_buf;
-    int i, j, what, skip;
-
-    strcpy (fmt1, fmt);
-
-    while( (k = is_there_reiserfs_struct( fmt1, &what, &skip )) != NULL )
-    {
-        *k = 0;
-
-        p += vsprintf (p, fmt1, args);
-
-        for (i = 0; i < skip; i ++)
-            j = va_arg (args, int);
-
-        switch (what) {
-        case 'k':
-            sprintf_le_key (p, va_arg(args, struct reiserfs_key *));
-            break;
-        case 'K':
-            sprintf_cpu_key (p, va_arg(args, struct cpu_key *));
-            break;
-        case 'h':
-            sprintf_item_head (p, va_arg(args, struct item_head *));
-            break;
-        case 't':
-            sprintf_direntry (p, va_arg(args, struct reiserfs_dir_entry *));
-            break;
-        case 'y':
-            sprintf_disk_child (p, va_arg(args, struct disk_child *));
-            break;
-        case 'z':
-            sprintf_block_head (p, va_arg(args, struct buffer_head *));
-            break;
-        case 'b':
-            sprintf_buffer_head (p, va_arg(args, struct buffer_head *));
-            break;
-        case 'a':
-            sprintf_de_head (p, va_arg(args, struct reiserfs_de_head *));
-            break;
-        }
-
-        p += strlen (p);
-        fmt1 = k + 2;
-    }
-    vsprintf (p, fmt1, args);
+static void prepare_error_buf(const char *fmt, va_list args)
+{
+	char *fmt1 = fmt_buf;
+	char *k;
+	char *p = error_buf;
+	int i, j, what, skip;
+
+	strcpy(fmt1, fmt);
+
+	while ((k = is_there_reiserfs_struct(fmt1, &what, &skip)) != NULL) {
+		*k = 0;
+
+		p += vsprintf(p, fmt1, args);
+
+		for (i = 0; i < skip; i++)
+			j = va_arg(args, int);
+
+		switch (what) {
+		case 'k':
+			sprintf_le_key(p, va_arg(args, struct reiserfs_key *));
+			break;
+		case 'K':
+			sprintf_cpu_key(p, va_arg(args, struct cpu_key *));
+			break;
+		case 'h':
+			sprintf_item_head(p, va_arg(args, struct item_head *));
+			break;
+		case 't':
+			sprintf_direntry(p,
+					 va_arg(args,
+						struct reiserfs_dir_entry *));
+			break;
+		case 'y':
+			sprintf_disk_child(p,
+					   va_arg(args, struct disk_child *));
+			break;
+		case 'z':
+			sprintf_block_head(p,
+					   va_arg(args, struct buffer_head *));
+			break;
+		case 'b':
+			sprintf_buffer_head(p,
+					    va_arg(args, struct buffer_head *));
+			break;
+		case 'a':
+			sprintf_de_head(p,
+					va_arg(args,
+					       struct reiserfs_de_head *));
+			break;
+		}
+
+		p += strlen(p);
+		fmt1 = k + 2;
+	}
+	vsprintf(p, fmt1, args);
 
 }
 
-
 /* in addition to usual conversion specifiers this accepts reiserfs
    specific conversion specifiers: 
    %k to print little endian key, 
@@ -264,43 +265,43 @@ prepare_error_buf( const char *fmt, va_list args )
     va_end( args );\
 }
 
-void reiserfs_warning (struct super_block *sb, const char * fmt, ...)
+void reiserfs_warning(struct super_block *sb, const char *fmt, ...)
 {
-  do_reiserfs_warning(fmt);
-  if (sb)
-      printk (KERN_WARNING "ReiserFS: %s: warning: %s\n",
-             reiserfs_bdevname (sb), error_buf);
-  else
-      printk (KERN_WARNING "ReiserFS: warning: %s\n", error_buf);
+	do_reiserfs_warning(fmt);
+	if (sb)
+		printk(KERN_WARNING "ReiserFS: %s: warning: %s\n",
+		       reiserfs_bdevname(sb), error_buf);
+	else
+		printk(KERN_WARNING "ReiserFS: warning: %s\n", error_buf);
 }
 
 /* No newline.. reiserfs_info calls can be followed by printk's */
-void reiserfs_info (struct super_block *sb, const char * fmt, ...)
+void reiserfs_info(struct super_block *sb, const char *fmt, ...)
 {
-  do_reiserfs_warning(fmt);
-  if (sb)
-      printk (KERN_NOTICE "ReiserFS: %s: %s",
-             reiserfs_bdevname (sb), error_buf);
-  else
-      printk (KERN_NOTICE "ReiserFS: %s", error_buf);
+	do_reiserfs_warning(fmt);
+	if (sb)
+		printk(KERN_NOTICE "ReiserFS: %s: %s",
+		       reiserfs_bdevname(sb), error_buf);
+	else
+		printk(KERN_NOTICE "ReiserFS: %s", error_buf);
 }
 
 /* No newline.. reiserfs_printk calls can be followed by printk's */
-static void reiserfs_printk (const char * fmt, ...)
+static void reiserfs_printk(const char *fmt, ...)
 {
-  do_reiserfs_warning(fmt);
-  printk (error_buf);
+	do_reiserfs_warning(fmt);
+	printk(error_buf);
 }
 
-void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...)
+void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...)
 {
 #ifdef CONFIG_REISERFS_CHECK
-  do_reiserfs_warning(fmt);
-  if (s)
-      printk (KERN_DEBUG "ReiserFS: %s: %s\n",
-             reiserfs_bdevname (s), error_buf);
-  else
-      printk (KERN_DEBUG "ReiserFS: %s\n", error_buf);
+	do_reiserfs_warning(fmt);
+	if (s)
+		printk(KERN_DEBUG "ReiserFS: %s: %s\n",
+		       reiserfs_bdevname(s), error_buf);
+	else
+		printk(KERN_DEBUG "ReiserFS: %s\n", error_buf);
 #endif
 }
 
@@ -349,379 +350,403 @@ void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...)
 
    .  */
 
-
 #ifdef CONFIG_REISERFS_CHECK
-extern struct tree_balance * cur_tb;
+extern struct tree_balance *cur_tb;
 #endif
 
-void reiserfs_panic (struct super_block * sb, const char * fmt, ...)
+void reiserfs_panic(struct super_block *sb, const char *fmt, ...)
 {
-  do_reiserfs_warning(fmt);
-  printk (KERN_EMERG "REISERFS: panic (device %s): %s\n",
-          reiserfs_bdevname (sb), error_buf);
-  BUG ();
+	do_reiserfs_warning(fmt);
+	printk(KERN_EMERG "REISERFS: panic (device %s): %s\n",
+	       reiserfs_bdevname(sb), error_buf);
+	BUG();
 
-  /* this is not actually called, but makes reiserfs_panic() "noreturn" */
-  panic ("REISERFS: panic (device %s): %s\n",
-	 reiserfs_bdevname (sb), error_buf);
+	/* this is not actually called, but makes reiserfs_panic() "noreturn" */
+	panic("REISERFS: panic (device %s): %s\n",
+	      reiserfs_bdevname(sb), error_buf);
 }
 
-void
-reiserfs_abort (struct super_block *sb, int errno, const char *fmt, ...)
+void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
 {
-    do_reiserfs_warning (fmt);
+	do_reiserfs_warning(fmt);
 
-    if (reiserfs_error_panic (sb)) {
-        panic (KERN_CRIT "REISERFS: panic (device %s): %s\n",
-               reiserfs_bdevname (sb), error_buf);
-    }
+	if (reiserfs_error_panic(sb)) {
+		panic(KERN_CRIT "REISERFS: panic (device %s): %s\n",
+		      reiserfs_bdevname(sb), error_buf);
+	}
 
-    if (sb->s_flags & MS_RDONLY)
-        return;
+	if (sb->s_flags & MS_RDONLY)
+		return;
 
-    printk (KERN_CRIT "REISERFS: abort (device %s): %s\n",
-            reiserfs_bdevname (sb), error_buf);
+	printk(KERN_CRIT "REISERFS: abort (device %s): %s\n",
+	       reiserfs_bdevname(sb), error_buf);
 
-    sb->s_flags |= MS_RDONLY;
-    reiserfs_journal_abort (sb, errno);
+	sb->s_flags |= MS_RDONLY;
+	reiserfs_journal_abort(sb, errno);
 }
 
 /* this prints internal nodes (4 keys/items in line) (dc_number,
    dc_size)[k_dirid, k_objectid, k_offset, k_uniqueness](dc_number,
    dc_size)...*/
-static int print_internal (struct buffer_head * bh, int first, int last)
+static int print_internal(struct buffer_head *bh, int first, int last)
 {
-    struct reiserfs_key * key;
-    struct disk_child * dc;
-    int i;
-    int from, to;
-    
-    if (!B_IS_KEYS_LEVEL (bh))
-	return 1;
-
-    check_internal (bh);
-    
-    if (first == -1) {
-	from = 0;
-	to = B_NR_ITEMS (bh);
-    } else {
-	from = first;
-	to = last < B_NR_ITEMS (bh) ? last : B_NR_ITEMS (bh);
-    }
-
-    reiserfs_printk ("INTERNAL NODE (%ld) contains %z\n",  bh->b_blocknr, bh);
-    
-    dc = B_N_CHILD (bh, from);
-    reiserfs_printk ("PTR %d: %y ", from, dc);
-    
-    for (i = from, key = B_N_PDELIM_KEY (bh, from), dc ++; i < to; i ++, key ++, dc ++) {
-	reiserfs_printk ("KEY %d: %k PTR %d: %y ", i, key, i + 1, dc);
-	if (i && i % 4 == 0)
-	    printk ("\n");
-    }
-    printk ("\n");
-    return 0;
-}
+	struct reiserfs_key *key;
+	struct disk_child *dc;
+	int i;
+	int from, to;
 
+	if (!B_IS_KEYS_LEVEL(bh))
+		return 1;
 
+	check_internal(bh);
 
+	if (first == -1) {
+		from = 0;
+		to = B_NR_ITEMS(bh);
+	} else {
+		from = first;
+		to = last < B_NR_ITEMS(bh) ? last : B_NR_ITEMS(bh);
+	}
 
+	reiserfs_printk("INTERNAL NODE (%ld) contains %z\n", bh->b_blocknr, bh);
 
-static int print_leaf (struct buffer_head * bh, int print_mode, int first, int last)
-{
-    struct block_head * blkh;
-    struct item_head * ih;
-    int i, nr;
-    int from, to;
+	dc = B_N_CHILD(bh, from);
+	reiserfs_printk("PTR %d: %y ", from, dc);
 
-    if (!B_IS_ITEMS_LEVEL (bh))
-	return 1;
+	for (i = from, key = B_N_PDELIM_KEY(bh, from), dc++; i < to;
+	     i++, key++, dc++) {
+		reiserfs_printk("KEY %d: %k PTR %d: %y ", i, key, i + 1, dc);
+		if (i && i % 4 == 0)
+			printk("\n");
+	}
+	printk("\n");
+	return 0;
+}
 
-    check_leaf (bh);
+static int print_leaf(struct buffer_head *bh, int print_mode, int first,
+		      int last)
+{
+	struct block_head *blkh;
+	struct item_head *ih;
+	int i, nr;
+	int from, to;
 
-    blkh = B_BLK_HEAD (bh);
-    ih = B_N_PITEM_HEAD (bh,0);
-    nr = blkh_nr_item(blkh);
+	if (!B_IS_ITEMS_LEVEL(bh))
+		return 1;
 
-    printk ("\n===================================================================\n");
-    reiserfs_printk ("LEAF NODE (%ld) contains %z\n", bh->b_blocknr, bh);
+	check_leaf(bh);
 
-    if (!(print_mode & PRINT_LEAF_ITEMS)) {
-	reiserfs_printk ("FIRST ITEM_KEY: %k, LAST ITEM KEY: %k\n",
-			  &(ih->ih_key), &((ih + nr - 1)->ih_key));
-	return 0;
-    }
+	blkh = B_BLK_HEAD(bh);
+	ih = B_N_PITEM_HEAD(bh, 0);
+	nr = blkh_nr_item(blkh);
 
-    if (first < 0 || first > nr - 1) 
-	from = 0;
-    else 
-	from = first;
+	printk
+	    ("\n===================================================================\n");
+	reiserfs_printk("LEAF NODE (%ld) contains %z\n", bh->b_blocknr, bh);
 
-    if (last < 0 || last > nr )
-	to = nr;
-    else
-	to = last;
+	if (!(print_mode & PRINT_LEAF_ITEMS)) {
+		reiserfs_printk("FIRST ITEM_KEY: %k, LAST ITEM KEY: %k\n",
+				&(ih->ih_key), &((ih + nr - 1)->ih_key));
+		return 0;
+	}
 
-    ih += from;
-    printk ("-------------------------------------------------------------------------------\n");
-    printk ("|##|   type    |           key           | ilen | free_space | version | loc  |\n");
-    for (i = from; i < to; i++, ih ++) {
-	printk ("-------------------------------------------------------------------------------\n");
-	reiserfs_printk ("|%2d| %h |\n", i, ih);
-	if (print_mode & PRINT_LEAF_ITEMS)
-	    op_print_item (ih, B_I_PITEM (bh, ih));
-    }
+	if (first < 0 || first > nr - 1)
+		from = 0;
+	else
+		from = first;
+
+	if (last < 0 || last > nr)
+		to = nr;
+	else
+		to = last;
+
+	ih += from;
+	printk
+	    ("-------------------------------------------------------------------------------\n");
+	printk
+	    ("|##|   type    |           key           | ilen | free_space | version | loc  |\n");
+	for (i = from; i < to; i++, ih++) {
+		printk
+		    ("-------------------------------------------------------------------------------\n");
+		reiserfs_printk("|%2d| %h |\n", i, ih);
+		if (print_mode & PRINT_LEAF_ITEMS)
+			op_print_item(ih, B_I_PITEM(bh, ih));
+	}
 
-    printk ("===================================================================\n");
+	printk
+	    ("===================================================================\n");
 
-    return 0;
+	return 0;
 }
 
-char * reiserfs_hashname(int code)
+char *reiserfs_hashname(int code)
 {
-    if ( code == YURA_HASH)
-	return "rupasov";
-    if ( code == TEA_HASH)
-	return "tea";
-    if ( code == R5_HASH)
-	return "r5";
+	if (code == YURA_HASH)
+		return "rupasov";
+	if (code == TEA_HASH)
+		return "tea";
+	if (code == R5_HASH)
+		return "r5";
 
-    return "unknown";
+	return "unknown";
 }
 
 /* return 1 if this is not super block */
-static int print_super_block (struct buffer_head * bh)
-{
-    struct reiserfs_super_block * rs = (struct reiserfs_super_block *)(bh->b_data);
-    int skipped, data_blocks;
-    char *version;
-    char b[BDEVNAME_SIZE];
-
-    if (is_reiserfs_3_5(rs)) {
-        version = "3.5";
-    } else if (is_reiserfs_3_6(rs)) {
-        version = "3.6";
-    } else if (is_reiserfs_jr(rs)) {
-      version = ((sb_version(rs) == REISERFS_VERSION_2) ?
- 		 "3.6" : "3.5");  
-    } else {
-	return 1;
-    }
-
-    printk ("%s\'s super block is in block %llu\n", bdevname (bh->b_bdev, b),
-            (unsigned long long)bh->b_blocknr);
-    printk ("Reiserfs version %s\n", version );
-    printk ("Block count %u\n", sb_block_count(rs));
-    printk ("Blocksize %d\n", sb_blocksize(rs));
-    printk ("Free blocks %u\n", sb_free_blocks(rs));
-    // FIXME: this would be confusing if
-    // someone stores reiserfs super block in some data block ;)
+static int print_super_block(struct buffer_head *bh)
+{
+	struct reiserfs_super_block *rs =
+	    (struct reiserfs_super_block *)(bh->b_data);
+	int skipped, data_blocks;
+	char *version;
+	char b[BDEVNAME_SIZE];
+
+	if (is_reiserfs_3_5(rs)) {
+		version = "3.5";
+	} else if (is_reiserfs_3_6(rs)) {
+		version = "3.6";
+	} else if (is_reiserfs_jr(rs)) {
+		version = ((sb_version(rs) == REISERFS_VERSION_2) ?
+			   "3.6" : "3.5");
+	} else {
+		return 1;
+	}
+
+	printk("%s\'s super block is in block %llu\n", bdevname(bh->b_bdev, b),
+	       (unsigned long long)bh->b_blocknr);
+	printk("Reiserfs version %s\n", version);
+	printk("Block count %u\n", sb_block_count(rs));
+	printk("Blocksize %d\n", sb_blocksize(rs));
+	printk("Free blocks %u\n", sb_free_blocks(rs));
+	// FIXME: this would be confusing if
+	// someone stores reiserfs super block in some data block ;)
 //    skipped = (bh->b_blocknr * bh->b_size) / sb_blocksize(rs);
-    skipped = bh->b_blocknr;
-    data_blocks = sb_block_count(rs) - skipped - 1 - sb_bmap_nr(rs) -
-	    (!is_reiserfs_jr(rs) ? sb_jp_journal_size(rs) + 1 : sb_reserved_for_journal(rs)) -	    
-	    sb_free_blocks(rs);
-    printk ("Busy blocks (skipped %d, bitmaps - %d, journal (or reserved) blocks - %d\n"
-	    "1 super block, %d data blocks\n", 
-	    skipped, sb_bmap_nr(rs), (!is_reiserfs_jr(rs) ? (sb_jp_journal_size(rs) + 1) :
-				      sb_reserved_for_journal(rs)) , data_blocks);
-    printk ("Root block %u\n", sb_root_block(rs));
-    printk ("Journal block (first) %d\n", sb_jp_journal_1st_block(rs));
-    printk ("Journal dev %d\n", sb_jp_journal_dev(rs));
-    printk ("Journal orig size %d\n", sb_jp_journal_size(rs));
-    printk ("FS state %d\n", sb_fs_state(rs));
-    printk ("Hash function \"%s\"\n",
-	    reiserfs_hashname(sb_hash_function_code(rs)));
-    
-    printk ("Tree height %d\n", sb_tree_height(rs));
-    return 0;
+	skipped = bh->b_blocknr;
+	data_blocks = sb_block_count(rs) - skipped - 1 - sb_bmap_nr(rs) -
+	    (!is_reiserfs_jr(rs) ? sb_jp_journal_size(rs) +
+	     1 : sb_reserved_for_journal(rs)) - sb_free_blocks(rs);
+	printk
+	    ("Busy blocks (skipped %d, bitmaps - %d, journal (or reserved) blocks - %d\n"
+	     "1 super block, %d data blocks\n", skipped, sb_bmap_nr(rs),
+	     (!is_reiserfs_jr(rs) ? (sb_jp_journal_size(rs) + 1) :
+	      sb_reserved_for_journal(rs)), data_blocks);
+	printk("Root block %u\n", sb_root_block(rs));
+	printk("Journal block (first) %d\n", sb_jp_journal_1st_block(rs));
+	printk("Journal dev %d\n", sb_jp_journal_dev(rs));
+	printk("Journal orig size %d\n", sb_jp_journal_size(rs));
+	printk("FS state %d\n", sb_fs_state(rs));
+	printk("Hash function \"%s\"\n",
+	       reiserfs_hashname(sb_hash_function_code(rs)));
+
+	printk("Tree height %d\n", sb_tree_height(rs));
+	return 0;
 }
 
-static int print_desc_block (struct buffer_head * bh)
+static int print_desc_block(struct buffer_head *bh)
 {
-    struct reiserfs_journal_desc * desc;
+	struct reiserfs_journal_desc *desc;
 
-    if (memcmp(get_journal_desc_magic (bh), JOURNAL_DESC_MAGIC, 8))
-	return 1;
+	if (memcmp(get_journal_desc_magic(bh), JOURNAL_DESC_MAGIC, 8))
+		return 1;
 
-    desc = (struct reiserfs_journal_desc *)(bh->b_data);
-    printk ("Desc block %llu (j_trans_id %d, j_mount_id %d, j_len %d)",
-	    (unsigned long long)bh->b_blocknr, get_desc_trans_id (desc), get_desc_mount_id (desc),
-	    get_desc_trans_len (desc));
+	desc = (struct reiserfs_journal_desc *)(bh->b_data);
+	printk("Desc block %llu (j_trans_id %d, j_mount_id %d, j_len %d)",
+	       (unsigned long long)bh->b_blocknr, get_desc_trans_id(desc),
+	       get_desc_mount_id(desc), get_desc_trans_len(desc));
 
-    return 0;
+	return 0;
 }
 
-
-void print_block (struct buffer_head * bh, ...)//int print_mode, int first, int last)
+void print_block(struct buffer_head *bh, ...)	//int print_mode, int first, int last)
 {
-    va_list args;
-    int mode, first, last;
+	va_list args;
+	int mode, first, last;
 
-    va_start (args, bh);
+	va_start(args, bh);
 
-    if ( ! bh ) {
-	printk("print_block: buffer is NULL\n");
-	return;
-    }
+	if (!bh) {
+		printk("print_block: buffer is NULL\n");
+		return;
+	}
 
-    mode = va_arg (args, int);
-    first = va_arg (args, int);
-    last = va_arg (args, int);
-    if (print_leaf (bh, mode, first, last))
-	if (print_internal (bh, first, last))
-	    if (print_super_block (bh))
-		if (print_desc_block (bh))
-		    printk ("Block %llu contains unformatted data\n", (unsigned long long)bh->b_blocknr);
+	mode = va_arg(args, int);
+	first = va_arg(args, int);
+	last = va_arg(args, int);
+	if (print_leaf(bh, mode, first, last))
+		if (print_internal(bh, first, last))
+			if (print_super_block(bh))
+				if (print_desc_block(bh))
+					printk
+					    ("Block %llu contains unformatted data\n",
+					     (unsigned long long)bh->b_blocknr);
 }
 
-
-
 static char print_tb_buf[2048];
 
 /* this stores initial state of tree balance in the print_tb_buf */
-void store_print_tb (struct tree_balance * tb)
-{
-    int h = 0;
-    int i;
-    struct buffer_head * tbSh, * tbFh;
-
-    if (!tb)
-	return;
-
-    sprintf (print_tb_buf, "\n"
-	     "BALANCING %d\n"
-	     "MODE=%c, ITEM_POS=%d POS_IN_ITEM=%d\n" 
-	     "=====================================================================\n"
-	     "* h *    S    *    L    *    R    *   F   *   FL  *   FR  *  CFL  *  CFR  *\n",
-	     REISERFS_SB(tb->tb_sb)->s_do_balance,
-	     tb->tb_mode, PATH_LAST_POSITION (tb->tb_path), tb->tb_path->pos_in_item);
-  
-    for (h = 0; h < sizeof(tb->insert_size) / sizeof (tb->insert_size[0]); h ++) {
-	if (PATH_H_PATH_OFFSET (tb->tb_path, h) <= tb->tb_path->path_length && 
-	    PATH_H_PATH_OFFSET (tb->tb_path, h) > ILLEGAL_PATH_ELEMENT_OFFSET) {
-	    tbSh = PATH_H_PBUFFER (tb->tb_path, h);
-	    tbFh = PATH_H_PPARENT (tb->tb_path, h);
-	} else {
-	    tbSh = NULL;
-	    tbFh = NULL;
+void store_print_tb(struct tree_balance *tb)
+{
+	int h = 0;
+	int i;
+	struct buffer_head *tbSh, *tbFh;
+
+	if (!tb)
+		return;
+
+	sprintf(print_tb_buf, "\n"
+		"BALANCING %d\n"
+		"MODE=%c, ITEM_POS=%d POS_IN_ITEM=%d\n"
+		"=====================================================================\n"
+		"* h *    S    *    L    *    R    *   F   *   FL  *   FR  *  CFL  *  CFR  *\n",
+		REISERFS_SB(tb->tb_sb)->s_do_balance,
+		tb->tb_mode, PATH_LAST_POSITION(tb->tb_path),
+		tb->tb_path->pos_in_item);
+
+	for (h = 0; h < sizeof(tb->insert_size) / sizeof(tb->insert_size[0]);
+	     h++) {
+		if (PATH_H_PATH_OFFSET(tb->tb_path, h) <=
+		    tb->tb_path->path_length
+		    && PATH_H_PATH_OFFSET(tb->tb_path,
+					  h) > ILLEGAL_PATH_ELEMENT_OFFSET) {
+			tbSh = PATH_H_PBUFFER(tb->tb_path, h);
+			tbFh = PATH_H_PPARENT(tb->tb_path, h);
+		} else {
+			tbSh = NULL;
+			tbFh = NULL;
+		}
+		sprintf(print_tb_buf + strlen(print_tb_buf),
+			"* %d * %3lld(%2d) * %3lld(%2d) * %3lld(%2d) * %5lld * %5lld * %5lld * %5lld * %5lld *\n",
+			h,
+			(tbSh) ? (long long)(tbSh->b_blocknr) : (-1LL),
+			(tbSh) ? atomic_read(&(tbSh->b_count)) : -1,
+			(tb->L[h]) ? (long long)(tb->L[h]->b_blocknr) : (-1LL),
+			(tb->L[h]) ? atomic_read(&(tb->L[h]->b_count)) : -1,
+			(tb->R[h]) ? (long long)(tb->R[h]->b_blocknr) : (-1LL),
+			(tb->R[h]) ? atomic_read(&(tb->R[h]->b_count)) : -1,
+			(tbFh) ? (long long)(tbFh->b_blocknr) : (-1LL),
+			(tb->FL[h]) ? (long long)(tb->FL[h]->
+						  b_blocknr) : (-1LL),
+			(tb->FR[h]) ? (long long)(tb->FR[h]->
+						  b_blocknr) : (-1LL),
+			(tb->CFL[h]) ? (long long)(tb->CFL[h]->
+						   b_blocknr) : (-1LL),
+			(tb->CFR[h]) ? (long long)(tb->CFR[h]->
+						   b_blocknr) : (-1LL));
 	}
-	sprintf (print_tb_buf + strlen (print_tb_buf),
-		 "* %d * %3lld(%2d) * %3lld(%2d) * %3lld(%2d) * %5lld * %5lld * %5lld * %5lld * %5lld *\n",
-		 h, 
-		 (tbSh) ? (long long)(tbSh->b_blocknr):(-1LL),
-		 (tbSh) ? atomic_read (&(tbSh->b_count)) : -1,
-		 (tb->L[h]) ? (long long)(tb->L[h]->b_blocknr):(-1LL),
-		 (tb->L[h]) ? atomic_read (&(tb->L[h]->b_count)) : -1,
-		 (tb->R[h]) ? (long long)(tb->R[h]->b_blocknr):(-1LL),
-		 (tb->R[h]) ? atomic_read (&(tb->R[h]->b_count)) : -1,
-		 (tbFh) ? (long long)(tbFh->b_blocknr):(-1LL),
-		 (tb->FL[h]) ? (long long)(tb->FL[h]->b_blocknr):(-1LL),
-		 (tb->FR[h]) ? (long long)(tb->FR[h]->b_blocknr):(-1LL),
-		 (tb->CFL[h]) ? (long long)(tb->CFL[h]->b_blocknr):(-1LL),
-		 (tb->CFR[h]) ? (long long)(tb->CFR[h]->b_blocknr):(-1LL));
-    }
-
-    sprintf (print_tb_buf + strlen (print_tb_buf), 
-	     "=====================================================================\n"
-	     "* h * size * ln * lb * rn * rb * blkn * s0 * s1 * s1b * s2 * s2b * curb * lk * rk *\n"
-	     "* 0 * %4d * %2d * %2d * %2d * %2d * %4d * %2d * %2d * %3d * %2d * %3d * %4d * %2d * %2d *\n",
-	     tb->insert_size[0], tb->lnum[0], tb->lbytes, tb->rnum[0],tb->rbytes, tb->blknum[0], 
-	     tb->s0num, tb->s1num,tb->s1bytes,  tb->s2num, tb->s2bytes, tb->cur_blknum, tb->lkey[0], tb->rkey[0]);
-
-    /* this prints balance parameters for non-leaf levels */
-    h = 0;
-    do {
-	h++;
-	sprintf (print_tb_buf + strlen (print_tb_buf),
-		 "* %d * %4d * %2d *    * %2d *    * %2d *\n",
-		h, tb->insert_size[h], tb->lnum[h], tb->rnum[h], tb->blknum[h]);
-    } while (tb->insert_size[h]);
-
-    sprintf (print_tb_buf + strlen (print_tb_buf), 
-	     "=====================================================================\n"
-	     "FEB list: ");
-
-    /* print FEB list (list of buffers in form (bh (b_blocknr, b_count), that will be used for new nodes) */
-    h = 0;
-    for (i = 0; i < sizeof (tb->FEB) / sizeof (tb->FEB[0]); i ++)
-	sprintf (print_tb_buf + strlen (print_tb_buf),
-		 "%p (%llu %d)%s", tb->FEB[i], tb->FEB[i] ? (unsigned long long)tb->FEB[i]->b_blocknr : 0ULL,
-		 tb->FEB[i] ? atomic_read (&(tb->FEB[i]->b_count)) : 0, 
-		 (i == sizeof (tb->FEB) / sizeof (tb->FEB[0]) - 1) ? "\n" : ", ");
-
-    sprintf (print_tb_buf + strlen (print_tb_buf), 
-	     "======================== the end ====================================\n");
-}
-
-void print_cur_tb (char * mes)
-{
-    printk ("%s\n%s", mes, print_tb_buf);
-}
-
-static void check_leaf_block_head (struct buffer_head * bh)
-{
-  struct block_head * blkh;
-  int nr;
-
-  blkh = B_BLK_HEAD (bh);
-  nr = blkh_nr_item(blkh);
-  if ( nr > (bh->b_size - BLKH_SIZE) / IH_SIZE)
-    reiserfs_panic (NULL, "vs-6010: check_leaf_block_head: invalid item number %z", bh);
-  if ( blkh_free_space(blkh) > 
-      bh->b_size - BLKH_SIZE - IH_SIZE * nr )
-    reiserfs_panic (NULL, "vs-6020: check_leaf_block_head: invalid free space %z", bh);
-    
-}
 
-static void check_internal_block_head (struct buffer_head * bh)
-{
-    struct block_head * blkh;
-    
-    blkh = B_BLK_HEAD (bh);
-    if (!(B_LEVEL (bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL (bh) <= MAX_HEIGHT))
-	reiserfs_panic (NULL, "vs-6025: check_internal_block_head: invalid level %z", bh);
+	sprintf(print_tb_buf + strlen(print_tb_buf),
+		"=====================================================================\n"
+		"* h * size * ln * lb * rn * rb * blkn * s0 * s1 * s1b * s2 * s2b * curb * lk * rk *\n"
+		"* 0 * %4d * %2d * %2d * %2d * %2d * %4d * %2d * %2d * %3d * %2d * %3d * %4d * %2d * %2d *\n",
+		tb->insert_size[0], tb->lnum[0], tb->lbytes, tb->rnum[0],
+		tb->rbytes, tb->blknum[0], tb->s0num, tb->s1num, tb->s1bytes,
+		tb->s2num, tb->s2bytes, tb->cur_blknum, tb->lkey[0],
+		tb->rkey[0]);
+
+	/* this prints balance parameters for non-leaf levels */
+	h = 0;
+	do {
+		h++;
+		sprintf(print_tb_buf + strlen(print_tb_buf),
+			"* %d * %4d * %2d *    * %2d *    * %2d *\n",
+			h, tb->insert_size[h], tb->lnum[h], tb->rnum[h],
+			tb->blknum[h]);
+	} while (tb->insert_size[h]);
 
-    if (B_NR_ITEMS (bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE)
-	reiserfs_panic (NULL, "vs-6030: check_internal_block_head: invalid item number %z", bh);
+	sprintf(print_tb_buf + strlen(print_tb_buf),
+		"=====================================================================\n"
+		"FEB list: ");
 
-    if (B_FREE_SPACE (bh) != 
-	bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS (bh) - DC_SIZE * (B_NR_ITEMS (bh) + 1))
-	reiserfs_panic (NULL, "vs-6040: check_internal_block_head: invalid free space %z", bh);
+	/* print FEB list (list of buffers in form (bh (b_blocknr, b_count), that will be used for new nodes) */
+	h = 0;
+	for (i = 0; i < sizeof(tb->FEB) / sizeof(tb->FEB[0]); i++)
+		sprintf(print_tb_buf + strlen(print_tb_buf),
+			"%p (%llu %d)%s", tb->FEB[i],
+			tb->FEB[i] ? (unsigned long long)tb->FEB[i]->
+			b_blocknr : 0ULL,
+			tb->FEB[i] ? atomic_read(&(tb->FEB[i]->b_count)) : 0,
+			(i ==
+			 sizeof(tb->FEB) / sizeof(tb->FEB[0]) -
+			 1) ? "\n" : ", ");
 
+	sprintf(print_tb_buf + strlen(print_tb_buf),
+		"======================== the end ====================================\n");
 }
 
+void print_cur_tb(char *mes)
+{
+	printk("%s\n%s", mes, print_tb_buf);
+}
 
-void check_leaf (struct buffer_head * bh)
+static void check_leaf_block_head(struct buffer_head *bh)
 {
-    int i;
-    struct item_head * ih;
+	struct block_head *blkh;
+	int nr;
+
+	blkh = B_BLK_HEAD(bh);
+	nr = blkh_nr_item(blkh);
+	if (nr > (bh->b_size - BLKH_SIZE) / IH_SIZE)
+		reiserfs_panic(NULL,
+			       "vs-6010: check_leaf_block_head: invalid item number %z",
+			       bh);
+	if (blkh_free_space(blkh) > bh->b_size - BLKH_SIZE - IH_SIZE * nr)
+		reiserfs_panic(NULL,
+			       "vs-6020: check_leaf_block_head: invalid free space %z",
+			       bh);
 
-    if (!bh)
-	return;
-    check_leaf_block_head (bh);
-    for (i = 0, ih = B_N_PITEM_HEAD (bh, 0); i < B_NR_ITEMS (bh); i ++, ih ++)
-	op_check_item (ih, B_I_PITEM (bh, ih));
 }
 
+static void check_internal_block_head(struct buffer_head *bh)
+{
+	struct block_head *blkh;
+
+	blkh = B_BLK_HEAD(bh);
+	if (!(B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL(bh) <= MAX_HEIGHT))
+		reiserfs_panic(NULL,
+			       "vs-6025: check_internal_block_head: invalid level %z",
+			       bh);
+
+	if (B_NR_ITEMS(bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE)
+		reiserfs_panic(NULL,
+			       "vs-6030: check_internal_block_head: invalid item number %z",
+			       bh);
+
+	if (B_FREE_SPACE(bh) !=
+	    bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS(bh) -
+	    DC_SIZE * (B_NR_ITEMS(bh) + 1))
+		reiserfs_panic(NULL,
+			       "vs-6040: check_internal_block_head: invalid free space %z",
+			       bh);
+
+}
 
-void check_internal (struct buffer_head * bh)
+void check_leaf(struct buffer_head *bh)
 {
-  if (!bh)
-    return;
-  check_internal_block_head (bh);
+	int i;
+	struct item_head *ih;
+
+	if (!bh)
+		return;
+	check_leaf_block_head(bh);
+	for (i = 0, ih = B_N_PITEM_HEAD(bh, 0); i < B_NR_ITEMS(bh); i++, ih++)
+		op_check_item(ih, B_I_PITEM(bh, ih));
 }
 
+void check_internal(struct buffer_head *bh)
+{
+	if (!bh)
+		return;
+	check_internal_block_head(bh);
+}
 
-void print_statistics (struct super_block * s)
+void print_statistics(struct super_block *s)
 {
 
-  /*
-  printk ("reiserfs_put_super: session statistics: balances %d, fix_nodes %d, \
-bmap with search %d, without %d, dir2ind %d, ind2dir %d\n",
-	  REISERFS_SB(s)->s_do_balance, REISERFS_SB(s)->s_fix_nodes,
-	  REISERFS_SB(s)->s_bmaps, REISERFS_SB(s)->s_bmaps_without_search,
-	  REISERFS_SB(s)->s_direct2indirect, REISERFS_SB(s)->s_indirect2direct);
-  */
+	/*
+	   printk ("reiserfs_put_super: session statistics: balances %d, fix_nodes %d, \
+	   bmap with search %d, without %d, dir2ind %d, ind2dir %d\n",
+	   REISERFS_SB(s)->s_do_balance, REISERFS_SB(s)->s_fix_nodes,
+	   REISERFS_SB(s)->s_bmaps, REISERFS_SB(s)->s_bmaps_without_search,
+	   REISERFS_SB(s)->s_direct2indirect, REISERFS_SB(s)->s_indirect2direct);
+	 */
 
 }

+ 337 - 358
fs/reiserfs/procfs.c

@@ -33,28 +33,27 @@
 static int show_version(struct seq_file *m, struct super_block *sb)
 {
 	char *format;
-    
-	if ( REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6) ) {
+
+	if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) {
 		format = "3.6";
-	} else if ( REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_5) ) {
+	} else if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_5)) {
 		format = "3.5";
 	} else {
 		format = "unknown";
 	}
 
-	seq_printf(m, "%s format\twith checks %s\n",
-			format,
+	seq_printf(m, "%s format\twith checks %s\n", format,
 #if defined( CONFIG_REISERFS_CHECK )
-			"on"
+		   "on"
 #else
-			"off"
+		   "off"
 #endif
-		);
+	    );
 	return 0;
 }
 
-int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset,
-				     int count, int *eof, void *data )
+int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
+				    int count, int *eof, void *data)
 {
 	*start = buffer;
 	*eof = 1;
@@ -79,87 +78,68 @@ int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset,
 
 #define DJF( x ) le32_to_cpu( rs -> x )
 #define DJV( x ) le32_to_cpu( s_v1 -> x )
-#define DJP( x ) le32_to_cpu( jp -> x ) 
+#define DJP( x ) le32_to_cpu( jp -> x )
 #define JF( x ) ( r -> s_journal -> x )
 
 static int show_super(struct seq_file *m, struct super_block *sb)
 {
 	struct reiserfs_sb_info *r = REISERFS_SB(sb);
-    
-	seq_printf(m,	"state: \t%s\n"
-			"mount options: \t%s%s%s%s%s%s%s%s%s%s%s\n"
-			"gen. counter: \t%i\n"
-			"s_kmallocs: \t%i\n"
-			"s_disk_reads: \t%i\n"
-			"s_disk_writes: \t%i\n"
-			"s_fix_nodes: \t%i\n"
-			"s_do_balance: \t%i\n"
-			"s_unneeded_left_neighbor: \t%i\n"
-			"s_good_search_by_key_reada: \t%i\n"
-			"s_bmaps: \t%i\n"
-			"s_bmaps_without_search: \t%i\n"
-			"s_direct2indirect: \t%i\n"
-			"s_indirect2direct: \t%i\n"
-			"\n"
-			"max_hash_collisions: \t%i\n"
-
-			"breads: \t%lu\n"
-			"bread_misses: \t%lu\n"
-
-			"search_by_key: \t%lu\n"
-			"search_by_key_fs_changed: \t%lu\n"
-			"search_by_key_restarted: \t%lu\n"
-			
-			"insert_item_restarted: \t%lu\n"
-			"paste_into_item_restarted: \t%lu\n"
-			"cut_from_item_restarted: \t%lu\n"
-			"delete_solid_item_restarted: \t%lu\n"
-			"delete_item_restarted: \t%lu\n"
-
-			"leaked_oid: \t%lu\n"
-			"leaves_removable: \t%lu\n",
-
-			SF( s_mount_state ) == REISERFS_VALID_FS ?
-			"REISERFS_VALID_FS" : "REISERFS_ERROR_FS",
-			reiserfs_r5_hash( sb ) ? "FORCE_R5 " : "",
-			reiserfs_rupasov_hash( sb ) ? "FORCE_RUPASOV " : "",
-			reiserfs_tea_hash( sb ) ? "FORCE_TEA " : "",
-			reiserfs_hash_detect( sb ) ? "DETECT_HASH " : "",
-			reiserfs_no_border( sb ) ? "NO_BORDER " : "BORDER ",
-			reiserfs_no_unhashed_relocation( sb ) ? "NO_UNHASHED_RELOCATION " : "",
-			reiserfs_hashed_relocation( sb ) ? "UNHASHED_RELOCATION " : "",
-			reiserfs_test4( sb ) ? "TEST4 " : "",
-			have_large_tails( sb ) ? "TAILS " : have_small_tails(sb)?"SMALL_TAILS ":"NO_TAILS ",
-			replay_only( sb ) ? "REPLAY_ONLY " : "",
-			convert_reiserfs( sb ) ? "CONV " : "",
-
-			atomic_read( &r -> s_generation_counter ),
-			SF( s_kmallocs ),
-			SF( s_disk_reads ),
-			SF( s_disk_writes ),
-			SF( s_fix_nodes ),
-			SF( s_do_balance ),
-			SF( s_unneeded_left_neighbor ),
-			SF( s_good_search_by_key_reada ),
-			SF( s_bmaps ),
-			SF( s_bmaps_without_search ),
-			SF( s_direct2indirect ),
-			SF( s_indirect2direct ),
-			SFP( max_hash_collisions ),
-			SFP( breads ),
-			SFP( bread_miss ),
-			SFP( search_by_key ),
-			SFP( search_by_key_fs_changed ),
-			SFP( search_by_key_restarted ),
-
-			SFP( insert_item_restarted ),
-			SFP( paste_into_item_restarted ),
-			SFP( cut_from_item_restarted ),
-			SFP( delete_solid_item_restarted ),
-			SFP( delete_item_restarted ),
-
-			SFP( leaked_oid ),
-			SFP( leaves_removable ) );
+
+	seq_printf(m, "state: \t%s\n"
+		   "mount options: \t%s%s%s%s%s%s%s%s%s%s%s\n"
+		   "gen. counter: \t%i\n"
+		   "s_kmallocs: \t%i\n"
+		   "s_disk_reads: \t%i\n"
+		   "s_disk_writes: \t%i\n"
+		   "s_fix_nodes: \t%i\n"
+		   "s_do_balance: \t%i\n"
+		   "s_unneeded_left_neighbor: \t%i\n"
+		   "s_good_search_by_key_reada: \t%i\n"
+		   "s_bmaps: \t%i\n"
+		   "s_bmaps_without_search: \t%i\n"
+		   "s_direct2indirect: \t%i\n"
+		   "s_indirect2direct: \t%i\n"
+		   "\n"
+		   "max_hash_collisions: \t%i\n"
+		   "breads: \t%lu\n"
+		   "bread_misses: \t%lu\n"
+		   "search_by_key: \t%lu\n"
+		   "search_by_key_fs_changed: \t%lu\n"
+		   "search_by_key_restarted: \t%lu\n"
+		   "insert_item_restarted: \t%lu\n"
+		   "paste_into_item_restarted: \t%lu\n"
+		   "cut_from_item_restarted: \t%lu\n"
+		   "delete_solid_item_restarted: \t%lu\n"
+		   "delete_item_restarted: \t%lu\n"
+		   "leaked_oid: \t%lu\n"
+		   "leaves_removable: \t%lu\n",
+		   SF(s_mount_state) == REISERFS_VALID_FS ?
+		   "REISERFS_VALID_FS" : "REISERFS_ERROR_FS",
+		   reiserfs_r5_hash(sb) ? "FORCE_R5 " : "",
+		   reiserfs_rupasov_hash(sb) ? "FORCE_RUPASOV " : "",
+		   reiserfs_tea_hash(sb) ? "FORCE_TEA " : "",
+		   reiserfs_hash_detect(sb) ? "DETECT_HASH " : "",
+		   reiserfs_no_border(sb) ? "NO_BORDER " : "BORDER ",
+		   reiserfs_no_unhashed_relocation(sb) ?
+		   "NO_UNHASHED_RELOCATION " : "",
+		   reiserfs_hashed_relocation(sb) ? "UNHASHED_RELOCATION " : "",
+		   reiserfs_test4(sb) ? "TEST4 " : "",
+		   have_large_tails(sb) ? "TAILS " : have_small_tails(sb) ?
+		   "SMALL_TAILS " : "NO_TAILS ",
+		   replay_only(sb) ? "REPLAY_ONLY " : "",
+		   convert_reiserfs(sb) ? "CONV " : "",
+		   atomic_read(&r->s_generation_counter), SF(s_kmallocs),
+		   SF(s_disk_reads), SF(s_disk_writes), SF(s_fix_nodes),
+		   SF(s_do_balance), SF(s_unneeded_left_neighbor),
+		   SF(s_good_search_by_key_reada), SF(s_bmaps),
+		   SF(s_bmaps_without_search), SF(s_direct2indirect),
+		   SF(s_indirect2direct), SFP(max_hash_collisions), SFP(breads),
+		   SFP(bread_miss), SFP(search_by_key),
+		   SFP(search_by_key_fs_changed), SFP(search_by_key_restarted),
+		   SFP(insert_item_restarted), SFP(paste_into_item_restarted),
+		   SFP(cut_from_item_restarted),
+		   SFP(delete_solid_item_restarted), SFP(delete_item_restarted),
+		   SFP(leaked_oid), SFP(leaves_removable));
 
 	return 0;
 }
@@ -169,61 +149,55 @@ static int show_per_level(struct seq_file *m, struct super_block *sb)
 	struct reiserfs_sb_info *r = REISERFS_SB(sb);
 	int level;
 
-	seq_printf(m,	"level\t"
-			"     balances"
-			" [sbk:  reads"
-			"   fs_changed"
-			"   restarted]"
-			"   free space"
-			"        items"
-			"   can_remove"
-			"         lnum"
-			"         rnum"
-			"       lbytes"
-			"       rbytes"
-			"     get_neig"
-			" get_neig_res"
-			"  need_l_neig"
-			"  need_r_neig"
-			"\n"
-			
-		);
-
-	for( level = 0 ; level < MAX_HEIGHT ; ++ level ) {
-		seq_printf(m,	"%i\t"
-				" %12lu"
-				" %12lu"
-				" %12lu"
-				" %12lu"
-				" %12lu"
-				" %12lu"
-				" %12lu"
-				" %12li"
-				" %12li"
-				" %12li"
-				" %12li"
-				" %12lu"
-				" %12lu"
-				" %12lu"
-				" %12lu"
-				"\n",
-				level, 
-				SFPL( balance_at ),
-				SFPL( sbk_read_at ),
-				SFPL( sbk_fs_changed ),
-				SFPL( sbk_restarted ),
-				SFPL( free_at ),
-				SFPL( items_at ),
-				SFPL( can_node_be_removed ),
-				SFPL( lnum ),
-				SFPL( rnum ),
-				SFPL( lbytes ),
-				SFPL( rbytes ),
-				SFPL( get_neighbors ),
-				SFPL( get_neighbors_restart ),
-				SFPL( need_l_neighbor ),
-				SFPL( need_r_neighbor )
-			);
+	seq_printf(m, "level\t"
+		   "     balances"
+		   " [sbk:  reads"
+		   "   fs_changed"
+		   "   restarted]"
+		   "   free space"
+		   "        items"
+		   "   can_remove"
+		   "         lnum"
+		   "         rnum"
+		   "       lbytes"
+		   "       rbytes"
+		   "     get_neig"
+		   " get_neig_res" "  need_l_neig" "  need_r_neig" "\n");
+
+	for (level = 0; level < MAX_HEIGHT; ++level) {
+		seq_printf(m, "%i\t"
+			   " %12lu"
+			   " %12lu"
+			   " %12lu"
+			   " %12lu"
+			   " %12lu"
+			   " %12lu"
+			   " %12lu"
+			   " %12li"
+			   " %12li"
+			   " %12li"
+			   " %12li"
+			   " %12lu"
+			   " %12lu"
+			   " %12lu"
+			   " %12lu"
+			   "\n",
+			   level,
+			   SFPL(balance_at),
+			   SFPL(sbk_read_at),
+			   SFPL(sbk_fs_changed),
+			   SFPL(sbk_restarted),
+			   SFPL(free_at),
+			   SFPL(items_at),
+			   SFPL(can_node_be_removed),
+			   SFPL(lnum),
+			   SFPL(rnum),
+			   SFPL(lbytes),
+			   SFPL(rbytes),
+			   SFPL(get_neighbors),
+			   SFPL(get_neighbors_restart),
+			   SFPL(need_l_neighbor), SFPL(need_r_neighbor)
+		    );
 	}
 	return 0;
 }
@@ -232,31 +206,30 @@ static int show_bitmap(struct seq_file *m, struct super_block *sb)
 {
 	struct reiserfs_sb_info *r = REISERFS_SB(sb);
 
-	seq_printf(m,	"free_block: %lu\n"
-			"  scan_bitmap:"
-			"          wait"
-			"          bmap"
-			"         retry"
-			"        stolen"
-			"  journal_hint"
-			"journal_nohint"
-			"\n"
-			" %14lu"
-			" %14lu"
-			" %14lu"
-			" %14lu"
-			" %14lu"
-			" %14lu"
-			" %14lu"
-			"\n",
-			SFP( free_block ),
-			SFPF( call ), 
-			SFPF( wait ), 
-			SFPF( bmap ),
-			SFPF( retry ),
-			SFPF( stolen ),
-			SFPF( in_journal_hint ),
-			SFPF( in_journal_nohint ) );
+	seq_printf(m, "free_block: %lu\n"
+		   "  scan_bitmap:"
+		   "          wait"
+		   "          bmap"
+		   "         retry"
+		   "        stolen"
+		   "  journal_hint"
+		   "journal_nohint"
+		   "\n"
+		   " %14lu"
+		   " %14lu"
+		   " %14lu"
+		   " %14lu"
+		   " %14lu"
+		   " %14lu"
+		   " %14lu"
+		   "\n",
+		   SFP(free_block),
+		   SFPF(call),
+		   SFPF(wait),
+		   SFPF(bmap),
+		   SFPF(retry),
+		   SFPF(stolen),
+		   SFPF(in_journal_hint), SFPF(in_journal_nohint));
 
 	return 0;
 }
@@ -264,46 +237,42 @@ static int show_bitmap(struct seq_file *m, struct super_block *sb)
 static int show_on_disk_super(struct seq_file *m, struct super_block *sb)
 {
 	struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);
-	struct reiserfs_super_block *rs = sb_info -> s_rs;
-	int hash_code = DFL( s_hash_function_code );
-	__u32 flags = DJF( s_flags );
-
-	seq_printf(m,	"block_count: \t%i\n"
-			"free_blocks: \t%i\n"
-			"root_block: \t%i\n"
-			"blocksize: \t%i\n"
-			"oid_maxsize: \t%i\n"
-			"oid_cursize: \t%i\n"
-			"umount_state: \t%i\n"
-			"magic: \t%10.10s\n"
-			"fs_state: \t%i\n"
-			"hash: \t%s\n"
-			"tree_height: \t%i\n"
-			"bmap_nr: \t%i\n"
-			"version: \t%i\n"
-			"flags: \t%x[%s]\n"
-			"reserved_for_journal: \t%i\n",
-
-			DFL( s_block_count ),
-			DFL( s_free_blocks ),
-			DFL( s_root_block ),
-			DF( s_blocksize ),
-			DF( s_oid_maxsize ),
-			DF( s_oid_cursize ),
-			DF( s_umount_state ),
-			rs -> s_v1.s_magic,
-			DF( s_fs_state ),
-			hash_code == TEA_HASH ? "tea" :
-			( hash_code == YURA_HASH ) ? "rupasov" :
-			( hash_code == R5_HASH ) ? "r5" :
-			( hash_code == UNSET_HASH ) ? "unset" : "unknown",
-			DF( s_tree_height ),
-			DF( s_bmap_nr ),
-			DF( s_version ),
-			flags,
-			( flags & reiserfs_attrs_cleared )
-			? "attrs_cleared" : "",
-			DF (s_reserved_for_journal));
+	struct reiserfs_super_block *rs = sb_info->s_rs;
+	int hash_code = DFL(s_hash_function_code);
+	__u32 flags = DJF(s_flags);
+
+	seq_printf(m, "block_count: \t%i\n"
+		   "free_blocks: \t%i\n"
+		   "root_block: \t%i\n"
+		   "blocksize: \t%i\n"
+		   "oid_maxsize: \t%i\n"
+		   "oid_cursize: \t%i\n"
+		   "umount_state: \t%i\n"
+		   "magic: \t%10.10s\n"
+		   "fs_state: \t%i\n"
+		   "hash: \t%s\n"
+		   "tree_height: \t%i\n"
+		   "bmap_nr: \t%i\n"
+		   "version: \t%i\n"
+		   "flags: \t%x[%s]\n"
+		   "reserved_for_journal: \t%i\n",
+		   DFL(s_block_count),
+		   DFL(s_free_blocks),
+		   DFL(s_root_block),
+		   DF(s_blocksize),
+		   DF(s_oid_maxsize),
+		   DF(s_oid_cursize),
+		   DF(s_umount_state),
+		   rs->s_v1.s_magic,
+		   DF(s_fs_state),
+		   hash_code == TEA_HASH ? "tea" :
+		   (hash_code == YURA_HASH) ? "rupasov" :
+		   (hash_code == R5_HASH) ? "r5" :
+		   (hash_code == UNSET_HASH) ? "unset" : "unknown",
+		   DF(s_tree_height),
+		   DF(s_bmap_nr),
+		   DF(s_version), flags, (flags & reiserfs_attrs_cleared)
+		   ? "attrs_cleared" : "", DF(s_reserved_for_journal));
 
 	return 0;
 }
@@ -311,131 +280,122 @@ static int show_on_disk_super(struct seq_file *m, struct super_block *sb)
 static int show_oidmap(struct seq_file *m, struct super_block *sb)
 {
 	struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);
-	struct reiserfs_super_block *rs = sb_info -> s_rs;
-	unsigned int mapsize = le16_to_cpu( rs -> s_v1.s_oid_cursize );
+	struct reiserfs_super_block *rs = sb_info->s_rs;
+	unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize);
 	unsigned long total_used = 0;
 	int i;
 
-	for( i = 0 ; i < mapsize ; ++i ) {
+	for (i = 0; i < mapsize; ++i) {
 		__u32 right;
 
-		right = ( i == mapsize - 1 ) ? MAX_KEY_OBJECTID : MAP( i + 1 );
+		right = (i == mapsize - 1) ? MAX_KEY_OBJECTID : MAP(i + 1);
 		seq_printf(m, "%s: [ %x .. %x )\n",
-				( i & 1 ) ? "free" : "used", MAP( i ), right );
-		if( ! ( i & 1 ) ) {
-			total_used += right - MAP( i );
+			   (i & 1) ? "free" : "used", MAP(i), right);
+		if (!(i & 1)) {
+			total_used += right - MAP(i);
 		}
 	}
 #if defined( REISERFS_USE_OIDMAPF )
-	if( sb_info -> oidmap.use_file && ( sb_info -> oidmap.mapf != NULL ) ) {
+	if (sb_info->oidmap.use_file && (sb_info->oidmap.mapf != NULL)) {
 		loff_t size = sb_info->oidmap.mapf->f_dentry->d_inode->i_size;
-		total_used += size / sizeof( reiserfs_oidinterval_d_t );
+		total_used += size / sizeof(reiserfs_oidinterval_d_t);
 	}
 #endif
-	seq_printf(m, "total: \t%i [%i/%i] used: %lu [exact]\n", 
-			mapsize, 
-			mapsize, le16_to_cpu( rs -> s_v1.s_oid_maxsize ),
-			total_used);
+	seq_printf(m, "total: \t%i [%i/%i] used: %lu [exact]\n",
+		   mapsize,
+		   mapsize, le16_to_cpu(rs->s_v1.s_oid_maxsize), total_used);
 	return 0;
 }
 
 static int show_journal(struct seq_file *m, struct super_block *sb)
 {
 	struct reiserfs_sb_info *r = REISERFS_SB(sb);
-	struct reiserfs_super_block *rs = r -> s_rs;
+	struct reiserfs_super_block *rs = r->s_rs;
 	struct journal_params *jp = &rs->s_v1.s_journal;
 	char b[BDEVNAME_SIZE];
-    
-
-	seq_printf(m,	 /* on-disk fields */
- 			"jp_journal_1st_block: \t%i\n"
- 			"jp_journal_dev: \t%s[%x]\n"
- 			"jp_journal_size: \t%i\n"
- 			"jp_journal_trans_max: \t%i\n"
- 			"jp_journal_magic: \t%i\n"
- 			"jp_journal_max_batch: \t%i\n"
- 			"jp_journal_max_commit_age: \t%i\n"
- 			"jp_journal_max_trans_age: \t%i\n"
-			/* incore fields */
-			"j_1st_reserved_block: \t%i\n"	  
-			"j_state: \t%li\n"			
-			"j_trans_id: \t%lu\n"
-			"j_mount_id: \t%lu\n"
-			"j_start: \t%lu\n"
-			"j_len: \t%lu\n"
-			"j_len_alloc: \t%lu\n"
-			"j_wcount: \t%i\n"
-			"j_bcount: \t%lu\n"
-			"j_first_unflushed_offset: \t%lu\n"
-			"j_last_flush_trans_id: \t%lu\n"
-			"j_trans_start_time: \t%li\n"
-			"j_list_bitmap_index: \t%i\n"
-			"j_must_wait: \t%i\n"
-			"j_next_full_flush: \t%i\n"
-			"j_next_async_flush: \t%i\n"
-			"j_cnode_used: \t%i\n"
-			"j_cnode_free: \t%i\n"
-			"\n"
-			/* reiserfs_proc_info_data_t.journal fields */
-			"in_journal: \t%12lu\n"
-			"in_journal_bitmap: \t%12lu\n"
-			"in_journal_reusable: \t%12lu\n"
-			"lock_journal: \t%12lu\n"
-			"lock_journal_wait: \t%12lu\n"
-			"journal_begin: \t%12lu\n"
-			"journal_relock_writers: \t%12lu\n"
-			"journal_relock_wcount: \t%12lu\n"
-			"mark_dirty: \t%12lu\n"
-			"mark_dirty_already: \t%12lu\n"
-			"mark_dirty_notjournal: \t%12lu\n"
-			"restore_prepared: \t%12lu\n"
-			"prepare: \t%12lu\n"
-			"prepare_retry: \t%12lu\n",
-
-                        DJP( jp_journal_1st_block ),
-                        bdevname(SB_JOURNAL(sb)->j_dev_bd, b),
-                        DJP( jp_journal_dev ),
-                        DJP( jp_journal_size ),
-                        DJP( jp_journal_trans_max ),
-                        DJP( jp_journal_magic ),
-                        DJP( jp_journal_max_batch ),
-			SB_JOURNAL(sb)->j_max_commit_age,
-                        DJP( jp_journal_max_trans_age ),
-
-			JF( j_1st_reserved_block ),			
-			JF( j_state ),			
-			JF( j_trans_id ),
-			JF( j_mount_id ),
-			JF( j_start ),
-			JF( j_len ),
-			JF( j_len_alloc ),
-			atomic_read( & r -> s_journal -> j_wcount ),
-			JF( j_bcount ),
-			JF( j_first_unflushed_offset ),
-			JF( j_last_flush_trans_id ),
-			JF( j_trans_start_time ),
-			JF( j_list_bitmap_index ),
-			JF( j_must_wait ),
-			JF( j_next_full_flush ),
-			JF( j_next_async_flush ),
-			JF( j_cnode_used ),
-			JF( j_cnode_free ),
-
-			SFPJ( in_journal ),
-			SFPJ( in_journal_bitmap ),
-			SFPJ( in_journal_reusable ),
-			SFPJ( lock_journal ),
-			SFPJ( lock_journal_wait ),
-			SFPJ( journal_being ),
-			SFPJ( journal_relock_writers ),
-			SFPJ( journal_relock_wcount ),
-			SFPJ( mark_dirty ),
-			SFPJ( mark_dirty_already ),
-			SFPJ( mark_dirty_notjournal ),
-			SFPJ( restore_prepared ),
-			SFPJ( prepare ),
-			SFPJ( prepare_retry )
-		);
+
+	seq_printf(m,		/* on-disk fields */
+		   "jp_journal_1st_block: \t%i\n"
+		   "jp_journal_dev: \t%s[%x]\n"
+		   "jp_journal_size: \t%i\n"
+		   "jp_journal_trans_max: \t%i\n"
+		   "jp_journal_magic: \t%i\n"
+		   "jp_journal_max_batch: \t%i\n"
+		   "jp_journal_max_commit_age: \t%i\n"
+		   "jp_journal_max_trans_age: \t%i\n"
+		   /* incore fields */
+		   "j_1st_reserved_block: \t%i\n"
+		   "j_state: \t%li\n"
+		   "j_trans_id: \t%lu\n"
+		   "j_mount_id: \t%lu\n"
+		   "j_start: \t%lu\n"
+		   "j_len: \t%lu\n"
+		   "j_len_alloc: \t%lu\n"
+		   "j_wcount: \t%i\n"
+		   "j_bcount: \t%lu\n"
+		   "j_first_unflushed_offset: \t%lu\n"
+		   "j_last_flush_trans_id: \t%lu\n"
+		   "j_trans_start_time: \t%li\n"
+		   "j_list_bitmap_index: \t%i\n"
+		   "j_must_wait: \t%i\n"
+		   "j_next_full_flush: \t%i\n"
+		   "j_next_async_flush: \t%i\n"
+		   "j_cnode_used: \t%i\n" "j_cnode_free: \t%i\n" "\n"
+		   /* reiserfs_proc_info_data_t.journal fields */
+		   "in_journal: \t%12lu\n"
+		   "in_journal_bitmap: \t%12lu\n"
+		   "in_journal_reusable: \t%12lu\n"
+		   "lock_journal: \t%12lu\n"
+		   "lock_journal_wait: \t%12lu\n"
+		   "journal_begin: \t%12lu\n"
+		   "journal_relock_writers: \t%12lu\n"
+		   "journal_relock_wcount: \t%12lu\n"
+		   "mark_dirty: \t%12lu\n"
+		   "mark_dirty_already: \t%12lu\n"
+		   "mark_dirty_notjournal: \t%12lu\n"
+		   "restore_prepared: \t%12lu\n"
+		   "prepare: \t%12lu\n"
+		   "prepare_retry: \t%12lu\n",
+		   DJP(jp_journal_1st_block),
+		   bdevname(SB_JOURNAL(sb)->j_dev_bd, b),
+		   DJP(jp_journal_dev),
+		   DJP(jp_journal_size),
+		   DJP(jp_journal_trans_max),
+		   DJP(jp_journal_magic),
+		   DJP(jp_journal_max_batch),
+		   SB_JOURNAL(sb)->j_max_commit_age,
+		   DJP(jp_journal_max_trans_age),
+		   JF(j_1st_reserved_block),
+		   JF(j_state),
+		   JF(j_trans_id),
+		   JF(j_mount_id),
+		   JF(j_start),
+		   JF(j_len),
+		   JF(j_len_alloc),
+		   atomic_read(&r->s_journal->j_wcount),
+		   JF(j_bcount),
+		   JF(j_first_unflushed_offset),
+		   JF(j_last_flush_trans_id),
+		   JF(j_trans_start_time),
+		   JF(j_list_bitmap_index),
+		   JF(j_must_wait),
+		   JF(j_next_full_flush),
+		   JF(j_next_async_flush),
+		   JF(j_cnode_used),
+		   JF(j_cnode_free),
+		   SFPJ(in_journal),
+		   SFPJ(in_journal_bitmap),
+		   SFPJ(in_journal_reusable),
+		   SFPJ(lock_journal),
+		   SFPJ(lock_journal_wait),
+		   SFPJ(journal_being),
+		   SFPJ(journal_relock_writers),
+		   SFPJ(journal_relock_wcount),
+		   SFPJ(mark_dirty),
+		   SFPJ(mark_dirty_already),
+		   SFPJ(mark_dirty_notjournal),
+		   SFPJ(restore_prepared), SFPJ(prepare), SFPJ(prepare_retry)
+	    );
 	return 0;
 }
 
@@ -450,7 +410,7 @@ static int set_sb(struct super_block *sb, void *data)
 	return -ENOENT;
 }
 
-static void *r_start(struct seq_file *m, loff_t *pos)
+static void *r_start(struct seq_file *m, loff_t * pos)
 {
 	struct proc_dir_entry *de = m->private;
 	struct super_block *s = de->parent->data;
@@ -472,7 +432,7 @@ static void *r_start(struct seq_file *m, loff_t *pos)
 	return s;
 }
 
-static void *r_next(struct seq_file *m, void *v, loff_t *pos)
+static void *r_next(struct seq_file *m, void *v, loff_t * pos)
 {
 	++*pos;
 	if (v)
@@ -489,7 +449,7 @@ static void r_stop(struct seq_file *m, void *v)
 static int r_show(struct seq_file *m, void *v)
 {
 	struct proc_dir_entry *de = m->private;
-	int (*show)(struct seq_file *, struct super_block *) = de->data;
+	int (*show) (struct seq_file *, struct super_block *) = de->data;
 	return show(m, v);
 }
 
@@ -512,17 +472,17 @@ static int r_open(struct inode *inode, struct file *file)
 }
 
 static struct file_operations r_file_operations = {
-	.open		= r_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= seq_release,
+	.open = r_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = seq_release,
 };
 
 static struct proc_dir_entry *proc_info_root = NULL;
 static const char proc_info_root_name[] = "fs/reiserfs";
 
 static void add_file(struct super_block *sb, char *name,
-	int (*func)(struct seq_file *, struct super_block *))
+		     int (*func) (struct seq_file *, struct super_block *))
 {
 	struct proc_dir_entry *de;
 	de = create_proc_entry(name, 0, REISERFS_SB(sb)->procdir);
@@ -532,11 +492,12 @@ static void add_file(struct super_block *sb, char *name,
 	}
 }
 
-int reiserfs_proc_info_init( struct super_block *sb )
+int reiserfs_proc_info_init(struct super_block *sb)
 {
-	spin_lock_init( & __PINFO( sb ).lock );
-	REISERFS_SB(sb)->procdir = proc_mkdir(reiserfs_bdevname (sb), proc_info_root);
-	if( REISERFS_SB(sb)->procdir ) {
+	spin_lock_init(&__PINFO(sb).lock);
+	REISERFS_SB(sb)->procdir =
+	    proc_mkdir(reiserfs_bdevname(sb), proc_info_root);
+	if (REISERFS_SB(sb)->procdir) {
 		REISERFS_SB(sb)->procdir->owner = THIS_MODULE;
 		REISERFS_SB(sb)->procdir->data = sb;
 		add_file(sb, "version", show_version);
@@ -549,11 +510,11 @@ int reiserfs_proc_info_init( struct super_block *sb )
 		return 0;
 	}
 	reiserfs_warning(sb, "reiserfs: cannot create /proc/%s/%s",
-			 proc_info_root_name, reiserfs_bdevname (sb) );
+			 proc_info_root_name, reiserfs_bdevname(sb));
 	return 1;
 }
 
-int reiserfs_proc_info_done( struct super_block *sb )
+int reiserfs_proc_info_done(struct super_block *sb)
 {
 	struct proc_dir_entry *de = REISERFS_SB(sb)->procdir;
 	if (de) {
@@ -565,48 +526,48 @@ int reiserfs_proc_info_done( struct super_block *sb )
 		remove_proc_entry("super", de);
 		remove_proc_entry("version", de);
 	}
-	spin_lock( & __PINFO( sb ).lock );
-	__PINFO( sb ).exiting = 1;
-	spin_unlock( & __PINFO( sb ).lock );
-	if ( proc_info_root ) {
-		remove_proc_entry( reiserfs_bdevname (sb), proc_info_root );
+	spin_lock(&__PINFO(sb).lock);
+	__PINFO(sb).exiting = 1;
+	spin_unlock(&__PINFO(sb).lock);
+	if (proc_info_root) {
+		remove_proc_entry(reiserfs_bdevname(sb), proc_info_root);
 		REISERFS_SB(sb)->procdir = NULL;
 	}
 	return 0;
 }
 
-struct proc_dir_entry *reiserfs_proc_register_global( char *name, 
-						      read_proc_t *func )
+struct proc_dir_entry *reiserfs_proc_register_global(char *name,
+						     read_proc_t * func)
 {
-	return ( proc_info_root ) ? create_proc_read_entry( name, 0, 
-							    proc_info_root, 
-							    func, NULL ) : NULL;
+	return (proc_info_root) ? create_proc_read_entry(name, 0,
+							 proc_info_root,
+							 func, NULL) : NULL;
 }
 
-void reiserfs_proc_unregister_global( const char *name )
+void reiserfs_proc_unregister_global(const char *name)
 {
-	remove_proc_entry( name, proc_info_root );
+	remove_proc_entry(name, proc_info_root);
 }
 
-int reiserfs_proc_info_global_init( void )
+int reiserfs_proc_info_global_init(void)
 {
-	if( proc_info_root == NULL ) {
+	if (proc_info_root == NULL) {
 		proc_info_root = proc_mkdir(proc_info_root_name, NULL);
-		if( proc_info_root ) {
-			proc_info_root -> owner = THIS_MODULE;
+		if (proc_info_root) {
+			proc_info_root->owner = THIS_MODULE;
 		} else {
-			reiserfs_warning (NULL,
-					  "reiserfs: cannot create /proc/%s",
-					  proc_info_root_name );
+			reiserfs_warning(NULL,
+					 "reiserfs: cannot create /proc/%s",
+					 proc_info_root_name);
 			return 1;
 		}
 	}
 	return 0;
 }
 
-int reiserfs_proc_info_global_done( void )
+int reiserfs_proc_info_global_done(void)
 {
-	if ( proc_info_root != NULL ) {
+	if (proc_info_root != NULL) {
 		proc_info_root = NULL;
 		remove_proc_entry(proc_info_root_name, NULL);
 	}
@@ -616,22 +577,40 @@ int reiserfs_proc_info_global_done( void )
 /* REISERFS_PROC_INFO */
 #else
 
-int reiserfs_proc_info_init( struct super_block *sb ) { return 0; }
-int reiserfs_proc_info_done( struct super_block *sb ) { return 0; }
+int reiserfs_proc_info_init(struct super_block *sb)
+{
+	return 0;
+}
+int reiserfs_proc_info_done(struct super_block *sb)
+{
+	return 0;
+}
 
-struct proc_dir_entry *reiserfs_proc_register_global( char *name, 
-						      read_proc_t *func )
-{ return NULL; }
+struct proc_dir_entry *reiserfs_proc_register_global(char *name,
+						     read_proc_t * func)
+{
+	return NULL;
+}
 
-void reiserfs_proc_unregister_global( const char *name ) {;}
+void reiserfs_proc_unregister_global(const char *name)
+{;
+}
 
-int reiserfs_proc_info_global_init( void ) { return 0; }
-int reiserfs_proc_info_global_done( void ) { return 0; }
+int reiserfs_proc_info_global_init(void)
+{
+	return 0;
+}
+int reiserfs_proc_info_global_done(void)
+{
+	return 0;
+}
 
-int reiserfs_global_version_in_proc( char *buffer, char **start, 
-				     off_t offset,
-				     int count, int *eof, void *data )
-{ return 0; }
+int reiserfs_global_version_in_proc(char *buffer, char **start,
+				    off_t offset,
+				    int count, int *eof, void *data)
+{
+	return 0;
+}
 
 /* REISERFS_PROC_INFO */
 #endif

+ 108 - 99
fs/reiserfs/resize.c

@@ -1,7 +1,7 @@
 /* 
  * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
  */
- 
+
 /* 
  * Written by Alexander Zarochentcev.
  *
@@ -17,23 +17,23 @@
 #include <linux/reiserfs_fs_sb.h>
 #include <linux/buffer_head.h>
 
-int reiserfs_resize (struct super_block * s, unsigned long block_count_new)
+int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
 {
-        int err = 0;
-	struct reiserfs_super_block * sb;
-        struct reiserfs_bitmap_info *bitmap;
+	int err = 0;
+	struct reiserfs_super_block *sb;
+	struct reiserfs_bitmap_info *bitmap;
 	struct reiserfs_bitmap_info *old_bitmap = SB_AP_BITMAP(s);
-	struct buffer_head * bh;
+	struct buffer_head *bh;
 	struct reiserfs_transaction_handle th;
 	unsigned int bmap_nr_new, bmap_nr;
 	unsigned int block_r_new, block_r;
-	
-	struct reiserfs_list_bitmap * jb;
+
+	struct reiserfs_list_bitmap *jb;
 	struct reiserfs_list_bitmap jbitmap[JOURNAL_NUM_BITMAPS];
-	
+
 	unsigned long int block_count, free_blocks;
 	int i;
-	int copy_size ;
+	int copy_size;
 
 	sb = SB_DISK_SUPER_BLOCK(s);
 
@@ -47,136 +47,145 @@ int reiserfs_resize (struct super_block * s, unsigned long block_count_new)
 	if (!bh) {
 		printk("reiserfs_resize: can\'t read last block\n");
 		return -EINVAL;
-	}	
+	}
 	bforget(bh);
 
 	/* old disk layout detection; those partitions can be mounted, but
 	 * cannot be resized */
-	if (SB_BUFFER_WITH_SB(s)->b_blocknr *	SB_BUFFER_WITH_SB(s)->b_size 
-		!= REISERFS_DISK_OFFSET_IN_BYTES ) {
-		printk("reiserfs_resize: unable to resize a reiserfs without distributed bitmap (fs version < 3.5.12)\n");
+	if (SB_BUFFER_WITH_SB(s)->b_blocknr * SB_BUFFER_WITH_SB(s)->b_size
+	    != REISERFS_DISK_OFFSET_IN_BYTES) {
+		printk
+		    ("reiserfs_resize: unable to resize a reiserfs without distributed bitmap (fs version < 3.5.12)\n");
 		return -ENOTSUPP;
 	}
-       
+
 	/* count used bits in last bitmap block */
-	block_r = SB_BLOCK_COUNT(s) -
-	        (SB_BMAP_NR(s) - 1) * s->s_blocksize * 8;
-	
+	block_r = SB_BLOCK_COUNT(s) - (SB_BMAP_NR(s) - 1) * s->s_blocksize * 8;
+
 	/* count bitmap blocks in new fs */
-	bmap_nr_new = block_count_new / ( s->s_blocksize * 8 );
+	bmap_nr_new = block_count_new / (s->s_blocksize * 8);
 	block_r_new = block_count_new - bmap_nr_new * s->s_blocksize * 8;
-	if (block_r_new) 
+	if (block_r_new)
 		bmap_nr_new++;
 	else
 		block_r_new = s->s_blocksize * 8;
 
 	/* save old values */
 	block_count = SB_BLOCK_COUNT(s);
-	bmap_nr     = SB_BMAP_NR(s);
+	bmap_nr = SB_BMAP_NR(s);
 
 	/* resizing of reiserfs bitmaps (journal and real), if needed */
-	if (bmap_nr_new > bmap_nr) {	    
-	    /* reallocate journal bitmaps */
-	    if (reiserfs_allocate_list_bitmaps(s, jbitmap, bmap_nr_new) < 0) {
-		printk("reiserfs_resize: unable to allocate memory for journal bitmaps\n");
-		unlock_super(s) ;
-		return -ENOMEM ;
-	    }
-	    /* the new journal bitmaps are zero filled, now we copy in the bitmap
-	    ** node pointers from the old journal bitmap structs, and then
-	    ** transfer the new data structures into the journal struct.
-	    **
-	    ** using the copy_size var below allows this code to work for
-	    ** both shrinking and expanding the FS.
-	    */
-	    copy_size = bmap_nr_new < bmap_nr ? bmap_nr_new : bmap_nr ;
-	    copy_size = copy_size * sizeof(struct reiserfs_list_bitmap_node *) ;
-	    for (i = 0 ; i < JOURNAL_NUM_BITMAPS ; i++) {
-		struct reiserfs_bitmap_node **node_tmp ;
-		jb = SB_JOURNAL(s)->j_list_bitmap + i ;
-		memcpy(jbitmap[i].bitmaps, jb->bitmaps, copy_size) ;
-
-		/* just in case vfree schedules on us, copy the new
-		** pointer into the journal struct before freeing the 
-		** old one
-		*/
-		node_tmp = jb->bitmaps ;
-		jb->bitmaps = jbitmap[i].bitmaps ;
-		vfree(node_tmp) ;
-	    }	
-	
-	    /* allocate additional bitmap blocks, reallocate array of bitmap
-	     * block pointers */
-	    bitmap = vmalloc(sizeof(struct reiserfs_bitmap_info) * bmap_nr_new);
-	    if (!bitmap) {
-		/* Journal bitmaps are still supersized, but the memory isn't
-		 * leaked, so I guess it's ok */
-		printk("reiserfs_resize: unable to allocate memory.\n");
-		return -ENOMEM;
-	    }
-	    memset (bitmap, 0, sizeof (struct reiserfs_bitmap_info) * SB_BMAP_NR(s));
-	    for (i = 0; i < bmap_nr; i++)
-		bitmap[i] = old_bitmap[i];
-
-	    /* This doesn't go through the journal, but it doesn't have to.
-	     * The changes are still atomic: We're synced up when the journal
-	     * transaction begins, and the new bitmaps don't matter if the
-	     * transaction fails. */
-	    for (i = bmap_nr; i < bmap_nr_new; i++) {
-		bitmap[i].bh = sb_getblk(s, i * s->s_blocksize * 8);
-		memset(bitmap[i].bh->b_data, 0, sb_blocksize(sb));
-		reiserfs_test_and_set_le_bit(0, bitmap[i].bh->b_data);
-
-		set_buffer_uptodate(bitmap[i].bh);
-		mark_buffer_dirty(bitmap[i].bh) ;
-		sync_dirty_buffer(bitmap[i].bh);
-		// update bitmap_info stuff
-		bitmap[i].first_zero_hint=1;
-		bitmap[i].free_count = sb_blocksize(sb) * 8 - 1;
-	    }	
-	    /* free old bitmap blocks array */
-	    SB_AP_BITMAP(s) = bitmap;
-	    vfree (old_bitmap);
+	if (bmap_nr_new > bmap_nr) {
+		/* reallocate journal bitmaps */
+		if (reiserfs_allocate_list_bitmaps(s, jbitmap, bmap_nr_new) < 0) {
+			printk
+			    ("reiserfs_resize: unable to allocate memory for journal bitmaps\n");
+			unlock_super(s);
+			return -ENOMEM;
+		}
+		/* the new journal bitmaps are zero filled, now we copy in the bitmap
+		 ** node pointers from the old journal bitmap structs, and then
+		 ** transfer the new data structures into the journal struct.
+		 **
+		 ** using the copy_size var below allows this code to work for
+		 ** both shrinking and expanding the FS.
+		 */
+		copy_size = bmap_nr_new < bmap_nr ? bmap_nr_new : bmap_nr;
+		copy_size =
+		    copy_size * sizeof(struct reiserfs_list_bitmap_node *);
+		for (i = 0; i < JOURNAL_NUM_BITMAPS; i++) {
+			struct reiserfs_bitmap_node **node_tmp;
+			jb = SB_JOURNAL(s)->j_list_bitmap + i;
+			memcpy(jbitmap[i].bitmaps, jb->bitmaps, copy_size);
+
+			/* just in case vfree schedules on us, copy the new
+			 ** pointer into the journal struct before freeing the 
+			 ** old one
+			 */
+			node_tmp = jb->bitmaps;
+			jb->bitmaps = jbitmap[i].bitmaps;
+			vfree(node_tmp);
+		}
+
+		/* allocate additional bitmap blocks, reallocate array of bitmap
+		 * block pointers */
+		bitmap =
+		    vmalloc(sizeof(struct reiserfs_bitmap_info) * bmap_nr_new);
+		if (!bitmap) {
+			/* Journal bitmaps are still supersized, but the memory isn't
+			 * leaked, so I guess it's ok */
+			printk("reiserfs_resize: unable to allocate memory.\n");
+			return -ENOMEM;
+		}
+		memset(bitmap, 0,
+		       sizeof(struct reiserfs_bitmap_info) * SB_BMAP_NR(s));
+		for (i = 0; i < bmap_nr; i++)
+			bitmap[i] = old_bitmap[i];
+
+		/* This doesn't go through the journal, but it doesn't have to.
+		 * The changes are still atomic: We're synced up when the journal
+		 * transaction begins, and the new bitmaps don't matter if the
+		 * transaction fails. */
+		for (i = bmap_nr; i < bmap_nr_new; i++) {
+			bitmap[i].bh = sb_getblk(s, i * s->s_blocksize * 8);
+			memset(bitmap[i].bh->b_data, 0, sb_blocksize(sb));
+			reiserfs_test_and_set_le_bit(0, bitmap[i].bh->b_data);
+
+			set_buffer_uptodate(bitmap[i].bh);
+			mark_buffer_dirty(bitmap[i].bh);
+			sync_dirty_buffer(bitmap[i].bh);
+			// update bitmap_info stuff
+			bitmap[i].first_zero_hint = 1;
+			bitmap[i].free_count = sb_blocksize(sb) * 8 - 1;
+		}
+		/* free old bitmap blocks array */
+		SB_AP_BITMAP(s) = bitmap;
+		vfree(old_bitmap);
 	}
-	
+
 	/* begin transaction, if there was an error, it's fine. Yes, we have
 	 * incorrect bitmaps now, but none of it is ever going to touch the
 	 * disk anyway. */
 	err = journal_begin(&th, s, 10);
 	if (err)
-	    return err;
+		return err;
 
 	/* correct last bitmap blocks in old and new disk layout */
 	reiserfs_prepare_for_journal(s, SB_AP_BITMAP(s)[bmap_nr - 1].bh, 1);
 	for (i = block_r; i < s->s_blocksize * 8; i++)
-	    reiserfs_test_and_clear_le_bit(i, 
-					   SB_AP_BITMAP(s)[bmap_nr - 1].bh->b_data);
+		reiserfs_test_and_clear_le_bit(i,
+					       SB_AP_BITMAP(s)[bmap_nr -
+							       1].bh->b_data);
 	SB_AP_BITMAP(s)[bmap_nr - 1].free_count += s->s_blocksize * 8 - block_r;
-	if ( !SB_AP_BITMAP(s)[bmap_nr - 1].first_zero_hint)
-	    SB_AP_BITMAP(s)[bmap_nr - 1].first_zero_hint = block_r;
+	if (!SB_AP_BITMAP(s)[bmap_nr - 1].first_zero_hint)
+		SB_AP_BITMAP(s)[bmap_nr - 1].first_zero_hint = block_r;
 
 	journal_mark_dirty(&th, s, SB_AP_BITMAP(s)[bmap_nr - 1].bh);
 
 	reiserfs_prepare_for_journal(s, SB_AP_BITMAP(s)[bmap_nr_new - 1].bh, 1);
 	for (i = block_r_new; i < s->s_blocksize * 8; i++)
-	    reiserfs_test_and_set_le_bit(i,
-					 SB_AP_BITMAP(s)[bmap_nr_new - 1].bh->b_data);
+		reiserfs_test_and_set_le_bit(i,
+					     SB_AP_BITMAP(s)[bmap_nr_new -
+							     1].bh->b_data);
 	journal_mark_dirty(&th, s, SB_AP_BITMAP(s)[bmap_nr_new - 1].bh);
- 
-	SB_AP_BITMAP(s)[bmap_nr_new - 1].free_count -= s->s_blocksize * 8 - block_r_new;
+
+	SB_AP_BITMAP(s)[bmap_nr_new - 1].free_count -=
+	    s->s_blocksize * 8 - block_r_new;
 	/* Extreme case where last bitmap is the only valid block in itself. */
-	if ( !SB_AP_BITMAP(s)[bmap_nr_new - 1].free_count )
-	    SB_AP_BITMAP(s)[bmap_nr_new - 1].first_zero_hint = 0;
- 	/* update super */
-	reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
+	if (!SB_AP_BITMAP(s)[bmap_nr_new - 1].free_count)
+		SB_AP_BITMAP(s)[bmap_nr_new - 1].first_zero_hint = 0;
+	/* update super */
+	reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
 	free_blocks = SB_FREE_BLOCKS(s);
-	PUT_SB_FREE_BLOCKS(s, free_blocks + (block_count_new - block_count - (bmap_nr_new - bmap_nr)));
+	PUT_SB_FREE_BLOCKS(s,
+			   free_blocks + (block_count_new - block_count -
+					  (bmap_nr_new - bmap_nr)));
 	PUT_SB_BLOCK_COUNT(s, block_count_new);
 	PUT_SB_BMAP_NR(s, bmap_nr_new);
 	s->s_dirt = 1;
 
 	journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
-	
+
 	SB_JOURNAL(s)->j_must_wait = 1;
 	return journal_end(&th, s, 10);
 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 564 - 532
fs/reiserfs/stree.c


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 463 - 437
fs/reiserfs/super.c


+ 233 - 230
fs/reiserfs/tail_conversion.c

@@ -11,156 +11,159 @@
 /* access to tail : when one is going to read tail it must make sure, that is not running.
  direct2indirect and indirect2direct can not run concurrently */
 
-
 /* Converts direct items to an unformatted node. Panics if file has no
    tail. -ENOSPC if no disk space for conversion */
 /* path points to first direct item of the file regarless of how many of
    them are there */
-int direct2indirect (struct reiserfs_transaction_handle *th, struct inode * inode, 
-		     struct path * path, struct buffer_head * unbh,
-		     loff_t tail_offset)
+int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
+		    struct path *path, struct buffer_head *unbh,
+		    loff_t tail_offset)
 {
-    struct super_block * sb = inode->i_sb;
-    struct buffer_head *up_to_date_bh ;
-    struct item_head * p_le_ih = PATH_PITEM_HEAD (path);
-    unsigned long total_tail = 0 ;
-    struct cpu_key end_key;  /* Key to search for the last byte of the
-				converted item. */
-    struct item_head ind_ih; /* new indirect item to be inserted or
-                                key of unfm pointer to be pasted */
-    int	n_blk_size,
-      n_retval;	  /* returned value for reiserfs_insert_item and clones */
-    unp_t unfm_ptr;  /* Handle on an unformatted node
-				       that will be inserted in the
-				       tree. */
-
-    BUG_ON (!th->t_trans_id);
-
-    REISERFS_SB(sb)->s_direct2indirect ++;
-
-    n_blk_size = sb->s_blocksize;
-
-    /* and key to search for append or insert pointer to the new
-       unformatted node. */
-    copy_item_head (&ind_ih, p_le_ih);
-    set_le_ih_k_offset (&ind_ih, tail_offset);
-    set_le_ih_k_type (&ind_ih, TYPE_INDIRECT);
-
-    /* Set the key to search for the place for new unfm pointer */
-    make_cpu_key (&end_key, inode, tail_offset, TYPE_INDIRECT, 4);
-
-    // FIXME: we could avoid this 
-    if ( search_for_position_by_key (sb, &end_key, path) == POSITION_FOUND ) {
-	reiserfs_warning (sb, "PAP-14030: direct2indirect: "
-			"pasted or inserted byte exists in the tree %K. "
-			"Use fsck to repair.", &end_key);
-	pathrelse(path);
-	return -EIO;
-    }
-    
-    p_le_ih = PATH_PITEM_HEAD (path);
-
-    unfm_ptr = cpu_to_le32 (unbh->b_blocknr);
-    
-    if ( is_statdata_le_ih (p_le_ih) )  {
-	/* Insert new indirect item. */
-	set_ih_free_space (&ind_ih, 0); /* delete at nearest future */
-        put_ih_item_len( &ind_ih, UNFM_P_SIZE );
-	PATH_LAST_POSITION (path)++;
-	n_retval = reiserfs_insert_item (th, path, &end_key, &ind_ih, inode,
+	struct super_block *sb = inode->i_sb;
+	struct buffer_head *up_to_date_bh;
+	struct item_head *p_le_ih = PATH_PITEM_HEAD(path);
+	unsigned long total_tail = 0;
+	struct cpu_key end_key;	/* Key to search for the last byte of the
+				   converted item. */
+	struct item_head ind_ih;	/* new indirect item to be inserted or
+					   key of unfm pointer to be pasted */
+	int n_blk_size, n_retval;	/* returned value for reiserfs_insert_item and clones */
+	unp_t unfm_ptr;		/* Handle on an unformatted node
+				   that will be inserted in the
+				   tree. */
+
+	BUG_ON(!th->t_trans_id);
+
+	REISERFS_SB(sb)->s_direct2indirect++;
+
+	n_blk_size = sb->s_blocksize;
+
+	/* and key to search for append or insert pointer to the new
+	   unformatted node. */
+	copy_item_head(&ind_ih, p_le_ih);
+	set_le_ih_k_offset(&ind_ih, tail_offset);
+	set_le_ih_k_type(&ind_ih, TYPE_INDIRECT);
+
+	/* Set the key to search for the place for new unfm pointer */
+	make_cpu_key(&end_key, inode, tail_offset, TYPE_INDIRECT, 4);
+
+	// FIXME: we could avoid this 
+	if (search_for_position_by_key(sb, &end_key, path) == POSITION_FOUND) {
+		reiserfs_warning(sb, "PAP-14030: direct2indirect: "
+				 "pasted or inserted byte exists in the tree %K. "
+				 "Use fsck to repair.", &end_key);
+		pathrelse(path);
+		return -EIO;
+	}
+
+	p_le_ih = PATH_PITEM_HEAD(path);
+
+	unfm_ptr = cpu_to_le32(unbh->b_blocknr);
+
+	if (is_statdata_le_ih(p_le_ih)) {
+		/* Insert new indirect item. */
+		set_ih_free_space(&ind_ih, 0);	/* delete at nearest future */
+		put_ih_item_len(&ind_ih, UNFM_P_SIZE);
+		PATH_LAST_POSITION(path)++;
+		n_retval =
+		    reiserfs_insert_item(th, path, &end_key, &ind_ih, inode,
 					 (char *)&unfm_ptr);
-    } else {
-	/* Paste into last indirect item of an object. */
-	n_retval = reiserfs_paste_into_item(th, path, &end_key, inode,
-					    (char *)&unfm_ptr, UNFM_P_SIZE);
-    }
-    if ( n_retval ) {
-	return n_retval;
-    }
-
-    // note: from here there are two keys which have matching first
-    // three key components. They only differ by the fourth one.
-
-
-    /* Set the key to search for the direct items of the file */
-    make_cpu_key (&end_key, inode, max_reiserfs_offset (inode), TYPE_DIRECT, 4);
-
-    /* Move bytes from the direct items to the new unformatted node
-       and delete them. */
-    while (1)  {
-	int tail_size;
-
-	/* end_key.k_offset is set so, that we will always have found
-           last item of the file */
-	if ( search_for_position_by_key (sb, &end_key, path) == POSITION_FOUND )
-	    reiserfs_panic (sb, "PAP-14050: direct2indirect: "
-			    "direct item (%K) not found", &end_key);
-	p_le_ih = PATH_PITEM_HEAD (path);
-	RFALSE( !is_direct_le_ih (p_le_ih),
-	        "vs-14055: direct item expected(%K), found %h",
-                &end_key, p_le_ih);
-        tail_size = (le_ih_k_offset (p_le_ih) & (n_blk_size - 1))
-            + ih_item_len(p_le_ih) - 1;
-
-	/* we only send the unbh pointer if the buffer is not up to date.
-	** this avoids overwriting good data from writepage() with old data
-	** from the disk or buffer cache
-	** Special case: unbh->b_page will be NULL if we are coming through
-	** DIRECT_IO handler here.
-	*/
-	if (!unbh->b_page || buffer_uptodate(unbh) || PageUptodate(unbh->b_page)) {
-	    up_to_date_bh = NULL ;
 	} else {
-	    up_to_date_bh = unbh ;
+		/* Paste into last indirect item of an object. */
+		n_retval = reiserfs_paste_into_item(th, path, &end_key, inode,
+						    (char *)&unfm_ptr,
+						    UNFM_P_SIZE);
 	}
-	n_retval = reiserfs_delete_item (th, path, &end_key, inode, 
-	                                 up_to_date_bh) ;
-
-	total_tail += n_retval ;
-	if (tail_size == n_retval)
-	    // done: file does not have direct items anymore
-	    break;
-
-    }
-    /* if we've copied bytes from disk into the page, we need to zero
-    ** out the unused part of the block (it was not up to date before)
-    */
-    if (up_to_date_bh) {
-        unsigned pgoff = (tail_offset + total_tail - 1) & (PAGE_CACHE_SIZE - 1);
-	char *kaddr=kmap_atomic(up_to_date_bh->b_page, KM_USER0);
-	memset(kaddr + pgoff, 0, n_blk_size - total_tail) ;
-	kunmap_atomic(kaddr, KM_USER0);
-    }
-
-    REISERFS_I(inode)->i_first_direct_byte = U32_MAX;
-
-    return 0;
-}
+	if (n_retval) {
+		return n_retval;
+	}
+	// note: from here there are two keys which have matching first
+	// three key components. They only differ by the fourth one.
+
+	/* Set the key to search for the direct items of the file */
+	make_cpu_key(&end_key, inode, max_reiserfs_offset(inode), TYPE_DIRECT,
+		     4);
+
+	/* Move bytes from the direct items to the new unformatted node
+	   and delete them. */
+	while (1) {
+		int tail_size;
+
+		/* end_key.k_offset is set so, that we will always have found
+		   last item of the file */
+		if (search_for_position_by_key(sb, &end_key, path) ==
+		    POSITION_FOUND)
+			reiserfs_panic(sb,
+				       "PAP-14050: direct2indirect: "
+				       "direct item (%K) not found", &end_key);
+		p_le_ih = PATH_PITEM_HEAD(path);
+		RFALSE(!is_direct_le_ih(p_le_ih),
+		       "vs-14055: direct item expected(%K), found %h",
+		       &end_key, p_le_ih);
+		tail_size = (le_ih_k_offset(p_le_ih) & (n_blk_size - 1))
+		    + ih_item_len(p_le_ih) - 1;
+
+		/* we only send the unbh pointer if the buffer is not up to date.
+		 ** this avoids overwriting good data from writepage() with old data
+		 ** from the disk or buffer cache
+		 ** Special case: unbh->b_page will be NULL if we are coming through
+		 ** DIRECT_IO handler here.
+		 */
+		if (!unbh->b_page || buffer_uptodate(unbh)
+		    || PageUptodate(unbh->b_page)) {
+			up_to_date_bh = NULL;
+		} else {
+			up_to_date_bh = unbh;
+		}
+		n_retval = reiserfs_delete_item(th, path, &end_key, inode,
+						up_to_date_bh);
+
+		total_tail += n_retval;
+		if (tail_size == n_retval)
+			// done: file does not have direct items anymore
+			break;
 
+	}
+	/* if we've copied bytes from disk into the page, we need to zero
+	 ** out the unused part of the block (it was not up to date before)
+	 */
+	if (up_to_date_bh) {
+		unsigned pgoff =
+		    (tail_offset + total_tail - 1) & (PAGE_CACHE_SIZE - 1);
+		char *kaddr = kmap_atomic(up_to_date_bh->b_page, KM_USER0);
+		memset(kaddr + pgoff, 0, n_blk_size - total_tail);
+		kunmap_atomic(kaddr, KM_USER0);
+	}
+
+	REISERFS_I(inode)->i_first_direct_byte = U32_MAX;
+
+	return 0;
+}
 
 /* stolen from fs/buffer.c */
-void reiserfs_unmap_buffer(struct buffer_head *bh) {
-    lock_buffer(bh) ;
-    if (buffer_journaled(bh) || buffer_journal_dirty(bh)) {
-      BUG() ;
-    }
-    clear_buffer_dirty(bh) ;
-    /* Remove the buffer from whatever list it belongs to. We are mostly
-       interested in removing it from per-sb j_dirty_buffers list, to avoid
-        BUG() on attempt to write not mapped buffer */
-    if ( (!list_empty(&bh->b_assoc_buffers) || bh->b_private) && bh->b_page) {
-	struct inode *inode = bh->b_page->mapping->host;
-	struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb);
-	spin_lock(&j->j_dirty_buffers_lock);
-	list_del_init(&bh->b_assoc_buffers);
-	reiserfs_free_jh(bh);
-	spin_unlock(&j->j_dirty_buffers_lock);
-    }
-    clear_buffer_mapped(bh) ;
-    clear_buffer_req(bh) ;
-    clear_buffer_new(bh);
-    bh->b_bdev = NULL;
-    unlock_buffer(bh) ;
+void reiserfs_unmap_buffer(struct buffer_head *bh)
+{
+	lock_buffer(bh);
+	if (buffer_journaled(bh) || buffer_journal_dirty(bh)) {
+		BUG();
+	}
+	clear_buffer_dirty(bh);
+	/* Remove the buffer from whatever list it belongs to. We are mostly
+	   interested in removing it from per-sb j_dirty_buffers list, to avoid
+	   BUG() on attempt to write not mapped buffer */
+	if ((!list_empty(&bh->b_assoc_buffers) || bh->b_private) && bh->b_page) {
+		struct inode *inode = bh->b_page->mapping->host;
+		struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb);
+		spin_lock(&j->j_dirty_buffers_lock);
+		list_del_init(&bh->b_assoc_buffers);
+		reiserfs_free_jh(bh);
+		spin_unlock(&j->j_dirty_buffers_lock);
+	}
+	clear_buffer_mapped(bh);
+	clear_buffer_req(bh);
+	clear_buffer_new(bh);
+	bh->b_bdev = NULL;
+	unlock_buffer(bh);
 }
 
 /* this first locks inode (neither reads nor sync are permitted),
@@ -169,108 +172,108 @@ void reiserfs_unmap_buffer(struct buffer_head *bh) {
    what we expect from it (number of cut bytes). But when tail remains
    in the unformatted node, we set mode to SKIP_BALANCING and unlock
    inode */
-int indirect2direct (struct reiserfs_transaction_handle *th, 
-		     struct inode * p_s_inode,
-		     struct page *page, 
-		     struct path * p_s_path, /* path to the indirect item. */
-		     const struct cpu_key * p_s_item_key, /* Key to look for unformatted node pointer to be cut. */
-		     loff_t n_new_file_size, /* New file size. */
-		     char * p_c_mode)
+int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, struct page *page, struct path *p_s_path,	/* path to the indirect item. */
+		    const struct cpu_key *p_s_item_key,	/* Key to look for unformatted node pointer to be cut. */
+		    loff_t n_new_file_size,	/* New file size. */
+		    char *p_c_mode)
 {
-    struct super_block * p_s_sb = p_s_inode->i_sb;
-    struct item_head      s_ih;
-    unsigned long n_block_size = p_s_sb->s_blocksize;
-    char * tail;
-    int tail_len, round_tail_len;
-    loff_t pos, pos1; /* position of first byte of the tail */
-    struct cpu_key key;
+	struct super_block *p_s_sb = p_s_inode->i_sb;
+	struct item_head s_ih;
+	unsigned long n_block_size = p_s_sb->s_blocksize;
+	char *tail;
+	int tail_len, round_tail_len;
+	loff_t pos, pos1;	/* position of first byte of the tail */
+	struct cpu_key key;
 
-    BUG_ON (!th->t_trans_id);
+	BUG_ON(!th->t_trans_id);
 
-    REISERFS_SB(p_s_sb)->s_indirect2direct ++;
+	REISERFS_SB(p_s_sb)->s_indirect2direct++;
 
-    *p_c_mode = M_SKIP_BALANCING;
+	*p_c_mode = M_SKIP_BALANCING;
 
-    /* store item head path points to. */
-    copy_item_head (&s_ih, PATH_PITEM_HEAD(p_s_path));
-
-    tail_len = (n_new_file_size & (n_block_size - 1));
-    if (get_inode_sd_version (p_s_inode) == STAT_DATA_V2)
-	round_tail_len = ROUND_UP (tail_len);
-    else
-	round_tail_len = tail_len;
-
-    pos = le_ih_k_offset (&s_ih) - 1 + (ih_item_len(&s_ih) / UNFM_P_SIZE - 1) * p_s_sb->s_blocksize;
-    pos1 = pos;
-
-    // we are protected by i_sem. The tail can not disapper, not
-    // append can be done either
-    // we are in truncate or packing tail in file_release
-
-    tail = (char *)kmap(page) ; /* this can schedule */
-
-    if (path_changed (&s_ih, p_s_path)) {
-	/* re-search indirect item */
-	if ( search_for_position_by_key (p_s_sb, p_s_item_key, p_s_path) == POSITION_NOT_FOUND )
-	    reiserfs_panic(p_s_sb, "PAP-5520: indirect2direct: "
-			   "item to be converted %K does not exist", p_s_item_key);
+	/* store item head path points to. */
 	copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
+
+	tail_len = (n_new_file_size & (n_block_size - 1));
+	if (get_inode_sd_version(p_s_inode) == STAT_DATA_V2)
+		round_tail_len = ROUND_UP(tail_len);
+	else
+		round_tail_len = tail_len;
+
+	pos =
+	    le_ih_k_offset(&s_ih) - 1 + (ih_item_len(&s_ih) / UNFM_P_SIZE -
+					 1) * p_s_sb->s_blocksize;
+	pos1 = pos;
+
+	// we are protected by i_sem. The tail can not disapper, not
+	// append can be done either
+	// we are in truncate or packing tail in file_release
+
+	tail = (char *)kmap(page);	/* this can schedule */
+
+	if (path_changed(&s_ih, p_s_path)) {
+		/* re-search indirect item */
+		if (search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path)
+		    == POSITION_NOT_FOUND)
+			reiserfs_panic(p_s_sb,
+				       "PAP-5520: indirect2direct: "
+				       "item to be converted %K does not exist",
+				       p_s_item_key);
+		copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
 #ifdef CONFIG_REISERFS_CHECK
-	pos = le_ih_k_offset (&s_ih) - 1 + 
-	    (ih_item_len(&s_ih) / UNFM_P_SIZE - 1) * p_s_sb->s_blocksize;
-	if (pos != pos1)
-	    reiserfs_panic (p_s_sb, "vs-5530: indirect2direct: "
-			    "tail position changed while we were reading it");
+		pos = le_ih_k_offset(&s_ih) - 1 +
+		    (ih_item_len(&s_ih) / UNFM_P_SIZE -
+		     1) * p_s_sb->s_blocksize;
+		if (pos != pos1)
+			reiserfs_panic(p_s_sb, "vs-5530: indirect2direct: "
+				       "tail position changed while we were reading it");
 #endif
-    }
-
-
-    /* Set direct item header to insert. */
-    make_le_item_head (&s_ih, NULL, get_inode_item_key_version (p_s_inode), pos1 + 1,
-		       TYPE_DIRECT, round_tail_len, 0xffff/*ih_free_space*/);
-
-    /* we want a pointer to the first byte of the tail in the page.
-    ** the page was locked and this part of the page was up to date when
-    ** indirect2direct was called, so we know the bytes are still valid
-    */
-    tail = tail + (pos & (PAGE_CACHE_SIZE - 1)) ;
-
-    PATH_LAST_POSITION(p_s_path)++;
-
-    key = *p_s_item_key;
-    set_cpu_key_k_type (&key, TYPE_DIRECT);
-    key.key_length = 4;
-    /* Insert tail as new direct item in the tree */
-    if ( reiserfs_insert_item(th, p_s_path, &key, &s_ih, p_s_inode,
-			      tail ? tail : NULL) < 0 ) {
-	/* No disk memory. So we can not convert last unformatted node
-	   to the direct item.  In this case we used to adjust
-	   indirect items's ih_free_space. Now ih_free_space is not
-	   used, it would be ideal to write zeros to corresponding
-	   unformatted node. For now i_size is considered as guard for
-	   going out of file size */
-	kunmap(page) ;
-	return n_block_size - round_tail_len;
-    }
-    kunmap(page) ;
-
-    /* make sure to get the i_blocks changes from reiserfs_insert_item */
-    reiserfs_update_sd(th, p_s_inode);
+	}
 
-    // note: we have now the same as in above direct2indirect
-    // conversion: there are two keys which have matching first three
-    // key components. They only differ by the fouhth one.
+	/* Set direct item header to insert. */
+	make_le_item_head(&s_ih, NULL, get_inode_item_key_version(p_s_inode),
+			  pos1 + 1, TYPE_DIRECT, round_tail_len,
+			  0xffff /*ih_free_space */ );
+
+	/* we want a pointer to the first byte of the tail in the page.
+	 ** the page was locked and this part of the page was up to date when
+	 ** indirect2direct was called, so we know the bytes are still valid
+	 */
+	tail = tail + (pos & (PAGE_CACHE_SIZE - 1));
+
+	PATH_LAST_POSITION(p_s_path)++;
+
+	key = *p_s_item_key;
+	set_cpu_key_k_type(&key, TYPE_DIRECT);
+	key.key_length = 4;
+	/* Insert tail as new direct item in the tree */
+	if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, p_s_inode,
+				 tail ? tail : NULL) < 0) {
+		/* No disk memory. So we can not convert last unformatted node
+		   to the direct item.  In this case we used to adjust
+		   indirect items's ih_free_space. Now ih_free_space is not
+		   used, it would be ideal to write zeros to corresponding
+		   unformatted node. For now i_size is considered as guard for
+		   going out of file size */
+		kunmap(page);
+		return n_block_size - round_tail_len;
+	}
+	kunmap(page);
 
-    /* We have inserted new direct item and must remove last
-       unformatted node. */
-    *p_c_mode = M_CUT;
+	/* make sure to get the i_blocks changes from reiserfs_insert_item */
+	reiserfs_update_sd(th, p_s_inode);
 
-    /* we store position of first direct item in the in-core inode */
-    //mark_file_with_tail (p_s_inode, pos1 + 1);
-    REISERFS_I(p_s_inode)->i_first_direct_byte = pos1 + 1;
-
-    return n_block_size - round_tail_len;
-}
+	// note: we have now the same as in above direct2indirect
+	// conversion: there are two keys which have matching first three
+	// key components. They only differ by the fouhth one.
 
+	/* We have inserted new direct item and must remove last
+	   unformatted node. */
+	*p_c_mode = M_CUT;
 
+	/* we store position of first direct item in the in-core inode */
+	//mark_file_with_tail (p_s_inode, pos1 + 1);
+	REISERFS_I(p_s_inode)->i_first_direct_byte = pos1 + 1;
 
+	return n_block_size - round_tail_len;
+}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 607 - 599
fs/reiserfs/xattr.c


+ 317 - 324
fs/reiserfs/xattr_acl.c

@@ -9,7 +9,8 @@
 #include <linux/reiserfs_acl.h>
 #include <asm/uaccess.h>
 
-static int reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl);
+static int reiserfs_set_acl(struct inode *inode, int type,
+			    struct posix_acl *acl);
 
 static int
 xattr_set_acl(struct inode *inode, int type, const void *value, size_t size)
@@ -34,14 +35,13 @@ xattr_set_acl(struct inode *inode, int type, const void *value, size_t size)
 	} else
 		acl = NULL;
 
-	error = reiserfs_set_acl (inode, type, acl);
+	error = reiserfs_set_acl(inode, type, acl);
 
-release_and_out:
+      release_and_out:
 	posix_acl_release(acl);
 	return error;
 }
 
-
 static int
 xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
 {
@@ -51,7 +51,7 @@ xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
 	if (!reiserfs_posixacl(inode->i_sb))
 		return -EOPNOTSUPP;
 
-	acl = reiserfs_get_acl (inode, type);
+	acl = reiserfs_get_acl(inode, type);
 	if (IS_ERR(acl))
 		return PTR_ERR(acl);
 	if (acl == NULL)
@@ -62,12 +62,10 @@ xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
 	return error;
 }
 
-
 /*
  * Convert from filesystem to in-memory representation.
  */
-static struct posix_acl *
-posix_acl_from_disk(const void *value, size_t size)
+static struct posix_acl *posix_acl_from_disk(const void *value, size_t size)
 {
 	const char *end = (char *)value + size;
 	int n, count;
@@ -76,8 +74,8 @@ posix_acl_from_disk(const void *value, size_t size)
 	if (!value)
 		return NULL;
 	if (size < sizeof(reiserfs_acl_header))
-		 return ERR_PTR(-EINVAL);
-	if (((reiserfs_acl_header *)value)->a_version !=
+		return ERR_PTR(-EINVAL);
+	if (((reiserfs_acl_header *) value)->a_version !=
 	    cpu_to_le32(REISERFS_ACL_VERSION))
 		return ERR_PTR(-EINVAL);
 	value = (char *)value + sizeof(reiserfs_acl_header);
@@ -89,41 +87,39 @@ posix_acl_from_disk(const void *value, size_t size)
 	acl = posix_acl_alloc(count, GFP_NOFS);
 	if (!acl)
 		return ERR_PTR(-ENOMEM);
-	for (n=0; n < count; n++) {
-		reiserfs_acl_entry *entry =
-			(reiserfs_acl_entry *)value;
+	for (n = 0; n < count; n++) {
+		reiserfs_acl_entry *entry = (reiserfs_acl_entry *) value;
 		if ((char *)value + sizeof(reiserfs_acl_entry_short) > end)
 			goto fail;
-		acl->a_entries[n].e_tag  = le16_to_cpu(entry->e_tag);
+		acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag);
 		acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm);
-		switch(acl->a_entries[n].e_tag) {
-			case ACL_USER_OBJ:
-			case ACL_GROUP_OBJ:
-			case ACL_MASK:
-			case ACL_OTHER:
-				value = (char *)value +
-					sizeof(reiserfs_acl_entry_short);
-				acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
-				break;
-
-			case ACL_USER:
-			case ACL_GROUP:
-				value = (char *)value + sizeof(reiserfs_acl_entry);
-				if ((char *)value > end)
-					goto fail;
-				acl->a_entries[n].e_id =
-					le32_to_cpu(entry->e_id);
-				break;
-
-			default:
+		switch (acl->a_entries[n].e_tag) {
+		case ACL_USER_OBJ:
+		case ACL_GROUP_OBJ:
+		case ACL_MASK:
+		case ACL_OTHER:
+			value = (char *)value +
+			    sizeof(reiserfs_acl_entry_short);
+			acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
+			break;
+
+		case ACL_USER:
+		case ACL_GROUP:
+			value = (char *)value + sizeof(reiserfs_acl_entry);
+			if ((char *)value > end)
 				goto fail;
+			acl->a_entries[n].e_id = le32_to_cpu(entry->e_id);
+			break;
+
+		default:
+			goto fail;
 		}
 	}
 	if (value != end)
 		goto fail;
 	return acl;
 
-fail:
+      fail:
 	posix_acl_release(acl);
 	return ERR_PTR(-EINVAL);
 }
@@ -131,46 +127,46 @@ fail:
 /*
  * Convert from in-memory to filesystem representation.
  */
-static void *
-posix_acl_to_disk(const struct posix_acl *acl, size_t *size)
+static void *posix_acl_to_disk(const struct posix_acl *acl, size_t * size)
 {
 	reiserfs_acl_header *ext_acl;
 	char *e;
 	int n;
 
 	*size = reiserfs_acl_size(acl->a_count);
-	ext_acl = (reiserfs_acl_header *)kmalloc(sizeof(reiserfs_acl_header) +
-		acl->a_count * sizeof(reiserfs_acl_entry), GFP_NOFS);
+	ext_acl = (reiserfs_acl_header *) kmalloc(sizeof(reiserfs_acl_header) +
+						  acl->a_count *
+						  sizeof(reiserfs_acl_entry),
+						  GFP_NOFS);
 	if (!ext_acl)
 		return ERR_PTR(-ENOMEM);
 	ext_acl->a_version = cpu_to_le32(REISERFS_ACL_VERSION);
 	e = (char *)ext_acl + sizeof(reiserfs_acl_header);
-	for (n=0; n < acl->a_count; n++) {
-		reiserfs_acl_entry *entry = (reiserfs_acl_entry *)e;
-		entry->e_tag  = cpu_to_le16(acl->a_entries[n].e_tag);
+	for (n = 0; n < acl->a_count; n++) {
+		reiserfs_acl_entry *entry = (reiserfs_acl_entry *) e;
+		entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag);
 		entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm);
-		switch(acl->a_entries[n].e_tag) {
-			case ACL_USER:
-			case ACL_GROUP:
-				entry->e_id =
-					cpu_to_le32(acl->a_entries[n].e_id);
-				e += sizeof(reiserfs_acl_entry);
-				break;
-
-			case ACL_USER_OBJ:
-			case ACL_GROUP_OBJ:
-			case ACL_MASK:
-			case ACL_OTHER:
-				e += sizeof(reiserfs_acl_entry_short);
-				break;
-
-			default:
-				goto fail;
+		switch (acl->a_entries[n].e_tag) {
+		case ACL_USER:
+		case ACL_GROUP:
+			entry->e_id = cpu_to_le32(acl->a_entries[n].e_id);
+			e += sizeof(reiserfs_acl_entry);
+			break;
+
+		case ACL_USER_OBJ:
+		case ACL_GROUP_OBJ:
+		case ACL_MASK:
+		case ACL_OTHER:
+			e += sizeof(reiserfs_acl_entry_short);
+			break;
+
+		default:
+			goto fail;
 		}
 	}
 	return (char *)ext_acl;
 
-fail:
+      fail:
 	kfree(ext_acl);
 	return ERR_PTR(-EINVAL);
 }
@@ -181,59 +177,58 @@ fail:
  * inode->i_sem: down
  * BKL held [before 2.5.x]
  */
-struct posix_acl *
-reiserfs_get_acl(struct inode *inode, int type)
+struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
 {
 	char *name, *value;
 	struct posix_acl *acl, **p_acl;
 	size_t size;
 	int retval;
-        struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
-
-        switch (type) {
-            case ACL_TYPE_ACCESS:
-                name = POSIX_ACL_XATTR_ACCESS;
-                p_acl = &reiserfs_i->i_acl_access;
-                break;
-            case ACL_TYPE_DEFAULT:
-                name = POSIX_ACL_XATTR_DEFAULT;
-                p_acl = &reiserfs_i->i_acl_default;
-                break;
-            default:
-                return ERR_PTR (-EINVAL);
-        }
-
-        if (IS_ERR (*p_acl)) {
-            if (PTR_ERR (*p_acl) == -ENODATA)
-                return NULL;
-        } else if (*p_acl != NULL)
-            return posix_acl_dup (*p_acl);
-
-        size = reiserfs_xattr_get (inode, name, NULL, 0);
-        if ((int)size < 0) {
-            if (size == -ENODATA || size == -ENOSYS) {
-		*p_acl = ERR_PTR (-ENODATA);
-		return NULL;
-            }
-            return ERR_PTR (size);
-        }
+	struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+
+	switch (type) {
+	case ACL_TYPE_ACCESS:
+		name = POSIX_ACL_XATTR_ACCESS;
+		p_acl = &reiserfs_i->i_acl_access;
+		break;
+	case ACL_TYPE_DEFAULT:
+		name = POSIX_ACL_XATTR_DEFAULT;
+		p_acl = &reiserfs_i->i_acl_default;
+		break;
+	default:
+		return ERR_PTR(-EINVAL);
+	}
+
+	if (IS_ERR(*p_acl)) {
+		if (PTR_ERR(*p_acl) == -ENODATA)
+			return NULL;
+	} else if (*p_acl != NULL)
+		return posix_acl_dup(*p_acl);
+
+	size = reiserfs_xattr_get(inode, name, NULL, 0);
+	if ((int)size < 0) {
+		if (size == -ENODATA || size == -ENOSYS) {
+			*p_acl = ERR_PTR(-ENODATA);
+			return NULL;
+		}
+		return ERR_PTR(size);
+	}
 
-        value = kmalloc (size, GFP_NOFS);
-        if (!value)
-            return ERR_PTR (-ENOMEM);
+	value = kmalloc(size, GFP_NOFS);
+	if (!value)
+		return ERR_PTR(-ENOMEM);
 
 	retval = reiserfs_xattr_get(inode, name, value, size);
 	if (retval == -ENODATA || retval == -ENOSYS) {
 		/* This shouldn't actually happen as it should have
 		   been caught above.. but just in case */
 		acl = NULL;
-		*p_acl = ERR_PTR (-ENODATA);
-        } else if (retval < 0) {
+		*p_acl = ERR_PTR(-ENODATA);
+	} else if (retval < 0) {
 		acl = ERR_PTR(retval);
 	} else {
 		acl = posix_acl_from_disk(value, retval);
-		*p_acl = posix_acl_dup (acl);
-        }
+		*p_acl = posix_acl_dup(acl);
+	}
 
 	kfree(value);
 	return acl;
@@ -248,72 +243,72 @@ reiserfs_get_acl(struct inode *inode, int type)
 static int
 reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 {
-        char *name;
+	char *name;
 	void *value = NULL;
 	struct posix_acl **p_acl;
 	size_t size;
 	int error;
-        struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+	struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
 
 	if (S_ISLNK(inode->i_mode))
 		return -EOPNOTSUPP;
 
-        switch (type) {
-            case ACL_TYPE_ACCESS:
-                name = POSIX_ACL_XATTR_ACCESS;
-                p_acl = &reiserfs_i->i_acl_access;
-                if (acl) {
-                    mode_t mode = inode->i_mode;
-                    error = posix_acl_equiv_mode (acl, &mode);
-                    if (error < 0)
-                        return error;
-                    else {
-                        inode->i_mode = mode;
-                        if (error == 0)
-                            acl = NULL;
-                    }
-                }
-                break;
-            case ACL_TYPE_DEFAULT:
-                name = POSIX_ACL_XATTR_DEFAULT;
-                p_acl = &reiserfs_i->i_acl_default;
-                if (!S_ISDIR (inode->i_mode))
-                    return acl ? -EACCES : 0;
-                break;
-            default:
-                return -EINVAL;
-        }
-
- 	if (acl) {
-            value = posix_acl_to_disk(acl, &size);
-            if (IS_ERR(value))
-                return (int)PTR_ERR(value);
-            error = reiserfs_xattr_set(inode, name, value, size, 0);
+	switch (type) {
+	case ACL_TYPE_ACCESS:
+		name = POSIX_ACL_XATTR_ACCESS;
+		p_acl = &reiserfs_i->i_acl_access;
+		if (acl) {
+			mode_t mode = inode->i_mode;
+			error = posix_acl_equiv_mode(acl, &mode);
+			if (error < 0)
+				return error;
+			else {
+				inode->i_mode = mode;
+				if (error == 0)
+					acl = NULL;
+			}
+		}
+		break;
+	case ACL_TYPE_DEFAULT:
+		name = POSIX_ACL_XATTR_DEFAULT;
+		p_acl = &reiserfs_i->i_acl_default;
+		if (!S_ISDIR(inode->i_mode))
+			return acl ? -EACCES : 0;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	if (acl) {
+		value = posix_acl_to_disk(acl, &size);
+		if (IS_ERR(value))
+			return (int)PTR_ERR(value);
+		error = reiserfs_xattr_set(inode, name, value, size, 0);
 	} else {
-            error = reiserfs_xattr_del (inode, name);
-            if (error == -ENODATA) {
-                /* This may seem odd here, but it means that the ACL was set
-                 * with a value representable with mode bits. If there was
-                 * an ACL before, reiserfs_xattr_del already dirtied the inode.
-                 */
-                mark_inode_dirty (inode);
-                error = 0;
-            }
-        }
+		error = reiserfs_xattr_del(inode, name);
+		if (error == -ENODATA) {
+			/* This may seem odd here, but it means that the ACL was set
+			 * with a value representable with mode bits. If there was
+			 * an ACL before, reiserfs_xattr_del already dirtied the inode.
+			 */
+			mark_inode_dirty(inode);
+			error = 0;
+		}
+	}
 
 	if (value)
 		kfree(value);
 
-        if (!error) {
-            /* Release the old one */
-            if (!IS_ERR (*p_acl) && *p_acl)
-                posix_acl_release (*p_acl);
+	if (!error) {
+		/* Release the old one */
+		if (!IS_ERR(*p_acl) && *p_acl)
+			posix_acl_release(*p_acl);
 
-            if (acl == NULL)
-                *p_acl = ERR_PTR (-ENODATA);
-            else
-                *p_acl = posix_acl_dup (acl);
-        }
+		if (acl == NULL)
+			*p_acl = ERR_PTR(-ENODATA);
+		else
+			*p_acl = posix_acl_dup(acl);
+	}
 
 	return error;
 }
@@ -321,192 +316,190 @@ reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 /* dir->i_sem: down,
  * inode is new and not released into the wild yet */
 int
-reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode)
+reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
+			     struct inode *inode)
 {
-    struct posix_acl *acl;
-    int err = 0;
-
-    /* ACLs only get applied to files and directories */
-    if (S_ISLNK (inode->i_mode))
-        return 0;
-
-    /* ACLs can only be used on "new" objects, so if it's an old object
-     * there is nothing to inherit from */
-    if (get_inode_sd_version (dir) == STAT_DATA_V1)
-        goto apply_umask;
-
-    /* Don't apply ACLs to objects in the .reiserfs_priv tree.. This
-     * would be useless since permissions are ignored, and a pain because
-     * it introduces locking cycles */
-    if (is_reiserfs_priv_object (dir)) {
-        reiserfs_mark_inode_private (inode);
-        goto apply_umask;
-    }
-
-    acl = reiserfs_get_acl (dir, ACL_TYPE_DEFAULT);
-    if (IS_ERR (acl)) {
-        if (PTR_ERR (acl) == -ENODATA)
-            goto apply_umask;
-        return PTR_ERR (acl);
-    }
-
-    if (acl) {
-        struct posix_acl *acl_copy;
-        mode_t mode = inode->i_mode;
-        int need_acl;
-
-        /* Copy the default ACL to the default ACL of a new directory */
-        if (S_ISDIR (inode->i_mode)) {
-            err = reiserfs_set_acl (inode, ACL_TYPE_DEFAULT, acl);
-            if (err)
-                goto cleanup;
-        }
-
-        /* Now we reconcile the new ACL and the mode,
-           potentially modifying both */
-        acl_copy = posix_acl_clone (acl, GFP_NOFS);
-        if (!acl_copy) {
-            err = -ENOMEM;
-            goto cleanup;
-        }
-
-
-        need_acl = posix_acl_create_masq (acl_copy, &mode);
-        if (need_acl >= 0) {
-            if (mode != inode->i_mode) {
-                inode->i_mode = mode;
-            }
-
-            /* If we need an ACL.. */
-            if (need_acl > 0) {
-                err = reiserfs_set_acl (inode, ACL_TYPE_ACCESS, acl_copy);
-                if (err)
-                    goto cleanup_copy;
-            }
-        }
-cleanup_copy:
-        posix_acl_release (acl_copy);
-cleanup:
-        posix_acl_release (acl);
-    } else {
-apply_umask:
-        /* no ACL, apply umask */
-        inode->i_mode &= ~current->fs->umask;
-    }
-
-    return err;
+	struct posix_acl *acl;
+	int err = 0;
+
+	/* ACLs only get applied to files and directories */
+	if (S_ISLNK(inode->i_mode))
+		return 0;
+
+	/* ACLs can only be used on "new" objects, so if it's an old object
+	 * there is nothing to inherit from */
+	if (get_inode_sd_version(dir) == STAT_DATA_V1)
+		goto apply_umask;
+
+	/* Don't apply ACLs to objects in the .reiserfs_priv tree.. This
+	 * would be useless since permissions are ignored, and a pain because
+	 * it introduces locking cycles */
+	if (is_reiserfs_priv_object(dir)) {
+		reiserfs_mark_inode_private(inode);
+		goto apply_umask;
+	}
+
+	acl = reiserfs_get_acl(dir, ACL_TYPE_DEFAULT);
+	if (IS_ERR(acl)) {
+		if (PTR_ERR(acl) == -ENODATA)
+			goto apply_umask;
+		return PTR_ERR(acl);
+	}
+
+	if (acl) {
+		struct posix_acl *acl_copy;
+		mode_t mode = inode->i_mode;
+		int need_acl;
+
+		/* Copy the default ACL to the default ACL of a new directory */
+		if (S_ISDIR(inode->i_mode)) {
+			err = reiserfs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
+			if (err)
+				goto cleanup;
+		}
+
+		/* Now we reconcile the new ACL and the mode,
+		   potentially modifying both */
+		acl_copy = posix_acl_clone(acl, GFP_NOFS);
+		if (!acl_copy) {
+			err = -ENOMEM;
+			goto cleanup;
+		}
+
+		need_acl = posix_acl_create_masq(acl_copy, &mode);
+		if (need_acl >= 0) {
+			if (mode != inode->i_mode) {
+				inode->i_mode = mode;
+			}
+
+			/* If we need an ACL.. */
+			if (need_acl > 0) {
+				err =
+				    reiserfs_set_acl(inode, ACL_TYPE_ACCESS,
+						     acl_copy);
+				if (err)
+					goto cleanup_copy;
+			}
+		}
+	      cleanup_copy:
+		posix_acl_release(acl_copy);
+	      cleanup:
+		posix_acl_release(acl);
+	} else {
+	      apply_umask:
+		/* no ACL, apply umask */
+		inode->i_mode &= ~current->fs->umask;
+	}
+
+	return err;
 }
 
 /* Looks up and caches the result of the default ACL.
  * We do this so that we don't need to carry the xattr_sem into
  * reiserfs_new_inode if we don't need to */
-int
-reiserfs_cache_default_acl (struct inode *inode)
+int reiserfs_cache_default_acl(struct inode *inode)
 {
-    int ret = 0;
-    if (reiserfs_posixacl (inode->i_sb) &&
-        !is_reiserfs_priv_object (inode)) {
-        struct posix_acl *acl;
-        reiserfs_read_lock_xattr_i (inode);
-        reiserfs_read_lock_xattrs (inode->i_sb);
-        acl = reiserfs_get_acl (inode, ACL_TYPE_DEFAULT);
-        reiserfs_read_unlock_xattrs (inode->i_sb);
-        reiserfs_read_unlock_xattr_i (inode);
-        ret = acl ? 1 : 0;
-        posix_acl_release (acl);
-    }
-
-    return ret;
+	int ret = 0;
+	if (reiserfs_posixacl(inode->i_sb) && !is_reiserfs_priv_object(inode)) {
+		struct posix_acl *acl;
+		reiserfs_read_lock_xattr_i(inode);
+		reiserfs_read_lock_xattrs(inode->i_sb);
+		acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT);
+		reiserfs_read_unlock_xattrs(inode->i_sb);
+		reiserfs_read_unlock_xattr_i(inode);
+		ret = acl ? 1 : 0;
+		posix_acl_release(acl);
+	}
+
+	return ret;
 }
 
-int
-reiserfs_acl_chmod (struct inode *inode)
+int reiserfs_acl_chmod(struct inode *inode)
 {
-        struct posix_acl *acl, *clone;
-        int error;
+	struct posix_acl *acl, *clone;
+	int error;
 
-        if (S_ISLNK(inode->i_mode))
-                return -EOPNOTSUPP;
+	if (S_ISLNK(inode->i_mode))
+		return -EOPNOTSUPP;
 
-	if (get_inode_sd_version (inode) == STAT_DATA_V1 ||
-	    !reiserfs_posixacl(inode->i_sb))
-        {
-	    return 0;
+	if (get_inode_sd_version(inode) == STAT_DATA_V1 ||
+	    !reiserfs_posixacl(inode->i_sb)) {
+		return 0;
 	}
 
-        reiserfs_read_lock_xattrs (inode->i_sb);
-        acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
-        reiserfs_read_unlock_xattrs (inode->i_sb);
-        if (!acl)
-                return 0;
-        if (IS_ERR(acl))
-                return PTR_ERR(acl);
-        clone = posix_acl_clone(acl, GFP_NOFS);
-        posix_acl_release(acl);
-        if (!clone)
-                return -ENOMEM;
-        error = posix_acl_chmod_masq(clone, inode->i_mode);
-        if (!error) {
-                int lock = !has_xattr_dir (inode);
-                reiserfs_write_lock_xattr_i (inode);
-                if (lock)
-                    reiserfs_write_lock_xattrs (inode->i_sb);
-                else
-                    reiserfs_read_lock_xattrs (inode->i_sb);
-                error = reiserfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
-                if (lock)
-                    reiserfs_write_unlock_xattrs (inode->i_sb);
-                else
-                    reiserfs_read_unlock_xattrs (inode->i_sb);
-                reiserfs_write_unlock_xattr_i (inode);
-        }
-        posix_acl_release(clone);
-        return error;
+	reiserfs_read_lock_xattrs(inode->i_sb);
+	acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
+	reiserfs_read_unlock_xattrs(inode->i_sb);
+	if (!acl)
+		return 0;
+	if (IS_ERR(acl))
+		return PTR_ERR(acl);
+	clone = posix_acl_clone(acl, GFP_NOFS);
+	posix_acl_release(acl);
+	if (!clone)
+		return -ENOMEM;
+	error = posix_acl_chmod_masq(clone, inode->i_mode);
+	if (!error) {
+		int lock = !has_xattr_dir(inode);
+		reiserfs_write_lock_xattr_i(inode);
+		if (lock)
+			reiserfs_write_lock_xattrs(inode->i_sb);
+		else
+			reiserfs_read_lock_xattrs(inode->i_sb);
+		error = reiserfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
+		if (lock)
+			reiserfs_write_unlock_xattrs(inode->i_sb);
+		else
+			reiserfs_read_unlock_xattrs(inode->i_sb);
+		reiserfs_write_unlock_xattr_i(inode);
+	}
+	posix_acl_release(clone);
+	return error;
 }
 
 static int
 posix_acl_access_get(struct inode *inode, const char *name,
-			  void *buffer, size_t size)
+		     void *buffer, size_t size)
 {
-	if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS)-1)
+	if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS) - 1)
 		return -EINVAL;
 	return xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
 }
 
 static int
 posix_acl_access_set(struct inode *inode, const char *name,
-			  const void *value, size_t size, int flags)
+		     const void *value, size_t size, int flags)
 {
-	if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS)-1)
+	if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS) - 1)
 		return -EINVAL;
 	return xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
 }
 
-static int
-posix_acl_access_del (struct inode *inode, const char *name)
+static int posix_acl_access_del(struct inode *inode, const char *name)
 {
-    struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
-    struct posix_acl **acl = &reiserfs_i->i_acl_access;
-    if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS)-1)
-	return -EINVAL;
-    if (!IS_ERR (*acl) && *acl) {
-        posix_acl_release (*acl);
-        *acl = ERR_PTR (-ENODATA);
-    }
-
-    return 0;
+	struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+	struct posix_acl **acl = &reiserfs_i->i_acl_access;
+	if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS) - 1)
+		return -EINVAL;
+	if (!IS_ERR(*acl) && *acl) {
+		posix_acl_release(*acl);
+		*acl = ERR_PTR(-ENODATA);
+	}
+
+	return 0;
 }
 
 static int
-posix_acl_access_list (struct inode *inode, const char *name, int namelen, char *out)
+posix_acl_access_list(struct inode *inode, const char *name, int namelen,
+		      char *out)
 {
-    int len = namelen;
-    if (!reiserfs_posixacl (inode->i_sb))
-        return 0;
-    if (out)
-        memcpy (out, name, len);
+	int len = namelen;
+	if (!reiserfs_posixacl(inode->i_sb))
+		return 0;
+	if (out)
+		memcpy(out, name, len);
 
-    return len;
+	return len;
 }
 
 struct reiserfs_xattr_handler posix_acl_access_handler = {
@@ -518,48 +511,48 @@ struct reiserfs_xattr_handler posix_acl_access_handler = {
 };
 
 static int
-posix_acl_default_get (struct inode *inode, const char *name,
-			   void *buffer, size_t size)
+posix_acl_default_get(struct inode *inode, const char *name,
+		      void *buffer, size_t size)
 {
-	if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT)-1)
+	if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT) - 1)
 		return -EINVAL;
 	return xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size);
 }
 
 static int
 posix_acl_default_set(struct inode *inode, const char *name,
-			   const void *value, size_t size, int flags)
+		      const void *value, size_t size, int flags)
 {
-	if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT)-1)
+	if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT) - 1)
 		return -EINVAL;
 	return xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
 }
 
-static int
-posix_acl_default_del (struct inode *inode, const char *name)
+static int posix_acl_default_del(struct inode *inode, const char *name)
 {
-    struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
-    struct posix_acl **acl = &reiserfs_i->i_acl_default;
-    if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT)-1)
-	return -EINVAL;
-    if (!IS_ERR (*acl) && *acl) {
-        posix_acl_release (*acl);
-        *acl = ERR_PTR (-ENODATA);
-    }
-
-    return 0;
+	struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+	struct posix_acl **acl = &reiserfs_i->i_acl_default;
+	if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT) - 1)
+		return -EINVAL;
+	if (!IS_ERR(*acl) && *acl) {
+		posix_acl_release(*acl);
+		*acl = ERR_PTR(-ENODATA);
+	}
+
+	return 0;
 }
 
 static int
-posix_acl_default_list (struct inode *inode, const char *name, int namelen, char *out)
+posix_acl_default_list(struct inode *inode, const char *name, int namelen,
+		       char *out)
 {
-    int len = namelen;
-    if (!reiserfs_posixacl (inode->i_sb))
-        return 0;
-    if (out)
-        memcpy (out, name, len);
+	int len = namelen;
+	if (!reiserfs_posixacl(inode->i_sb))
+		return 0;
+	if (out)
+		memcpy(out, name, len);
 
-    return len;
+	return len;
 }
 
 struct reiserfs_xattr_handler posix_acl_default_handler = {

+ 26 - 28
fs/reiserfs/xattr_security.c

@@ -9,57 +9,55 @@
 #define XATTR_SECURITY_PREFIX "security."
 
 static int
-security_get (struct inode *inode, const char *name, void *buffer, size_t size)
+security_get(struct inode *inode, const char *name, void *buffer, size_t size)
 {
-    if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
-        return -EINVAL;
+	if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
+		return -EINVAL;
 
-    if (is_reiserfs_priv_object(inode))
-        return -EPERM;
+	if (is_reiserfs_priv_object(inode))
+		return -EPERM;
 
-    return reiserfs_xattr_get (inode, name, buffer, size);
+	return reiserfs_xattr_get(inode, name, buffer, size);
 }
 
 static int
-security_set (struct inode *inode, const char *name, const void *buffer,
-          size_t size, int flags)
+security_set(struct inode *inode, const char *name, const void *buffer,
+	     size_t size, int flags)
 {
-    if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
-        return -EINVAL;
+	if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
+		return -EINVAL;
 
-    if (is_reiserfs_priv_object(inode))
-        return -EPERM;
+	if (is_reiserfs_priv_object(inode))
+		return -EPERM;
 
-    return reiserfs_xattr_set (inode, name, buffer, size, flags);
+	return reiserfs_xattr_set(inode, name, buffer, size, flags);
 }
 
-static int
-security_del (struct inode *inode, const char *name)
+static int security_del(struct inode *inode, const char *name)
 {
-    if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
-        return -EINVAL;
+	if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
+		return -EINVAL;
 
-    if (is_reiserfs_priv_object(inode))
-        return -EPERM;
+	if (is_reiserfs_priv_object(inode))
+		return -EPERM;
 
-    return 0;
+	return 0;
 }
 
 static int
-security_list (struct inode *inode, const char *name, int namelen, char *out)
+security_list(struct inode *inode, const char *name, int namelen, char *out)
 {
-    int len = namelen;
+	int len = namelen;
 
-    if (is_reiserfs_priv_object(inode))
-        return 0;
+	if (is_reiserfs_priv_object(inode))
+		return 0;
 
-    if (out)
-        memcpy (out, name, len);
+	if (out)
+		memcpy(out, name, len);
 
-    return len;
+	return len;
 }
 
-
 struct reiserfs_xattr_handler security_handler = {
 	.prefix = XATTR_SECURITY_PREFIX,
 	.get = security_get,

+ 34 - 36
fs/reiserfs/xattr_trusted.c

@@ -9,69 +9,67 @@
 #define XATTR_TRUSTED_PREFIX "trusted."
 
 static int
-trusted_get (struct inode *inode, const char *name, void *buffer, size_t size)
+trusted_get(struct inode *inode, const char *name, void *buffer, size_t size)
 {
-    if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
-        return -EINVAL;
+	if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
+		return -EINVAL;
 
-    if (!reiserfs_xattrs (inode->i_sb))
-        return -EOPNOTSUPP;
+	if (!reiserfs_xattrs(inode->i_sb))
+		return -EOPNOTSUPP;
 
-    if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
-        return -EPERM;
+	if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
+		return -EPERM;
 
-    return reiserfs_xattr_get (inode, name, buffer, size);
+	return reiserfs_xattr_get(inode, name, buffer, size);
 }
 
 static int
-trusted_set (struct inode *inode, const char *name, const void *buffer,
-          size_t size, int flags)
+trusted_set(struct inode *inode, const char *name, const void *buffer,
+	    size_t size, int flags)
 {
-    if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
-        return -EINVAL;
+	if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
+		return -EINVAL;
 
-    if (!reiserfs_xattrs (inode->i_sb))
-        return -EOPNOTSUPP;
+	if (!reiserfs_xattrs(inode->i_sb))
+		return -EOPNOTSUPP;
 
-    if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
-        return -EPERM;
+	if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
+		return -EPERM;
 
-    return reiserfs_xattr_set (inode, name, buffer, size, flags);
+	return reiserfs_xattr_set(inode, name, buffer, size, flags);
 }
 
-static int
-trusted_del (struct inode *inode, const char *name)
+static int trusted_del(struct inode *inode, const char *name)
 {
-    if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
-        return -EINVAL;
+	if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
+		return -EINVAL;
 
-    if (!reiserfs_xattrs (inode->i_sb))
-        return -EOPNOTSUPP;
+	if (!reiserfs_xattrs(inode->i_sb))
+		return -EOPNOTSUPP;
 
-    if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
-        return -EPERM;
+	if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
+		return -EPERM;
 
-    return 0;
+	return 0;
 }
 
 static int
-trusted_list (struct inode *inode, const char *name, int namelen, char *out)
+trusted_list(struct inode *inode, const char *name, int namelen, char *out)
 {
-    int len = namelen;
+	int len = namelen;
 
-    if (!reiserfs_xattrs (inode->i_sb))
-        return 0;
+	if (!reiserfs_xattrs(inode->i_sb))
+		return 0;
 
-    if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
-        return 0;
+	if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
+		return 0;
 
-    if (out)
-        memcpy (out, name, len);
+	if (out)
+		memcpy(out, name, len);
 
-    return len;
+	return len;
 }
 
-
 struct reiserfs_xattr_handler trusted_handler = {
 	.prefix = XATTR_TRUSTED_PREFIX,
 	.get = trusted_get,

+ 44 - 45
fs/reiserfs/xattr_user.c

@@ -13,81 +13,80 @@
 #define XATTR_USER_PREFIX "user."
 
 static int
-user_get (struct inode *inode, const char *name, void *buffer, size_t size)
+user_get(struct inode *inode, const char *name, void *buffer, size_t size)
 {
 
-    int error;
+	int error;
 
-    if (strlen(name) < sizeof(XATTR_USER_PREFIX))
-        return -EINVAL;
+	if (strlen(name) < sizeof(XATTR_USER_PREFIX))
+		return -EINVAL;
 
-    if (!reiserfs_xattrs_user (inode->i_sb))
-        return -EOPNOTSUPP;
+	if (!reiserfs_xattrs_user(inode->i_sb))
+		return -EOPNOTSUPP;
 
-    error = reiserfs_permission_locked (inode, MAY_READ, NULL);
-    if (error)
-        return error;
+	error = reiserfs_permission_locked(inode, MAY_READ, NULL);
+	if (error)
+		return error;
 
-    return reiserfs_xattr_get (inode, name, buffer, size);
+	return reiserfs_xattr_get(inode, name, buffer, size);
 }
 
 static int
-user_set (struct inode *inode, const char *name, const void *buffer,
-          size_t size, int flags)
+user_set(struct inode *inode, const char *name, const void *buffer,
+	 size_t size, int flags)
 {
 
-    int error;
+	int error;
 
-    if (strlen(name) < sizeof(XATTR_USER_PREFIX))
-        return -EINVAL;
+	if (strlen(name) < sizeof(XATTR_USER_PREFIX))
+		return -EINVAL;
 
-    if (!reiserfs_xattrs_user (inode->i_sb))
-        return -EOPNOTSUPP;
+	if (!reiserfs_xattrs_user(inode->i_sb))
+		return -EOPNOTSUPP;
 
-    if (!S_ISREG (inode->i_mode) &&
-        (!S_ISDIR (inode->i_mode) || inode->i_mode & S_ISVTX))
-        return -EPERM;
+	if (!S_ISREG(inode->i_mode) &&
+	    (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
+		return -EPERM;
 
-    error = reiserfs_permission_locked (inode, MAY_WRITE, NULL);
-    if (error)
-        return error;
+	error = reiserfs_permission_locked(inode, MAY_WRITE, NULL);
+	if (error)
+		return error;
 
-    return reiserfs_xattr_set (inode, name, buffer, size, flags);
+	return reiserfs_xattr_set(inode, name, buffer, size, flags);
 }
 
-static int
-user_del (struct inode *inode, const char *name)
+static int user_del(struct inode *inode, const char *name)
 {
-    int error;
+	int error;
 
-    if (strlen(name) < sizeof(XATTR_USER_PREFIX))
-        return -EINVAL;
+	if (strlen(name) < sizeof(XATTR_USER_PREFIX))
+		return -EINVAL;
 
-    if (!reiserfs_xattrs_user (inode->i_sb))
-        return -EOPNOTSUPP;
+	if (!reiserfs_xattrs_user(inode->i_sb))
+		return -EOPNOTSUPP;
 
-    if (!S_ISREG (inode->i_mode) &&
-        (!S_ISDIR (inode->i_mode) || inode->i_mode & S_ISVTX))
-        return -EPERM;
+	if (!S_ISREG(inode->i_mode) &&
+	    (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
+		return -EPERM;
 
-    error = reiserfs_permission_locked (inode, MAY_WRITE, NULL);
-    if (error)
-        return error;
+	error = reiserfs_permission_locked(inode, MAY_WRITE, NULL);
+	if (error)
+		return error;
 
-    return 0;
+	return 0;
 }
 
 static int
-user_list (struct inode *inode, const char *name, int namelen, char *out)
+user_list(struct inode *inode, const char *name, int namelen, char *out)
 {
-    int len = namelen;
-    if (!reiserfs_xattrs_user (inode->i_sb))
-        return 0;
+	int len = namelen;
+	if (!reiserfs_xattrs_user(inode->i_sb))
+		return 0;
 
-    if (out)
-        memcpy (out, name, len);
+	if (out)
+		memcpy(out, name, len);
 
-    return len;
+	return len;
 }
 
 struct reiserfs_xattr_handler user_handler = {

+ 25 - 27
include/linux/reiserfs_acl.h

@@ -4,29 +4,29 @@
 #define REISERFS_ACL_VERSION	0x0001
 
 typedef struct {
-	__le16		e_tag;
-	__le16		e_perm;
-	__le32		e_id;
+	__le16 e_tag;
+	__le16 e_perm;
+	__le32 e_id;
 } reiserfs_acl_entry;
 
 typedef struct {
-	__le16		e_tag;
-	__le16		e_perm;
+	__le16 e_tag;
+	__le16 e_perm;
 } reiserfs_acl_entry_short;
 
 typedef struct {
-	__le32		a_version;
+	__le32 a_version;
 } reiserfs_acl_header;
 
 static inline size_t reiserfs_acl_size(int count)
 {
 	if (count <= 4) {
 		return sizeof(reiserfs_acl_header) +
-		       count * sizeof(reiserfs_acl_entry_short);
+		    count * sizeof(reiserfs_acl_entry_short);
 	} else {
 		return sizeof(reiserfs_acl_header) +
-		       4 * sizeof(reiserfs_acl_entry_short) +
-		       (count - 4) * sizeof(reiserfs_acl_entry);
+		    4 * sizeof(reiserfs_acl_entry_short) +
+		    (count - 4) * sizeof(reiserfs_acl_entry);
 	}
 }
 
@@ -46,14 +46,14 @@ static inline int reiserfs_acl_count(size_t size)
 	}
 }
 
-
 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
-struct posix_acl * reiserfs_get_acl(struct inode *inode, int type);
-int reiserfs_acl_chmod (struct inode *inode);
-int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode);
-int reiserfs_cache_default_acl (struct inode *dir);
-extern int reiserfs_xattr_posix_acl_init (void) __init;
-extern int reiserfs_xattr_posix_acl_exit (void);
+struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
+int reiserfs_acl_chmod(struct inode *inode);
+int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
+				 struct inode *inode);
+int reiserfs_cache_default_acl(struct inode *dir);
+extern int reiserfs_xattr_posix_acl_init(void) __init;
+extern int reiserfs_xattr_posix_acl_exit(void);
 extern struct reiserfs_xattr_handler posix_acl_default_handler;
 extern struct reiserfs_xattr_handler posix_acl_access_handler;
 #else
@@ -61,28 +61,26 @@ extern struct reiserfs_xattr_handler posix_acl_access_handler;
 #define reiserfs_get_acl NULL
 #define reiserfs_cache_default_acl(inode) 0
 
-static inline int
-reiserfs_xattr_posix_acl_init (void)
+static inline int reiserfs_xattr_posix_acl_init(void)
 {
-    return 0;
+	return 0;
 }
 
-static inline int
-reiserfs_xattr_posix_acl_exit (void)
+static inline int reiserfs_xattr_posix_acl_exit(void)
 {
-    return 0;
+	return 0;
 }
 
-static inline int
-reiserfs_acl_chmod (struct inode *inode)
+static inline int reiserfs_acl_chmod(struct inode *inode)
 {
-    return 0;
+	return 0;
 }
 
 static inline int
-reiserfs_inherit_default_acl (const struct inode *dir, struct dentry *dentry, struct inode *inode)
+reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry,
+			     struct inode *inode)
 {
-    return 0;
+	return 0;
 }
 
 #endif

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 290 - 326
include/linux/reiserfs_fs.h


+ 29 - 30
include/linux/reiserfs_fs_i.h

@@ -10,54 +10,53 @@ typedef enum {
     /** this says what format of key do all items (but stat data) of
       an object have.  If this is set, that format is 3.6 otherwise
       - 3.5 */
-    i_item_key_version_mask    =  0x0001,
+	i_item_key_version_mask = 0x0001,
     /** If this is unset, object has 3.5 stat data, otherwise, it has
       3.6 stat data with 64bit size, 32bit nlink etc. */
-    i_stat_data_version_mask   =  0x0002,
+	i_stat_data_version_mask = 0x0002,
     /** file might need tail packing on close */
-    i_pack_on_close_mask       =  0x0004,
+	i_pack_on_close_mask = 0x0004,
     /** don't pack tail of file */
-    i_nopack_mask              =  0x0008,
+	i_nopack_mask = 0x0008,
     /** If those is set, "safe link" was created for this file during
       truncate or unlink. Safe link is used to avoid leakage of disk
       space on crash with some files open, but unlinked. */
-    i_link_saved_unlink_mask   =  0x0010,
-    i_link_saved_truncate_mask =  0x0020,
-    i_has_xattr_dir            =  0x0040,
-    i_data_log	               =  0x0080,
+	i_link_saved_unlink_mask = 0x0010,
+	i_link_saved_truncate_mask = 0x0020,
+	i_has_xattr_dir = 0x0040,
+	i_data_log = 0x0080,
 } reiserfs_inode_flags;
 
-
 struct reiserfs_inode_info {
-    __u32 i_key [4];/* key is still 4 32 bit integers */
+	__u32 i_key[4];		/* key is still 4 32 bit integers */
     /** transient inode flags that are never stored on disk. Bitmasks
       for this field are defined above. */
-    __u32 i_flags;
+	__u32 i_flags;
 
-    __u32 i_first_direct_byte; // offset of first byte stored in direct item.
+	__u32 i_first_direct_byte;	// offset of first byte stored in direct item.
 
-    /* copy of persistent inode flags read from sd_attrs. */
-    __u32 i_attrs;
+	/* copy of persistent inode flags read from sd_attrs. */
+	__u32 i_attrs;
 
-    int i_prealloc_block; /* first unused block of a sequence of unused blocks */
-    int i_prealloc_count; /* length of that sequence */
-    struct list_head i_prealloc_list; /* per-transaction list of inodes which
-                                       * have preallocated blocks */
+	int i_prealloc_block;	/* first unused block of a sequence of unused blocks */
+	int i_prealloc_count;	/* length of that sequence */
+	struct list_head i_prealloc_list;	/* per-transaction list of inodes which
+						 * have preallocated blocks */
 
-    unsigned new_packing_locality:1;  /* new_packig_locality is created; new blocks
-				       * for the contents of this directory should be
-				       * displaced */
+	unsigned new_packing_locality:1;	/* new_packig_locality is created; new blocks
+						 * for the contents of this directory should be
+						 * displaced */
 
-    /* we use these for fsync or O_SYNC to decide which transaction
-    ** needs to be committed in order for this inode to be properly
-    ** flushed */
-    unsigned long i_trans_id ;
-    struct reiserfs_journal_list *i_jl;
+	/* we use these for fsync or O_SYNC to decide which transaction
+	 ** needs to be committed in order for this inode to be properly
+	 ** flushed */
+	unsigned long i_trans_id;
+	struct reiserfs_journal_list *i_jl;
 
-    struct posix_acl *i_acl_access;
-    struct posix_acl *i_acl_default;
-    struct rw_semaphore xattr_sem;
-    struct inode vfs_inode;
+	struct posix_acl *i_acl_access;
+	struct posix_acl *i_acl_default;
+	struct rw_semaphore xattr_sem;
+	struct inode vfs_inode;
 };
 
 #endif

+ 306 - 310
include/linux/reiserfs_fs_sb.h

@@ -10,7 +10,7 @@
 #endif
 
 typedef enum {
-  reiserfs_attrs_cleared	= 0x00000001,
+	reiserfs_attrs_cleared = 0x00000001,
 } reiserfs_super_block_flags;
 
 /* struct reiserfs_super_block accessors/mutators
@@ -61,7 +61,7 @@ typedef enum {
 #define sb_umount_state(sbp)       (le16_to_cpu((sbp)->s_v1.s_umount_state))
 #define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v))
 #define sb_fs_state(sbp)           (le16_to_cpu((sbp)->s_v1.s_fs_state))
-#define set_sb_fs_state(sbp,v)     ((sbp)->s_v1.s_fs_state = cpu_to_le16(v)) 
+#define set_sb_fs_state(sbp,v)     ((sbp)->s_v1.s_fs_state = cpu_to_le16(v))
 #define sb_hash_function_code(sbp) \
               (le32_to_cpu((sbp)->s_v1.s_hash_function_code))
 #define set_sb_hash_function_code(sbp,v) \
@@ -103,10 +103,10 @@ typedef enum {
 
 /* don't mess with these for a while */
 				/* we have a node size define somewhere in reiserfs_fs.h. -Hans */
-#define JOURNAL_BLOCK_SIZE  4096 /* BUG gotta get rid of this */
-#define JOURNAL_MAX_CNODE   1500 /* max cnodes to allocate. */
-#define JOURNAL_HASH_SIZE 8192   
-#define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating.  Must be >= 2 */
+#define JOURNAL_BLOCK_SIZE  4096	/* BUG gotta get rid of this */
+#define JOURNAL_MAX_CNODE   1500	/* max cnodes to allocate. */
+#define JOURNAL_HASH_SIZE 8192
+#define JOURNAL_NUM_BITMAPS 5	/* number of copies of the bitmaps to have floating.  Must be >= 2 */
 
 /* One of these for every block in every transaction
 ** Each one is in two hash tables.  First, a hash of the current transaction, and after journal_end, a
@@ -117,27 +117,27 @@ typedef enum {
 ** to a given transaction.
 */
 struct reiserfs_journal_cnode {
-  struct buffer_head *bh ;		 /* real buffer head */
-  struct super_block *sb ;		 /* dev of real buffer head */
-  __u32 blocknr ;		 /* block number of real buffer head, == 0 when buffer on disk */
-  long state ;
-  struct reiserfs_journal_list *jlist ;  /* journal list this cnode lives in */
-  struct reiserfs_journal_cnode *next ;  /* next in transaction list */
-  struct reiserfs_journal_cnode *prev ;  /* prev in transaction list */
-  struct reiserfs_journal_cnode *hprev ; /* prev in hash list */
-  struct reiserfs_journal_cnode *hnext ; /* next in hash list */
+	struct buffer_head *bh;	/* real buffer head */
+	struct super_block *sb;	/* dev of real buffer head */
+	__u32 blocknr;		/* block number of real buffer head, == 0 when buffer on disk */
+	long state;
+	struct reiserfs_journal_list *jlist;	/* journal list this cnode lives in */
+	struct reiserfs_journal_cnode *next;	/* next in transaction list */
+	struct reiserfs_journal_cnode *prev;	/* prev in transaction list */
+	struct reiserfs_journal_cnode *hprev;	/* prev in hash list */
+	struct reiserfs_journal_cnode *hnext;	/* next in hash list */
 };
 
 struct reiserfs_bitmap_node {
-  int id ;
-  char *data ;
-  struct list_head list ;
-} ;
+	int id;
+	char *data;
+	struct list_head list;
+};
 
 struct reiserfs_list_bitmap {
-  struct reiserfs_journal_list *journal_list ;
-  struct reiserfs_bitmap_node **bitmaps ;
-} ;
+	struct reiserfs_journal_list *journal_list;
+	struct reiserfs_bitmap_node **bitmaps;
+};
 
 /*
 ** one of these for each transaction.  The most important part here is the j_realblock.
@@ -146,273 +146,269 @@ struct reiserfs_list_bitmap {
 ** and to make sure every real block in a transaction is on disk before allowing the log area
 ** to be overwritten */
 struct reiserfs_journal_list {
-  unsigned long j_start ;
-  unsigned long j_state;
-  unsigned long j_len ;
-  atomic_t j_nonzerolen ;
-  atomic_t j_commit_left ;
-  atomic_t j_older_commits_done ;      /* all commits older than this on disk*/
-  struct semaphore j_commit_lock;
-  unsigned long j_trans_id ;
-  time_t j_timestamp ;
-  struct reiserfs_list_bitmap *j_list_bitmap ;
-  struct buffer_head *j_commit_bh ; /* commit buffer head */
-  struct reiserfs_journal_cnode *j_realblock  ;
-  struct reiserfs_journal_cnode *j_freedlist ; /* list of buffers that were freed during this trans.  free each of these on flush */
-  /* time ordered list of all active transactions */
-  struct list_head j_list;
-
-  /* time ordered list of all transactions we haven't tried to flush yet */
-  struct list_head j_working_list;
-
-  /* list of tail conversion targets in need of flush before commit */
-  struct list_head j_tail_bh_list;
-  /* list of data=ordered buffers in need of flush before commit */
-  struct list_head j_bh_list;
-  int j_refcount;
-} ;
+	unsigned long j_start;
+	unsigned long j_state;
+	unsigned long j_len;
+	atomic_t j_nonzerolen;
+	atomic_t j_commit_left;
+	atomic_t j_older_commits_done;	/* all commits older than this on disk */
+	struct semaphore j_commit_lock;
+	unsigned long j_trans_id;
+	time_t j_timestamp;
+	struct reiserfs_list_bitmap *j_list_bitmap;
+	struct buffer_head *j_commit_bh;	/* commit buffer head */
+	struct reiserfs_journal_cnode *j_realblock;
+	struct reiserfs_journal_cnode *j_freedlist;	/* list of buffers that were freed during this trans.  free each of these on flush */
+	/* time ordered list of all active transactions */
+	struct list_head j_list;
+
+	/* time ordered list of all transactions we haven't tried to flush yet */
+	struct list_head j_working_list;
+
+	/* list of tail conversion targets in need of flush before commit */
+	struct list_head j_tail_bh_list;
+	/* list of data=ordered buffers in need of flush before commit */
+	struct list_head j_bh_list;
+	int j_refcount;
+};
 
 struct reiserfs_journal {
-  struct buffer_head ** j_ap_blocks ; /* journal blocks on disk */
-  struct reiserfs_journal_cnode *j_last ; /* newest journal block */
-  struct reiserfs_journal_cnode *j_first ; /*  oldest journal block.  start here for traverse */
-
-  struct file         *j_dev_file;
-  struct block_device *j_dev_bd;  
-  int j_1st_reserved_block;     /* first block on s_dev of reserved area journal */        
-	
-  long j_state ;			
-  unsigned long j_trans_id ;
-  unsigned long j_mount_id ;
-  unsigned long j_start ;             /* start of current waiting commit (index into j_ap_blocks) */
-  unsigned long j_len ;               /* lenght of current waiting commit */
-  unsigned long j_len_alloc ;         /* number of buffers requested by journal_begin() */
-  atomic_t j_wcount ;            /* count of writers for current commit */
-  unsigned long j_bcount ;            /* batch count. allows turning X transactions into 1 */
-  unsigned long j_first_unflushed_offset ;  /* first unflushed transactions offset */
-  unsigned long j_last_flush_trans_id ;    /* last fully flushed journal timestamp */
-  struct buffer_head *j_header_bh ;   
-
-  time_t j_trans_start_time ;         /* time this transaction started */
-  struct semaphore j_lock;
-  struct semaphore j_flush_sem;
-  wait_queue_head_t j_join_wait ;    /* wait for current transaction to finish before starting new one */
-  atomic_t j_jlock ;                       /* lock for j_join_wait */
-  int j_list_bitmap_index ;	      /* number of next list bitmap to use */
-  int j_must_wait ;		       /* no more journal begins allowed. MUST sleep on j_join_wait */
-  int j_next_full_flush ;             /* next journal_end will flush all journal list */
-  int j_next_async_flush ;             /* next journal_end will flush all async commits */
-
-  int j_cnode_used ;	      /* number of cnodes on the used list */
-  int j_cnode_free ;          /* number of cnodes on the free list */
-
-  unsigned int j_trans_max ;           /* max number of blocks in a transaction.  */
-  unsigned int j_max_batch ;           /* max number of blocks to batch into a trans */
-  unsigned int j_max_commit_age ;      /* in seconds, how old can an async commit be */
-  unsigned int j_max_trans_age ;       /* in seconds, how old can a transaction be */
-  unsigned int j_default_max_commit_age ; /* the default for the max commit age */
-
-  struct reiserfs_journal_cnode *j_cnode_free_list ;
-  struct reiserfs_journal_cnode *j_cnode_free_orig ; /* orig pointer returned from vmalloc */
-
-  struct reiserfs_journal_list *j_current_jl;
-  int j_free_bitmap_nodes ;
-  int j_used_bitmap_nodes ;
-
-  int j_num_lists;      /* total number of active transactions */
-  int j_num_work_lists; /* number that need attention from kreiserfsd */
-
-  /* debugging to make sure things are flushed in order */
-  int j_last_flush_id;
-
-  /* debugging to make sure things are committed in order */
-  int j_last_commit_id;
-
-  struct list_head j_bitmap_nodes ;
-  struct list_head j_dirty_buffers ;
-  spinlock_t j_dirty_buffers_lock ; /* protects j_dirty_buffers */
-
-  /* list of all active transactions */
-  struct list_head j_journal_list;
-  /* lists that haven't been touched by writeback attempts */
-  struct list_head j_working_list;
-
-  struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS] ;	/* array of bitmaps to record the deleted blocks */
-  struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE] ; 	    /* hash table for real buffer heads in current trans */ 
-  struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for all the real buffer heads in all 
-  										the transactions */
-  struct list_head j_prealloc_list;     /* list of inodes which have preallocated blocks */
-  int j_persistent_trans;
-  unsigned long j_max_trans_size ;
-  unsigned long j_max_batch_size ;
-
-  int j_errno;
-
-  /* when flushing ordered buffers, throttle new ordered writers */
-  struct work_struct j_work;
-  atomic_t j_async_throttle;
+	struct buffer_head **j_ap_blocks;	/* journal blocks on disk */
+	struct reiserfs_journal_cnode *j_last;	/* newest journal block */
+	struct reiserfs_journal_cnode *j_first;	/*  oldest journal block.  start here for traverse */
+
+	struct file *j_dev_file;
+	struct block_device *j_dev_bd;
+	int j_1st_reserved_block;	/* first block on s_dev of reserved area journal */
+
+	long j_state;
+	unsigned long j_trans_id;
+	unsigned long j_mount_id;
+	unsigned long j_start;	/* start of current waiting commit (index into j_ap_blocks) */
+	unsigned long j_len;	/* lenght of current waiting commit */
+	unsigned long j_len_alloc;	/* number of buffers requested by journal_begin() */
+	atomic_t j_wcount;	/* count of writers for current commit */
+	unsigned long j_bcount;	/* batch count. allows turning X transactions into 1 */
+	unsigned long j_first_unflushed_offset;	/* first unflushed transactions offset */
+	unsigned long j_last_flush_trans_id;	/* last fully flushed journal timestamp */
+	struct buffer_head *j_header_bh;
+
+	time_t j_trans_start_time;	/* time this transaction started */
+	struct semaphore j_lock;
+	struct semaphore j_flush_sem;
+	wait_queue_head_t j_join_wait;	/* wait for current transaction to finish before starting new one */
+	atomic_t j_jlock;	/* lock for j_join_wait */
+	int j_list_bitmap_index;	/* number of next list bitmap to use */
+	int j_must_wait;	/* no more journal begins allowed. MUST sleep on j_join_wait */
+	int j_next_full_flush;	/* next journal_end will flush all journal list */
+	int j_next_async_flush;	/* next journal_end will flush all async commits */
+
+	int j_cnode_used;	/* number of cnodes on the used list */
+	int j_cnode_free;	/* number of cnodes on the free list */
+
+	unsigned int j_trans_max;	/* max number of blocks in a transaction.  */
+	unsigned int j_max_batch;	/* max number of blocks to batch into a trans */
+	unsigned int j_max_commit_age;	/* in seconds, how old can an async commit be */
+	unsigned int j_max_trans_age;	/* in seconds, how old can a transaction be */
+	unsigned int j_default_max_commit_age;	/* the default for the max commit age */
+
+	struct reiserfs_journal_cnode *j_cnode_free_list;
+	struct reiserfs_journal_cnode *j_cnode_free_orig;	/* orig pointer returned from vmalloc */
+
+	struct reiserfs_journal_list *j_current_jl;
+	int j_free_bitmap_nodes;
+	int j_used_bitmap_nodes;
+
+	int j_num_lists;	/* total number of active transactions */
+	int j_num_work_lists;	/* number that need attention from kreiserfsd */
+
+	/* debugging to make sure things are flushed in order */
+	int j_last_flush_id;
+
+	/* debugging to make sure things are committed in order */
+	int j_last_commit_id;
+
+	struct list_head j_bitmap_nodes;
+	struct list_head j_dirty_buffers;
+	spinlock_t j_dirty_buffers_lock;	/* protects j_dirty_buffers */
+
+	/* list of all active transactions */
+	struct list_head j_journal_list;
+	/* lists that haven't been touched by writeback attempts */
+	struct list_head j_working_list;
+
+	struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS];	/* array of bitmaps to record the deleted blocks */
+	struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE];	/* hash table for real buffer heads in current trans */
+	struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE];	/* hash table for all the real buffer heads in all 
+										   the transactions */
+	struct list_head j_prealloc_list;	/* list of inodes which have preallocated blocks */
+	int j_persistent_trans;
+	unsigned long j_max_trans_size;
+	unsigned long j_max_batch_size;
+
+	int j_errno;
+
+	/* when flushing ordered buffers, throttle new ordered writers */
+	struct work_struct j_work;
+	atomic_t j_async_throttle;
 };
 
 enum journal_state_bits {
-    J_WRITERS_BLOCKED = 1,   /* set when new writers not allowed */
-    J_WRITERS_QUEUED,        /* set when log is full due to too many writers */
-    J_ABORTED,               /* set when log is aborted */
+	J_WRITERS_BLOCKED = 1,	/* set when new writers not allowed */
+	J_WRITERS_QUEUED,	/* set when log is full due to too many writers */
+	J_ABORTED,		/* set when log is aborted */
 };
 
+#define JOURNAL_DESC_MAGIC "ReIsErLB"	/* ick.  magic string to find desc blocks in the journal */
 
-#define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick.  magic string to find desc blocks in the journal */
+typedef __u32(*hashf_t) (const signed char *, int);
 
-typedef __u32 (*hashf_t) (const signed char *, int);
-
-struct reiserfs_bitmap_info
-{
-    // FIXME: Won't work with block sizes > 8K
-    __u16  first_zero_hint;
-    __u16  free_count;
-    struct buffer_head *bh; /* the actual bitmap */
+struct reiserfs_bitmap_info {
+	// FIXME: Won't work with block sizes > 8K
+	__u16 first_zero_hint;
+	__u16 free_count;
+	struct buffer_head *bh;	/* the actual bitmap */
 };
 
 struct proc_dir_entry;
 
 #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO )
 typedef unsigned long int stat_cnt_t;
-typedef struct reiserfs_proc_info_data
-{
-  spinlock_t lock;
-  int exiting;
-  int max_hash_collisions;
-
-  stat_cnt_t breads;
-  stat_cnt_t bread_miss;
-  stat_cnt_t search_by_key;
-  stat_cnt_t search_by_key_fs_changed;
-  stat_cnt_t search_by_key_restarted;
-
-  stat_cnt_t insert_item_restarted;
-  stat_cnt_t paste_into_item_restarted;
-  stat_cnt_t cut_from_item_restarted;
-  stat_cnt_t delete_solid_item_restarted;
-  stat_cnt_t delete_item_restarted;
-
-  stat_cnt_t leaked_oid;
-  stat_cnt_t leaves_removable;
-
-  /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */
-  stat_cnt_t balance_at[ 5 ]; /* XXX */
-  /* sbk == search_by_key */
-  stat_cnt_t sbk_read_at[ 5 ]; /* XXX */
-  stat_cnt_t sbk_fs_changed[ 5 ];
-  stat_cnt_t sbk_restarted[ 5 ];
-  stat_cnt_t items_at[ 5 ]; /* XXX */
-  stat_cnt_t free_at[ 5 ]; /* XXX */
-  stat_cnt_t can_node_be_removed[ 5 ]; /* XXX */
-  long int lnum[ 5 ]; /* XXX */
-  long int rnum[ 5 ]; /* XXX */
-  long int lbytes[ 5 ]; /* XXX */
-  long int rbytes[ 5 ]; /* XXX */
-  stat_cnt_t get_neighbors[ 5 ];
-  stat_cnt_t get_neighbors_restart[ 5 ];
-  stat_cnt_t need_l_neighbor[ 5 ];
-  stat_cnt_t need_r_neighbor[ 5 ];
-
-  stat_cnt_t free_block;
-  struct __scan_bitmap_stats {
-	stat_cnt_t call;
-	stat_cnt_t wait;
-	stat_cnt_t bmap;
-	stat_cnt_t retry;
-	stat_cnt_t in_journal_hint;
-	stat_cnt_t in_journal_nohint;
-	stat_cnt_t stolen;
-  } scan_bitmap;
-  struct __journal_stats {
-	stat_cnt_t in_journal;
-	stat_cnt_t in_journal_bitmap;
-	stat_cnt_t in_journal_reusable;
-	stat_cnt_t lock_journal;
-	stat_cnt_t lock_journal_wait;
-	stat_cnt_t journal_being;
-	stat_cnt_t journal_relock_writers;
-	stat_cnt_t journal_relock_wcount;
-	stat_cnt_t mark_dirty;
-	stat_cnt_t mark_dirty_already;
-	stat_cnt_t mark_dirty_notjournal;
-	stat_cnt_t restore_prepared;
-	stat_cnt_t prepare;
-	stat_cnt_t prepare_retry;
-  } journal;
+typedef struct reiserfs_proc_info_data {
+	spinlock_t lock;
+	int exiting;
+	int max_hash_collisions;
+
+	stat_cnt_t breads;
+	stat_cnt_t bread_miss;
+	stat_cnt_t search_by_key;
+	stat_cnt_t search_by_key_fs_changed;
+	stat_cnt_t search_by_key_restarted;
+
+	stat_cnt_t insert_item_restarted;
+	stat_cnt_t paste_into_item_restarted;
+	stat_cnt_t cut_from_item_restarted;
+	stat_cnt_t delete_solid_item_restarted;
+	stat_cnt_t delete_item_restarted;
+
+	stat_cnt_t leaked_oid;
+	stat_cnt_t leaves_removable;
+
+	/* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */
+	stat_cnt_t balance_at[5];	/* XXX */
+	/* sbk == search_by_key */
+	stat_cnt_t sbk_read_at[5];	/* XXX */
+	stat_cnt_t sbk_fs_changed[5];
+	stat_cnt_t sbk_restarted[5];
+	stat_cnt_t items_at[5];	/* XXX */
+	stat_cnt_t free_at[5];	/* XXX */
+	stat_cnt_t can_node_be_removed[5];	/* XXX */
+	long int lnum[5];	/* XXX */
+	long int rnum[5];	/* XXX */
+	long int lbytes[5];	/* XXX */
+	long int rbytes[5];	/* XXX */
+	stat_cnt_t get_neighbors[5];
+	stat_cnt_t get_neighbors_restart[5];
+	stat_cnt_t need_l_neighbor[5];
+	stat_cnt_t need_r_neighbor[5];
+
+	stat_cnt_t free_block;
+	struct __scan_bitmap_stats {
+		stat_cnt_t call;
+		stat_cnt_t wait;
+		stat_cnt_t bmap;
+		stat_cnt_t retry;
+		stat_cnt_t in_journal_hint;
+		stat_cnt_t in_journal_nohint;
+		stat_cnt_t stolen;
+	} scan_bitmap;
+	struct __journal_stats {
+		stat_cnt_t in_journal;
+		stat_cnt_t in_journal_bitmap;
+		stat_cnt_t in_journal_reusable;
+		stat_cnt_t lock_journal;
+		stat_cnt_t lock_journal_wait;
+		stat_cnt_t journal_being;
+		stat_cnt_t journal_relock_writers;
+		stat_cnt_t journal_relock_wcount;
+		stat_cnt_t mark_dirty;
+		stat_cnt_t mark_dirty_already;
+		stat_cnt_t mark_dirty_notjournal;
+		stat_cnt_t restore_prepared;
+		stat_cnt_t prepare;
+		stat_cnt_t prepare_retry;
+	} journal;
 } reiserfs_proc_info_data_t;
 #else
-typedef struct reiserfs_proc_info_data
-{} reiserfs_proc_info_data_t;
+typedef struct reiserfs_proc_info_data {
+} reiserfs_proc_info_data_t;
 #endif
 
 /* reiserfs union of in-core super block data */
-struct reiserfs_sb_info
-{
-    struct buffer_head * s_sbh;                   /* Buffer containing the super block */
-				/* both the comment and the choice of
-                                   name are unclear for s_rs -Hans */
-    struct reiserfs_super_block * s_rs;           /* Pointer to the super block in the buffer */
-    struct reiserfs_bitmap_info * s_ap_bitmap;
-    struct reiserfs_journal *s_journal ;		/* pointer to journal information */
-    unsigned short s_mount_state;                 /* reiserfs state (valid, invalid) */
-  
-				/* Comment? -Hans */
-    void (*end_io_handler)(struct buffer_head *, int);
-    hashf_t s_hash_function;	/* pointer to function which is used
-                                   to sort names in directory. Set on
-                                   mount */
-    unsigned long s_mount_opt;	/* reiserfs's mount options are set
-                                   here (currently - NOTAIL, NOLOG,
-                                   REPLAYONLY) */
-
-    struct {			/* This is a structure that describes block allocator options */
-	unsigned long bits;	/* Bitfield for enable/disable kind of options */
-	unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */
-	int border;		/* percentage of disk, border takes */
-	int preallocmin;	/* Minimal file size (in blocks) starting from which we do preallocations */
-	int preallocsize;	/* Number of blocks we try to prealloc when file
-				   reaches preallocmin size (in blocks) or
-				   prealloc_list is empty. */
-    } s_alloc_options;
-
-				/* Comment? -Hans */
-    wait_queue_head_t s_wait;
-				/* To be obsoleted soon by per buffer seals.. -Hans */
-    atomic_t s_generation_counter; // increased by one every time the
-    // tree gets re-balanced
-    unsigned long s_properties;    /* File system properties. Currently holds
-				     on-disk FS format */
-    
-    /* session statistics */
-    int s_kmallocs;
-    int s_disk_reads;
-    int s_disk_writes;
-    int s_fix_nodes;
-    int s_do_balance;
-    int s_unneeded_left_neighbor;
-    int s_good_search_by_key_reada;
-    int s_bmaps;
-    int s_bmaps_without_search;
-    int s_direct2indirect;
-    int s_indirect2direct;
+struct reiserfs_sb_info {
+	struct buffer_head *s_sbh;	/* Buffer containing the super block */
+	/* both the comment and the choice of
+	   name are unclear for s_rs -Hans */
+	struct reiserfs_super_block *s_rs;	/* Pointer to the super block in the buffer */
+	struct reiserfs_bitmap_info *s_ap_bitmap;
+	struct reiserfs_journal *s_journal;	/* pointer to journal information */
+	unsigned short s_mount_state;	/* reiserfs state (valid, invalid) */
+
+	/* Comment? -Hans */
+	void (*end_io_handler) (struct buffer_head *, int);
+	hashf_t s_hash_function;	/* pointer to function which is used
+					   to sort names in directory. Set on
+					   mount */
+	unsigned long s_mount_opt;	/* reiserfs's mount options are set
+					   here (currently - NOTAIL, NOLOG,
+					   REPLAYONLY) */
+
+	struct {		/* This is a structure that describes block allocator options */
+		unsigned long bits;	/* Bitfield for enable/disable kind of options */
+		unsigned long large_file_size;	/* size started from which we consider file to be a large one(in blocks) */
+		int border;	/* percentage of disk, border takes */
+		int preallocmin;	/* Minimal file size (in blocks) starting from which we do preallocations */
+		int preallocsize;	/* Number of blocks we try to prealloc when file
+					   reaches preallocmin size (in blocks) or
+					   prealloc_list is empty. */
+	} s_alloc_options;
+
+	/* Comment? -Hans */
+	wait_queue_head_t s_wait;
+	/* To be obsoleted soon by per buffer seals.. -Hans */
+	atomic_t s_generation_counter;	// increased by one every time the
+	// tree gets re-balanced
+	unsigned long s_properties;	/* File system properties. Currently holds
+					   on-disk FS format */
+
+	/* session statistics */
+	int s_kmallocs;
+	int s_disk_reads;
+	int s_disk_writes;
+	int s_fix_nodes;
+	int s_do_balance;
+	int s_unneeded_left_neighbor;
+	int s_good_search_by_key_reada;
+	int s_bmaps;
+	int s_bmaps_without_search;
+	int s_direct2indirect;
+	int s_indirect2direct;
 	/* set up when it's ok for reiserfs_read_inode2() to read from
 	   disk inode with nlink==0. Currently this is only used during
 	   finish_unfinished() processing at mount time */
-    int s_is_unlinked_ok;
-    reiserfs_proc_info_data_t s_proc_info_data;
-    struct proc_dir_entry *procdir;
-    int reserved_blocks; /* amount of blocks reserved for further allocations */
-    spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */
-    struct dentry *priv_root; /* root of /.reiserfs_priv */
-    struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */
-    struct rw_semaphore xattr_dir_sem;
-
-    int j_errno;
+	int s_is_unlinked_ok;
+	reiserfs_proc_info_data_t s_proc_info_data;
+	struct proc_dir_entry *procdir;
+	int reserved_blocks;	/* amount of blocks reserved for further allocations */
+	spinlock_t bitmap_lock;	/* this lock on now only used to protect reserved_blocks variable */
+	struct dentry *priv_root;	/* root of /.reiserfs_priv */
+	struct dentry *xattr_root;	/* root of /.reiserfs_priv/.xa */
+	struct rw_semaphore xattr_dir_sem;
+
+	int j_errno;
 #ifdef CONFIG_QUOTA
-    char *s_qf_names[MAXQUOTAS];
-    int s_jquota_fmt;
+	char *s_qf_names[MAXQUOTAS];
+	int s_jquota_fmt;
 #endif
 };
 
@@ -422,14 +418,14 @@ struct reiserfs_sb_info
 
 enum reiserfs_mount_options {
 /* Mount options */
-    REISERFS_LARGETAIL,  /* large tails will be created in a session */
-    REISERFS_SMALLTAIL,  /* small (for files less than block size) tails will be created in a session */
-    REPLAYONLY, /* replay journal and return 0. Use by fsck */
-    REISERFS_CONVERT,    /* -o conv: causes conversion of old
-                                 format super block to the new
-                                 format. If not specified - old
-                                 partition will be dealt with in a
-                                 manner of 3.5.x */
+	REISERFS_LARGETAIL,	/* large tails will be created in a session */
+	REISERFS_SMALLTAIL,	/* small (for files less than block size) tails will be created in a session */
+	REPLAYONLY,		/* replay journal and return 0. Use by fsck */
+	REISERFS_CONVERT,	/* -o conv: causes conversion of old
+				   format super block to the new
+				   format. If not specified - old
+				   partition will be dealt with in a
+				   manner of 3.5.x */
 
 /* -o hash={tea, rupasov, r5, detect} is meant for properly mounting 
 ** reiserfs disks from 3.5.19 or earlier.  99% of the time, this option
@@ -439,41 +435,41 @@ enum reiserfs_mount_options {
 ** the existing hash on the FS, so if you have a tea hash disk, and mount
 ** with -o hash=rupasov, the mount will fail.
 */
-    FORCE_TEA_HASH,      /* try to force tea hash on mount */
-    FORCE_RUPASOV_HASH,  /* try to force rupasov hash on mount */
-    FORCE_R5_HASH,       /* try to force rupasov hash on mount */
-    FORCE_HASH_DETECT,   /* try to detect hash function on mount */
+	FORCE_TEA_HASH,		/* try to force tea hash on mount */
+	FORCE_RUPASOV_HASH,	/* try to force rupasov hash on mount */
+	FORCE_R5_HASH,		/* try to force rupasov hash on mount */
+	FORCE_HASH_DETECT,	/* try to detect hash function on mount */
 
-    REISERFS_DATA_LOG,
-    REISERFS_DATA_ORDERED,
-    REISERFS_DATA_WRITEBACK,
+	REISERFS_DATA_LOG,
+	REISERFS_DATA_ORDERED,
+	REISERFS_DATA_WRITEBACK,
 
 /* used for testing experimental features, makes benchmarking new
    features with and without more convenient, should never be used by
    users in any code shipped to users (ideally) */
 
-    REISERFS_NO_BORDER,
-    REISERFS_NO_UNHASHED_RELOCATION,
-    REISERFS_HASHED_RELOCATION,
-    REISERFS_ATTRS,
-    REISERFS_XATTRS,
-    REISERFS_XATTRS_USER,
-    REISERFS_POSIXACL,
-    REISERFS_BARRIER_NONE,
-    REISERFS_BARRIER_FLUSH,
-
-    /* Actions on error */
-    REISERFS_ERROR_PANIC,
-    REISERFS_ERROR_RO,
-    REISERFS_ERROR_CONTINUE,
-
-    REISERFS_QUOTA,		/* Some quota option specified */
-
-    REISERFS_TEST1,
-    REISERFS_TEST2,
-    REISERFS_TEST3,
-    REISERFS_TEST4,
-    REISERFS_UNSUPPORTED_OPT,
+	REISERFS_NO_BORDER,
+	REISERFS_NO_UNHASHED_RELOCATION,
+	REISERFS_HASHED_RELOCATION,
+	REISERFS_ATTRS,
+	REISERFS_XATTRS,
+	REISERFS_XATTRS_USER,
+	REISERFS_POSIXACL,
+	REISERFS_BARRIER_NONE,
+	REISERFS_BARRIER_FLUSH,
+
+	/* Actions on error */
+	REISERFS_ERROR_PANIC,
+	REISERFS_ERROR_RO,
+	REISERFS_ERROR_CONTINUE,
+
+	REISERFS_QUOTA,		/* Some quota option specified */
+
+	REISERFS_TEST1,
+	REISERFS_TEST2,
+	REISERFS_TEST3,
+	REISERFS_TEST4,
+	REISERFS_UNSUPPORTED_OPT,
 };
 
 #define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH))
@@ -504,18 +500,17 @@ enum reiserfs_mount_options {
 #define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC))
 #define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO))
 
-void reiserfs_file_buffer (struct buffer_head * bh, int list);
+void reiserfs_file_buffer(struct buffer_head *bh, int list);
 extern struct file_system_type reiserfs_fs_type;
-int reiserfs_resize(struct super_block *, unsigned long) ;
+int reiserfs_resize(struct super_block *, unsigned long);
 
 #define CARRY_ON                0
 #define SCHEDULE_OCCURRED       1
 
-
 #define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh)
 #define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal)
 #define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block)
-#define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) 
+#define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free)
 #define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap)
 
 #define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->)
@@ -525,13 +520,14 @@ int reiserfs_resize(struct super_block *, unsigned long) ;
  */
 static inline char *reiserfs_bdevname(struct super_block *s)
 {
-        return (s == NULL) ? "Null superblock" : s -> s_id;
+	return (s == NULL) ? "Null superblock" : s->s_id;
 }
 
 #define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal)))
-static inline int __reiserfs_is_journal_aborted (struct reiserfs_journal *journal)
+static inline int __reiserfs_is_journal_aborted(struct reiserfs_journal
+						*journal)
 {
-    return test_bit (J_ABORTED, &journal->j_state);
+	return test_bit(J_ABORTED, &journal->j_state);
 }
 
-#endif	/* _LINUX_REISER_FS_SB */
+#endif				/* _LINUX_REISER_FS_SB */

+ 62 - 64
include/linux/reiserfs_xattr.h

@@ -7,48 +7,48 @@
 #include <linux/xattr.h>
 
 /* Magic value in header */
-#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */
+#define REISERFS_XATTR_MAGIC 0x52465841	/* "RFXA" */
 
 struct reiserfs_xattr_header {
-    __le32 h_magic;              /* magic number for identification */
-    __le32 h_hash;               /* hash of the value */
+	__le32 h_magic;		/* magic number for identification */
+	__le32 h_hash;		/* hash of the value */
 };
 
 #ifdef __KERNEL__
 
 struct reiserfs_xattr_handler {
 	char *prefix;
-        int (*init)(void);
-        void (*exit)(void);
-	int (*get)(struct inode *inode, const char *name, void *buffer,
-		   size_t size);
-	int (*set)(struct inode *inode, const char *name, const void *buffer,
-		   size_t size, int flags);
-	int (*del)(struct inode *inode, const char *name);
-        int (*list)(struct inode *inode, const char *name, int namelen, char *out);
-        struct list_head handlers;
+	int (*init) (void);
+	void (*exit) (void);
+	int (*get) (struct inode * inode, const char *name, void *buffer,
+		    size_t size);
+	int (*set) (struct inode * inode, const char *name, const void *buffer,
+		    size_t size, int flags);
+	int (*del) (struct inode * inode, const char *name);
+	int (*list) (struct inode * inode, const char *name, int namelen,
+		     char *out);
+	struct list_head handlers;
 };
 
-
 #ifdef CONFIG_REISERFS_FS_XATTR
 #define is_reiserfs_priv_object(inode) IS_PRIVATE(inode)
 #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
-ssize_t reiserfs_getxattr (struct dentry *dentry, const char *name,
-			   void *buffer, size_t size);
-int reiserfs_setxattr (struct dentry *dentry, const char *name,
-                       const void *value, size_t size, int flags);
-ssize_t reiserfs_listxattr (struct dentry *dentry, char *buffer, size_t size);
-int reiserfs_removexattr (struct dentry *dentry, const char *name);
-int reiserfs_delete_xattrs (struct inode *inode);
-int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs);
-int reiserfs_xattr_init (struct super_block *sb, int mount_flags);
-int reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd);
-int reiserfs_permission_locked (struct inode *inode, int mask, struct nameidata *nd);
-
-int reiserfs_xattr_del (struct inode *, const char *);
-int reiserfs_xattr_get (const struct inode *, const char *, void *, size_t);
-int reiserfs_xattr_set (struct inode *, const char *, const void *,
-                               size_t, int);
+ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
+			  void *buffer, size_t size);
+int reiserfs_setxattr(struct dentry *dentry, const char *name,
+		      const void *value, size_t size, int flags);
+ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
+int reiserfs_removexattr(struct dentry *dentry, const char *name);
+int reiserfs_delete_xattrs(struct inode *inode);
+int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
+int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
+int reiserfs_permission(struct inode *inode, int mask, struct nameidata *nd);
+int reiserfs_permission_locked(struct inode *inode, int mask,
+			       struct nameidata *nd);
+
+int reiserfs_xattr_del(struct inode *, const char *);
+int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
+int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
 
 extern struct reiserfs_xattr_handler user_handler;
 extern struct reiserfs_xattr_handler trusted_handler;
@@ -56,57 +56,48 @@ extern struct reiserfs_xattr_handler trusted_handler;
 extern struct reiserfs_xattr_handler security_handler;
 #endif
 
-int reiserfs_xattr_register_handlers (void) __init;
-void reiserfs_xattr_unregister_handlers (void);
+int reiserfs_xattr_register_handlers(void) __init;
+void reiserfs_xattr_unregister_handlers(void);
 
-static inline void
-reiserfs_write_lock_xattrs(struct super_block *sb)
+static inline void reiserfs_write_lock_xattrs(struct super_block *sb)
 {
-    down_write (&REISERFS_XATTR_DIR_SEM(sb));
+	down_write(&REISERFS_XATTR_DIR_SEM(sb));
 }
-static inline void
-reiserfs_write_unlock_xattrs(struct super_block *sb)
+static inline void reiserfs_write_unlock_xattrs(struct super_block *sb)
 {
-    up_write (&REISERFS_XATTR_DIR_SEM(sb));
+	up_write(&REISERFS_XATTR_DIR_SEM(sb));
 }
-static inline void
-reiserfs_read_lock_xattrs(struct super_block *sb)
+static inline void reiserfs_read_lock_xattrs(struct super_block *sb)
 {
-    down_read (&REISERFS_XATTR_DIR_SEM(sb));
+	down_read(&REISERFS_XATTR_DIR_SEM(sb));
 }
 
-static inline void
-reiserfs_read_unlock_xattrs(struct super_block *sb)
+static inline void reiserfs_read_unlock_xattrs(struct super_block *sb)
 {
-    up_read (&REISERFS_XATTR_DIR_SEM(sb));
+	up_read(&REISERFS_XATTR_DIR_SEM(sb));
 }
 
-static inline void
-reiserfs_write_lock_xattr_i(struct inode *inode)
+static inline void reiserfs_write_lock_xattr_i(struct inode *inode)
 {
-    down_write (&REISERFS_I(inode)->xattr_sem);
+	down_write(&REISERFS_I(inode)->xattr_sem);
 }
-static inline void
-reiserfs_write_unlock_xattr_i(struct inode *inode)
+static inline void reiserfs_write_unlock_xattr_i(struct inode *inode)
 {
-    up_write (&REISERFS_I(inode)->xattr_sem);
+	up_write(&REISERFS_I(inode)->xattr_sem);
 }
-static inline void
-reiserfs_read_lock_xattr_i(struct inode *inode)
+static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
 {
-    down_read (&REISERFS_I(inode)->xattr_sem);
+	down_read(&REISERFS_I(inode)->xattr_sem);
 }
 
-static inline void
-reiserfs_read_unlock_xattr_i(struct inode *inode)
+static inline void reiserfs_read_unlock_xattr_i(struct inode *inode)
 {
-    up_read (&REISERFS_I(inode)->xattr_sem);
+	up_read(&REISERFS_I(inode)->xattr_sem);
 }
 
-static inline void
-reiserfs_mark_inode_private(struct inode *inode)
+static inline void reiserfs_mark_inode_private(struct inode *inode)
 {
-    inode->i_flags |= S_PRIVATE;
+	inode->i_flags |= S_PRIVATE;
 }
 
 #else
@@ -127,13 +118,20 @@ reiserfs_mark_inode_private(struct inode *inode)
 #define reiserfs_xattr_register_handlers() 0
 #define reiserfs_xattr_unregister_handlers()
 
-static inline int reiserfs_delete_xattrs (struct inode *inode) { return 0; };
-static inline int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs) { return 0; };
-static inline int reiserfs_xattr_init (struct super_block *sb, int mount_flags)
+static inline int reiserfs_delete_xattrs(struct inode *inode)
+{
+	return 0;
+};
+static inline int reiserfs_chown_xattrs(struct inode *inode,
+					struct iattr *attrs)
+{
+	return 0;
+};
+static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
 {
-    sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
-    return 0;
+	sb->s_flags = (sb->s_flags & ~MS_POSIXACL);	/* to be sure */
+	return 0;
 };
 #endif
 
-#endif  /* __KERNEL__ */
+#endif				/* __KERNEL__ */

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است