diff options
author | Jeff Mahoney <jeffm@suse.com> | 2014-04-23 16:00:36 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2014-05-06 22:52:19 +0200 |
commit | 098297b27d23ad9d0fc302e3417474d9342c6c14 (patch) | |
tree | 58f2054cd9933225ef1ae9c7febedc9160041af6 /fs/reiserfs/lbalance.c | |
parent | reiserfs: cleanup, rename key and item accessors to more friendly names (diff) | |
download | linux-098297b27d23ad9d0fc302e3417474d9342c6c14.tar.xz linux-098297b27d23ad9d0fc302e3417474d9342c6c14.zip |
reiserfs: cleanup, reformat comments to normal kernel style
This patch reformats comments in the reiserfs code to fit in 80 columns and
to follow the style rules.
There is no functional change but it helps make my eyes bleed less.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/reiserfs/lbalance.c')
-rw-r--r-- | fs/reiserfs/lbalance.c | 349 |
1 files changed, 232 insertions, 117 deletions
diff --git a/fs/reiserfs/lbalance.c b/fs/reiserfs/lbalance.c index b46399d98f84..d48a9e7507a1 100644 --- a/fs/reiserfs/lbalance.c +++ b/fs/reiserfs/lbalance.c @@ -8,28 +8,21 @@ #include "reiserfs.h" #include <linux/buffer_head.h> -/* these are used in do_balance.c */ - -/* leaf_move_items - leaf_shift_left - leaf_shift_right - leaf_delete_items - leaf_insert_into_buf - leaf_paste_in_buffer - leaf_cut_from_buffer - leaf_paste_entries - */ - -/* copy copy_count entries from source directory item to dest buffer (creating new item if needed) */ +/* + * copy copy_count entries from source directory item to dest buffer + * (creating new item if needed) + */ static void leaf_copy_dir_entries(struct buffer_info *dest_bi, struct buffer_head *source, int last_first, int item_num, int from, int copy_count) { struct buffer_head *dest = dest_bi->bi_bh; - int item_num_in_dest; /* either the number of target item, - or if we must create a new item, - the number of the item we will - create it next to */ + /* + * either the number of target item, or if we must create a + * new item, the number of the item we will create it next to + */ + int item_num_in_dest; + struct item_head *ih; struct reiserfs_de_head *deh; int copy_records_len; /* length of all records in item to be copied */ @@ -39,7 +32,10 @@ static void leaf_copy_dir_entries(struct buffer_info *dest_bi, RFALSE(!is_direntry_le_ih(ih), "vs-10000: item must be directory item"); - /* length of all record to be copied and first byte of the last of them */ + /* + * length of all record to be copied and first byte of + * the last of them + */ deh = B_I_DEH(source, ih); if (copy_count) { copy_records_len = (from ? deh_location(&(deh[from - 1])) : @@ -59,7 +55,10 @@ static void leaf_copy_dir_entries(struct buffer_info *dest_bi, LAST_TO_FIRST) ? ((B_NR_ITEMS(dest)) ? 0 : -1) : (B_NR_ITEMS(dest) - 1); - /* if there are no items in dest or the first/last item in dest is not item of the same directory */ + /* + * if there are no items in dest or the first/last item in + * dest is not item of the same directory + */ if ((item_num_in_dest == -1) || (last_first == FIRST_TO_LAST && le_ih_k_offset(ih) == DOT_OFFSET) || (last_first == LAST_TO_FIRST @@ -83,11 +82,17 @@ static void leaf_copy_dir_entries(struct buffer_info *dest_bi, if (from < ih_entry_count(ih)) { set_le_ih_k_offset(&new_ih, deh_offset(&(deh[from]))); - /*memcpy (&new_ih.ih_key.k_offset, &deh[from].deh_offset, SHORT_KEY_SIZE); */ } else { - /* no entries will be copied to this item in this function */ + /* + * no entries will be copied to this + * item in this function + */ set_le_ih_k_offset(&new_ih, U32_MAX); - /* this item is not yet valid, but we want I_IS_DIRECTORY_ITEM to return 1 for it, so we -1 */ + /* + * this item is not yet valid, but we + * want I_IS_DIRECTORY_ITEM to return 1 + * for it, so we -1 + */ } set_le_key_k_type(KEY_FORMAT_3_5, &(new_ih.ih_key), TYPE_DIRENTRY); @@ -119,30 +124,38 @@ static void leaf_copy_dir_entries(struct buffer_info *dest_bi, DEH_SIZE * copy_count + copy_records_len); } -/* Copy the first (if last_first == FIRST_TO_LAST) or last (last_first == LAST_TO_FIRST) item or - part of it or nothing (see the return 0 below) from SOURCE to the end - (if last_first) or beginning (!last_first) of the DEST */ +/* + * Copy the first (if last_first == FIRST_TO_LAST) or last + * (last_first == LAST_TO_FIRST) item or part of it or nothing + * (see the return 0 below) from SOURCE to the end (if last_first) + * or beginning (!last_first) of the DEST + */ /* returns 1 if anything was copied, else 0 */ static int leaf_copy_boundary_item(struct buffer_info *dest_bi, struct buffer_head *src, int last_first, int bytes_or_entries) { struct buffer_head *dest = dest_bi->bi_bh; - int dest_nr_item, src_nr_item; /* number of items in the source and destination buffers */ + /* number of items in the source and destination buffers */ + int dest_nr_item, src_nr_item; struct item_head *ih; struct item_head *dih; dest_nr_item = B_NR_ITEMS(dest); + /* + * if ( DEST is empty or first item of SOURCE and last item of + * DEST are the items of different objects or of different types ) + * then there is no need to treat this item differently from the + * other items that we copy, so we return + */ if (last_first == FIRST_TO_LAST) { - /* if ( DEST is empty or first item of SOURCE and last item of DEST are the items of different objects - or of different types ) then there is no need to treat this item differently from the other items - that we copy, so we return */ ih = item_head(src, 0); dih = item_head(dest, dest_nr_item - 1); + + /* there is nothing to merge */ if (!dest_nr_item || (!op_is_left_mergeable(&(ih->ih_key), src->b_size))) - /* there is nothing to merge */ return 0; RFALSE(!ih_item_len(ih), @@ -157,8 +170,11 @@ static int leaf_copy_boundary_item(struct buffer_info *dest_bi, return 1; } - /* copy part of the body of the first item of SOURCE to the end of the body of the last item of the DEST - part defined by 'bytes_or_entries'; if bytes_or_entries == -1 copy whole body; don't create new item header + /* + * copy part of the body of the first item of SOURCE + * to the end of the body of the last item of the DEST + * part defined by 'bytes_or_entries'; if bytes_or_entries + * == -1 copy whole body; don't create new item header */ if (bytes_or_entries == -1) bytes_or_entries = ih_item_len(ih); @@ -176,8 +192,10 @@ static int leaf_copy_boundary_item(struct buffer_info *dest_bi, } #endif - /* merge first item (or its part) of src buffer with the last - item of dest buffer. Both are of the same file */ + /* + * merge first item (or its part) of src buffer with the last + * item of dest buffer. Both are of the same file + */ leaf_paste_in_buffer(dest_bi, dest_nr_item - 1, ih_item_len(dih), bytes_or_entries, ih_item_body(src, ih), 0); @@ -195,8 +213,9 @@ static int leaf_copy_boundary_item(struct buffer_info *dest_bi, /* copy boundary item to right (last_first == LAST_TO_FIRST) */ - /* ( DEST is empty or last item of SOURCE and first item of DEST - are the items of different object or of different types ) + /* + * (DEST is empty or last item of SOURCE and first item of DEST + * are the items of different object or of different types) */ src_nr_item = B_NR_ITEMS(src); ih = item_head(src, src_nr_item - 1); @@ -206,8 +225,11 @@ static int leaf_copy_boundary_item(struct buffer_info *dest_bi, return 0; if (is_direntry_le_ih(ih)) { + /* + * bytes_or_entries = entries number in last + * item body of SOURCE + */ if (bytes_or_entries == -1) - /* bytes_or_entries = entries number in last item body of SOURCE */ bytes_or_entries = ih_entry_count(ih); leaf_copy_dir_entries(dest_bi, src, LAST_TO_FIRST, @@ -217,9 +239,11 @@ static int leaf_copy_boundary_item(struct buffer_info *dest_bi, return 1; } - /* copy part of the body of the last item of SOURCE to the begin of the body of the first item of the DEST; - part defined by 'bytes_or_entries'; if byte_or_entriess == -1 copy whole body; change first item key of the DEST; - don't create new item header + /* + * copy part of the body of the last item of SOURCE to the + * begin of the body of the first item of the DEST; part defined + * by 'bytes_or_entries'; if byte_or_entriess == -1 copy whole body; + * change first item key of the DEST; don't create new item header */ RFALSE(is_indirect_le_ih(ih) && get_ih_free_space(ih), @@ -276,9 +300,12 @@ static int leaf_copy_boundary_item(struct buffer_info *dest_bi, return 1; } -/* copy cpy_mun items from buffer src to buffer dest - * last_first == FIRST_TO_LAST means, that we copy cpy_num items beginning from first-th item in src to tail of dest - * last_first == LAST_TO_FIRST means, that we copy cpy_num items beginning from first-th item in src to head of dest +/* + * copy cpy_mun items from buffer src to buffer dest + * last_first == FIRST_TO_LAST means, that we copy cpy_num items beginning + * from first-th item in src to tail of dest + * last_first == LAST_TO_FIRST means, that we copy cpy_num items beginning + * from first-th item in src to head of dest */ static void leaf_copy_items_entirely(struct buffer_info *dest_bi, struct buffer_head *src, int last_first, @@ -311,7 +338,10 @@ static void leaf_copy_items_entirely(struct buffer_info *dest_bi, nr = blkh_nr_item(blkh); free_space = blkh_free_space(blkh); - /* we will insert items before 0-th or nr-th item in dest buffer. It depends of last_first parameter */ + /* + * we will insert items before 0-th or nr-th item in dest buffer. + * It depends of last_first parameter + */ dest_before = (last_first == LAST_TO_FIRST) ? 0 : nr; /* location of head of first new item */ @@ -377,8 +407,10 @@ static void leaf_copy_items_entirely(struct buffer_info *dest_bi, } } -/* This function splits the (liquid) item into two items (useful when - shifting part of an item into another node.) */ +/* + * This function splits the (liquid) item into two items (useful when + * shifting part of an item into another node.) + */ static void leaf_item_bottle(struct buffer_info *dest_bi, struct buffer_head *src, int last_first, int item_num, int cpy_bytes) @@ -390,7 +422,10 @@ static void leaf_item_bottle(struct buffer_info *dest_bi, "vs-10170: bytes == - 1 means: do not split item"); if (last_first == FIRST_TO_LAST) { - /* if ( if item in position item_num in buffer SOURCE is directory item ) */ + /* + * if ( if item in position item_num in buffer SOURCE + * is directory item ) + */ ih = item_head(src, item_num); if (is_direntry_le_ih(ih)) leaf_copy_dir_entries(dest_bi, src, FIRST_TO_LAST, @@ -398,9 +433,11 @@ static void leaf_item_bottle(struct buffer_info *dest_bi, else { struct item_head n_ih; - /* copy part of the body of the item number 'item_num' of SOURCE to the end of the DEST - part defined by 'cpy_bytes'; create new item header; change old item_header (????); - n_ih = new item_header; + /* + * copy part of the body of the item number 'item_num' + * of SOURCE to the end of the DEST part defined by + * 'cpy_bytes'; create new item header; change old + * item_header (????); n_ih = new item_header; */ memcpy(&n_ih, ih, IH_SIZE); put_ih_item_len(&n_ih, cpy_bytes); @@ -419,7 +456,10 @@ static void leaf_item_bottle(struct buffer_info *dest_bi, item_body(src, item_num), 0); } } else { - /* if ( if item in position item_num in buffer SOURCE is directory item ) */ + /* + * if ( if item in position item_num in buffer + * SOURCE is directory item ) + */ ih = item_head(src, item_num); if (is_direntry_le_ih(ih)) leaf_copy_dir_entries(dest_bi, src, LAST_TO_FIRST, @@ -429,13 +469,16 @@ static void leaf_item_bottle(struct buffer_info *dest_bi, else { struct item_head n_ih; - /* copy part of the body of the item number 'item_num' of SOURCE to the begin of the DEST - part defined by 'cpy_bytes'; create new item header; - n_ih = new item_header; + /* + * copy part of the body of the item number 'item_num' + * of SOURCE to the begin of the DEST part defined by + * 'cpy_bytes'; create new item header; + * n_ih = new item_header; */ memcpy(&n_ih, ih, SHORT_KEY_SIZE); - n_ih.ih_version = ih->ih_version; /* JDM Endian safe, both le */ + /* Endian safe, both le */ + n_ih.ih_version = ih->ih_version; if (is_direct_le_ih(ih)) { set_le_ih_k_offset(&n_ih, @@ -459,7 +502,8 @@ static void leaf_item_bottle(struct buffer_info *dest_bi, /* set item length */ put_ih_item_len(&n_ih, cpy_bytes); - n_ih.ih_version = ih->ih_version; /* JDM Endian safe, both le */ + /* Endian safe, both le */ + n_ih.ih_version = ih->ih_version; leaf_insert_into_buf(dest_bi, 0, &n_ih, item_body(src, item_num) + @@ -468,10 +512,12 @@ static void leaf_item_bottle(struct buffer_info *dest_bi, } } -/* If cpy_bytes equals minus one than copy cpy_num whole items from SOURCE to DEST. - If cpy_bytes not equal to minus one than copy cpy_num-1 whole items from SOURCE to DEST. - From last item copy cpy_num bytes for regular item and cpy_num directory entries for - directory item. */ +/* + * If cpy_bytes equals minus one than copy cpy_num whole items from SOURCE + * to DEST. If cpy_bytes not equal to minus one than copy cpy_num-1 whole + * items from SOURCE to DEST. From last item copy cpy_num bytes for regular + * item and cpy_num directory entries for directory item. + */ static int leaf_copy_items(struct buffer_info *dest_bi, struct buffer_head *src, int last_first, int cpy_num, int cpy_bytes) { @@ -498,22 +544,34 @@ static int leaf_copy_items(struct buffer_info *dest_bi, struct buffer_head *src, else bytes = -1; - /* copy the first item or it part or nothing to the end of the DEST (i = leaf_copy_boundary_item(DEST,SOURCE,0,bytes)) */ + /* + * copy the first item or it part or nothing to the end of + * the DEST (i = leaf_copy_boundary_item(DEST,SOURCE,0,bytes)) + */ i = leaf_copy_boundary_item(dest_bi, src, FIRST_TO_LAST, bytes); cpy_num -= i; if (cpy_num == 0) return i; pos += i; if (cpy_bytes == -1) - /* copy first cpy_num items starting from position 'pos' of SOURCE to end of DEST */ + /* + * copy first cpy_num items starting from position + * 'pos' of SOURCE to end of DEST + */ leaf_copy_items_entirely(dest_bi, src, FIRST_TO_LAST, pos, cpy_num); else { - /* copy first cpy_num-1 items starting from position 'pos-1' of the SOURCE to the end of the DEST */ + /* + * copy first cpy_num-1 items starting from position + * 'pos-1' of the SOURCE to the end of the DEST + */ leaf_copy_items_entirely(dest_bi, src, FIRST_TO_LAST, pos, cpy_num - 1); - /* copy part of the item which number is cpy_num+pos-1 to the end of the DEST */ + /* + * copy part of the item which number is + * cpy_num+pos-1 to the end of the DEST + */ leaf_item_bottle(dest_bi, src, FIRST_TO_LAST, cpy_num + pos - 1, cpy_bytes); } @@ -525,7 +583,11 @@ static int leaf_copy_items(struct buffer_info *dest_bi, struct buffer_head *src, else bytes = -1; - /* copy the last item or it part or nothing to the begin of the DEST (i = leaf_copy_boundary_item(DEST,SOURCE,1,bytes)); */ + /* + * copy the last item or it part or nothing to the + * begin of the DEST + * (i = leaf_copy_boundary_item(DEST,SOURCE,1,bytes)); + */ i = leaf_copy_boundary_item(dest_bi, src, LAST_TO_FIRST, bytes); cpy_num -= i; @@ -534,15 +596,24 @@ static int leaf_copy_items(struct buffer_info *dest_bi, struct buffer_head *src, pos = src_nr_item - cpy_num - i; if (cpy_bytes == -1) { - /* starting from position 'pos' copy last cpy_num items of SOURCE to begin of DEST */ + /* + * starting from position 'pos' copy last cpy_num + * items of SOURCE to begin of DEST + */ leaf_copy_items_entirely(dest_bi, src, LAST_TO_FIRST, pos, cpy_num); } else { - /* copy last cpy_num-1 items starting from position 'pos+1' of the SOURCE to the begin of the DEST; */ + /* + * copy last cpy_num-1 items starting from position + * 'pos+1' of the SOURCE to the begin of the DEST; + */ leaf_copy_items_entirely(dest_bi, src, LAST_TO_FIRST, pos + 1, cpy_num - 1); - /* copy part of the item which number is pos to the begin of the DEST */ + /* + * copy part of the item which number is pos to + * the begin of the DEST + */ leaf_item_bottle(dest_bi, src, LAST_TO_FIRST, pos, cpy_bytes); } @@ -550,9 +621,11 @@ static int leaf_copy_items(struct buffer_info *dest_bi, struct buffer_head *src, return i; } -/* there are types of coping: from S[0] to L[0], from S[0] to R[0], - from R[0] to L[0]. for each of these we have to define parent and - positions of destination and source buffers */ +/* + * there are types of coping: from S[0] to L[0], from S[0] to R[0], + * from R[0] to L[0]. for each of these we have to define parent and + * positions of destination and source buffers + */ static void leaf_define_dest_src_infos(int shift_mode, struct tree_balance *tb, struct buffer_info *dest_bi, struct buffer_info *src_bi, @@ -568,7 +641,9 @@ static void leaf_define_dest_src_infos(int shift_mode, struct tree_balance *tb, src_bi->tb = tb; src_bi->bi_bh = PATH_PLAST_BUFFER(tb->tb_path); src_bi->bi_parent = PATH_H_PPARENT(tb->tb_path, 0); - src_bi->bi_position = PATH_H_B_ITEM_ORDER(tb->tb_path, 0); /* src->b_item_order */ + + /* src->b_item_order */ + src_bi->bi_position = PATH_H_B_ITEM_ORDER(tb->tb_path, 0); dest_bi->tb = tb; dest_bi->bi_bh = tb->L[0]; dest_bi->bi_parent = tb->FL[0]; @@ -633,8 +708,10 @@ static void leaf_define_dest_src_infos(int shift_mode, struct tree_balance *tb, shift_mode, src_bi->bi_bh, dest_bi->bi_bh); } -/* copy mov_num items and mov_bytes of the (mov_num-1)th item to - neighbor. Delete them from source */ +/* + * copy mov_num items and mov_bytes of the (mov_num-1)th item to + * neighbor. Delete them from source + */ int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num, int mov_bytes, struct buffer_head *Snew) { @@ -657,18 +734,24 @@ int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num, return ret_value; } -/* Shift shift_num items (and shift_bytes of last shifted item if shift_bytes != -1) - from S[0] to L[0] and replace the delimiting key */ +/* + * Shift shift_num items (and shift_bytes of last shifted item if + * shift_bytes != -1) from S[0] to L[0] and replace the delimiting key + */ int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes) { struct buffer_head *S0 = PATH_PLAST_BUFFER(tb->tb_path); int i; - /* move shift_num (and shift_bytes bytes) items from S[0] to left neighbor L[0] */ + /* + * move shift_num (and shift_bytes bytes) items from S[0] + * to left neighbor L[0] + */ i = leaf_move_items(LEAF_FROM_S_TO_L, tb, shift_num, shift_bytes, NULL); if (shift_num) { - if (B_NR_ITEMS(S0) == 0) { /* number of items in S[0] == 0 */ + /* number of items in S[0] == 0 */ + if (B_NR_ITEMS(S0) == 0) { RFALSE(shift_bytes != -1, "vs-10270: S0 is empty now, but shift_bytes != -1 (%d)", @@ -704,13 +787,18 @@ int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes) /* CLEANING STOPPED HERE */ -/* Shift shift_num (shift_bytes) items from S[0] to the right neighbor, and replace the delimiting key */ +/* + * Shift shift_num (shift_bytes) items from S[0] to the right neighbor, + * and replace the delimiting key + */ int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes) { - // struct buffer_head * S0 = PATH_PLAST_BUFFER (tb->tb_path); int ret_value; - /* move shift_num (and shift_bytes) items from S[0] to right neighbor R[0] */ + /* + * move shift_num (and shift_bytes) items from S[0] to + * right neighbor R[0] + */ ret_value = leaf_move_items(LEAF_FROM_S_TO_R, tb, shift_num, shift_bytes, NULL); @@ -725,12 +813,16 @@ int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes) static void leaf_delete_items_entirely(struct buffer_info *bi, int first, int del_num); -/* If del_bytes == -1, starting from position 'first' delete del_num items in whole in buffer CUR. - If not. - If last_first == 0. Starting from position 'first' delete del_num-1 items in whole. Delete part of body of - the first item. Part defined by del_bytes. Don't delete first item header - If last_first == 1. Starting from position 'first+1' delete del_num-1 items in whole. Delete part of body of - the last item . Part defined by del_bytes. Don't delete last item header. +/* + * If del_bytes == -1, starting from position 'first' delete del_num + * items in whole in buffer CUR. + * If not. + * If last_first == 0. Starting from position 'first' delete del_num-1 + * items in whole. Delete part of body of the first item. Part defined by + * del_bytes. Don't delete first item header + * If last_first == 1. Starting from position 'first+1' delete del_num-1 + * items in whole. Delete part of body of the last item . Part defined by + * del_bytes. Don't delete last item header. */ void leaf_delete_items(struct buffer_info *cur_bi, int last_first, int first, int del_num, int del_bytes) @@ -761,32 +853,43 @@ void leaf_delete_items(struct buffer_info *cur_bi, int last_first, leaf_delete_items_entirely(cur_bi, first, del_num); else { if (last_first == FIRST_TO_LAST) { - /* delete del_num-1 items beginning from item in position first */ + /* + * delete del_num-1 items beginning from + * item in position first + */ leaf_delete_items_entirely(cur_bi, first, del_num - 1); - /* delete the part of the first item of the bh - do not delete item header + /* + * delete the part of the first item of the bh + * do not delete item header */ leaf_cut_from_buffer(cur_bi, 0, 0, del_bytes); } else { struct item_head *ih; int len; - /* delete del_num-1 items beginning from item in position first+1 */ + /* + * delete del_num-1 items beginning from + * item in position first+1 + */ leaf_delete_items_entirely(cur_bi, first + 1, del_num - 1); ih = item_head(bh, B_NR_ITEMS(bh) - 1); if (is_direntry_le_ih(ih)) /* the last item is directory */ - /* len = numbers of directory entries in this item */ + /* + * len = numbers of directory entries + * in this item + */ len = ih_entry_count(ih); else /* len = body len of item */ len = ih_item_len(ih); - /* delete the part of the last item of the bh - do not delete item header + /* + * delete the part of the last item of the bh + * do not delete item header */ leaf_cut_from_buffer(cur_bi, B_NR_ITEMS(bh) - 1, len - del_bytes, del_bytes); @@ -867,8 +970,10 @@ void leaf_insert_into_buf(struct buffer_info *bi, int before, } } -/* paste paste_size bytes to affected_item_num-th item. - When item is a directory, this only prepare space for new entries */ +/* + * paste paste_size bytes to affected_item_num-th item. + * When item is a directory, this only prepare space for new entries + */ void leaf_paste_in_buffer(struct buffer_info *bi, int affected_item_num, int pos_in_item, int paste_size, const char *body, int zeros_number) @@ -957,10 +1062,12 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int affected_item_num, } } -/* cuts DEL_COUNT entries beginning from FROM-th entry. Directory item - does not have free space, so it moves DEHs and remaining records as - necessary. Return value is size of removed part of directory item - in bytes. */ +/* + * cuts DEL_COUNT entries beginning from FROM-th entry. Directory item + * does not have free space, so it moves DEHs and remaining records as + * necessary. Return value is size of removed part of directory item + * in bytes. + */ static int leaf_cut_entries(struct buffer_head *bh, struct item_head *ih, int from, int del_count) { @@ -971,8 +1078,10 @@ static int leaf_cut_entries(struct buffer_head *bh, int cut_records_len; /* length of all removed records */ int i; - /* make sure, that item is directory and there are enough entries to - remove */ + /* + * make sure that item is directory and there are enough entries to + * remove + */ RFALSE(!is_direntry_le_ih(ih), "10180: item is not directory item"); RFALSE(ih_entry_count(ih) < from + del_count, "10185: item contains not enough entries: entry_count = %d, from = %d, to delete = %d", @@ -987,8 +1096,10 @@ static int leaf_cut_entries(struct buffer_head *bh, /* entry head array */ deh = B_I_DEH(bh, ih); - /* first byte of remaining entries, those are BEFORE cut entries - (prev_record) and length of all removed records (cut_records_len) */ + /* + * first byte of remaining entries, those are BEFORE cut entries + * (prev_record) and length of all removed records (cut_records_len) + */ prev_record_offset = (from ? deh_location(&(deh[from - 1])) : ih_item_len(ih)); cut_records_len = prev_record_offset /*from_record */ - @@ -1021,14 +1132,15 @@ static int leaf_cut_entries(struct buffer_head *bh, return DEH_SIZE * del_count + cut_records_len; } -/* when cut item is part of regular file - pos_in_item - first byte that must be cut - cut_size - number of bytes to be cut beginning from pos_in_item - - when cut item is part of directory - pos_in_item - number of first deleted entry - cut_size - count of deleted entries - */ +/* + * when cut item is part of regular file + * pos_in_item - first byte that must be cut + * cut_size - number of bytes to be cut beginning from pos_in_item + * + * when cut item is part of directory + * pos_in_item - number of first deleted entry + * cut_size - count of deleted entries + */ void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, int pos_in_item, int cut_size) { @@ -1055,7 +1167,6 @@ void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, cut_item_num); /* change item key by key of first entry in the item */ set_le_ih_k_offset(ih, deh_offset(B_I_DEH(bh, ih))); - /*memcpy (&ih->ih_key.k_offset, &(B_I_DEH (bh, ih)->deh_offset), SHORT_KEY_SIZE); */ } } else { /* item is direct or indirect */ @@ -1195,7 +1306,10 @@ static void leaf_delete_items_entirely(struct buffer_info *bi, } } -/* paste new_entry_count entries (new_dehs, records) into position before to item_num-th item */ +/* + * paste new_entry_count entries (new_dehs, records) into position + * before to item_num-th item + */ void leaf_paste_entries(struct buffer_info *bi, int item_num, int before, @@ -1215,7 +1329,10 @@ void leaf_paste_entries(struct buffer_info *bi, ih = item_head(bh, item_num); - /* make sure, that item is directory, and there are enough records in it */ + /* + * make sure, that item is directory, and there are enough + * records in it + */ RFALSE(!is_direntry_le_ih(ih), "10225: item is not directory item"); RFALSE(ih_entry_count(ih) < before, "10230: there are no entry we paste entries before. entry_count = %d, before = %d", @@ -1277,8 +1394,6 @@ void leaf_paste_entries(struct buffer_info *bi, /* change item key if necessary (when we paste before 0-th entry */ if (!before) { set_le_ih_k_offset(ih, deh_offset(new_dehs)); -/* memcpy (&ih->ih_key.k_offset, - &new_dehs->deh_offset, SHORT_KEY_SIZE);*/ } #ifdef CONFIG_REISERFS_CHECK { |