int reiserfs_remove_entry (reiserfs_filsys_t fs, struct key * key) { struct path path; struct tree_balance tb; struct item_head * ih; struct reiserfs_de_head * deh; if (_search_by_entry_key (fs, key, &path) != POSITION_FOUND) { pathrelse (&path); return 1; } ih = get_ih (&path); if (ih_entry_count (ih) == 1) { _init_tb_struct (&tb, fs, &path, -(IH_SIZE + ih_item_len (ih))); if (fix_nodes (M_DELETE, &tb, 0) != CARRY_ON) { unfix_nodes (&tb); return 1; } do_balance (&tb, 0, 0, M_DELETE, 0); return 0; } deh = B_I_DEH (get_bh (&path), ih) + path.pos_in_item; _init_tb_struct (&tb, fs, &path, -(DEH_SIZE + entry_length (ih, deh, path.pos_in_item))); if (fix_nodes (M_CUT, &tb, 0) != CARRY_ON) { unfix_nodes (&tb); return 1; } do_balance (&tb, 0, 0, M_CUT, 0); return 0; }
/*================================= * check_and_fix_records -- *================================*/ static void check_and_fix_records (void) { tofix = create_list(); todo.pass = 1; check_nodes(); todo.pass = 2; fix_nodes(); destroy_empty_list(tofix); }
void reiserfs_insert_item (reiserfs_filsys_t fs, struct path * path, struct item_head * ih, const void * body) { struct tree_balance tb; _init_tb_struct (&tb, fs, path, IH_SIZE + ih_item_len(ih)); if (fix_nodes (M_INSERT, &tb, ih) != CARRY_ON) die ("reiserfs_insert_item: fix_nodes failed"); do_balance (&tb, ih, body, M_INSERT, 0/*zero num*/); }
void reiserfs_paste_into_item (reiserfs_filsys_t fs, struct path * path, const void * body, int size) { struct tree_balance tb; _init_tb_struct (&tb, fs, path, size); if (fix_nodes (M_PASTE, &tb, 0/*ih*/) != CARRY_ON) reiserfs_panic ("reiserfs_paste_into_item: fix_nodes failed"); do_balance (&tb, 0, body, M_PASTE, 0/*zero num*/); }