patch-2.3.3 linux/fs/hpfs/dnode.c
Next file: linux/fs/hpfs/file.c
Previous file: linux/fs/hpfs/dir.c
Back to the patch index
Back to the overall index
- Lines: 115
- Date:
Sun May 16 10:27:40 1999
- Orig file:
v2.3.2/linux/fs/hpfs/dnode.c
- Orig date:
Sat May 15 23:46:04 1999
diff -u --recursive --new-file v2.3.2/linux/fs/hpfs/dnode.c linux/fs/hpfs/dnode.c
@@ -368,7 +368,6 @@
struct quad_buffer_head qbh;
dnode_secno dno;
int c;
- int depth = cdepth;
int c1, c2 = 0;
dno = i->i_hpfs_dno;
down:
@@ -385,7 +384,6 @@
if (de->down) {
dno = de_down_pointer(de);
hpfs_brelse4(&qbh);
- depth++;
goto down;
}
break;
@@ -393,7 +391,7 @@
}
hpfs_brelse4(&qbh);
if (!cdepth) hpfs_lock_creation(i->i_sb);
- if (hpfs_check_free_dnodes(i->i_sb, depth + 2)) {
+ if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_ADD)) {
c = 1;
goto ret;
}
@@ -574,11 +572,6 @@
goto end;
}
- /*{
- static int cnt_t_ = 0;
- if (cnt_t_++ & 1) goto endm;
- }*/
-
if (!de->last) {
struct hpfs_dirent *de_next = de_next_de(de);
struct hpfs_dirent *de_cp;
@@ -607,7 +600,6 @@
kfree(de_cp);
goto try_it_again;
} else {
- /*printk("HPFS: warning: not balancing tree\n");*/
struct hpfs_dirent *de_prev = dnode_pre_last_de(dnode);
struct hpfs_dirent *de_cp;
struct dnode *d1;
@@ -692,20 +684,21 @@
{
struct dnode *dnode = qbh->data;
dnode_secno down = 0;
+ int lock = 0;
loff_t t;
if (de->first || de->last) {
hpfs_error(i->i_sb, "hpfs_remove_dirent: attempt to delete first or last dirent in dnode %08x", dno);
hpfs_brelse4(qbh);
return 1;
}
- if (de->down) {
- if ((down = de_down_pointer(de)) && depth) {
- hpfs_lock_creation(i->i_sb);
- if (hpfs_check_free_dnodes(i->i_sb, depth + 2)) {
- hpfs_brelse4(qbh);
- hpfs_unlock_creation(i->i_sb);
- return 2;
- }
+ if (de->down) down = de_down_pointer(de);
+ if (depth && (de->down || (de == dnode_first_de(dnode) && de_next_de(de)->last))) {
+ lock = 1;
+ hpfs_lock_creation(i->i_sb);
+ if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_DEL)) {
+ hpfs_brelse4(qbh);
+ hpfs_unlock_creation(i->i_sb);
+ return 2;
}
}
i->i_version = ++event;
@@ -716,10 +709,12 @@
if (down) {
dnode_secno a = move_to_top(i, down, dno);
for_all_poss(i, hpfs_pos_subst, 5, t);
- if (depth) hpfs_unlock_creation(i->i_sb);
if (a) delete_empty_dnode(i, a);
+ if (lock) hpfs_unlock_creation(i->i_sb);
return !a;
- } else delete_empty_dnode(i, dno);
+ }
+ delete_empty_dnode(i, dno);
+ if (lock) hpfs_unlock_creation(i->i_sb);
return 0;
}
@@ -888,15 +883,13 @@
/* Find a dirent in tree */
struct hpfs_dirent *map_dirent(struct inode *inode, dnode_secno dno, char *name, unsigned len,
- dnode_secno *dd, struct quad_buffer_head *qbh, int *depth)
+ dnode_secno *dd, struct quad_buffer_head *qbh)
{
struct dnode *dnode;
struct hpfs_dirent *de;
struct hpfs_dirent *de_end;
int c1, c2 = 0;
- if (depth) *depth = 0;
-
if (!S_ISDIR(inode->i_mode)) hpfs_error(inode->i_sb, "map_dirent: not a directory\n");
again:
if (inode->i_sb->s_hpfs_chk)
@@ -914,7 +907,6 @@
if (de->down) {
dno = de_down_pointer(de);
hpfs_brelse4(qbh);
- if (depth) (*depth)++;
goto again;
}
break;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)