Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
ae99fb7c
Commit
ae99fb7c
authored
Apr 02, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Apr 02, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] minixfs cleanups (3/4)
Kill BKL in minix/itree* (similar to ext2 patches)
parent
e8de6e05
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
19 deletions
+23
-19
fs/minix/bitmap.c
fs/minix/bitmap.c
+8
-1
fs/minix/inode.c
fs/minix/inode.c
+0
-2
fs/minix/itree_common.c
fs/minix/itree_common.c
+15
-14
fs/minix/itree_v1.c
fs/minix/itree_v1.c
+0
-1
fs/minix/itree_v2.c
fs/minix/itree_v2.c
+0
-1
No files found.
fs/minix/bitmap.c
View file @
ae99fb7c
...
...
@@ -13,6 +13,7 @@
#include "minix.h"
#include <linux/locks.h>
#include <linux/smp_lock.h>
#include <asm/bitops.h>
...
...
@@ -72,9 +73,11 @@ void minix_free_block(struct inode * inode, int block)
return
;
}
bh
=
sbi
->
s_zmap
[
zone
];
lock_kernel
();
if
(
!
minix_test_and_clear_bit
(
bit
,
bh
->
b_data
))
printk
(
"free_block (%s:%d): bit already cleared
\n
"
,
sb
->
s_id
,
block
);
unlock_kernel
();
mark_buffer_dirty
(
bh
);
return
;
}
...
...
@@ -90,6 +93,7 @@ int minix_new_block(struct inode * inode)
printk
(
"trying to get new block from nonexistent device
\n
"
);
return
0
;
}
lock_kernel
();
repeat:
j
=
8192
;
bh
=
NULL
;
...
...
@@ -98,12 +102,15 @@ int minix_new_block(struct inode * inode)
if
((
j
=
minix_find_first_zero_bit
(
bh
->
b_data
,
8192
))
<
8192
)
break
;
}
if
(
!
bh
||
j
>=
8192
)
if
(
!
bh
||
j
>=
8192
)
{
unlock_kernel
();
return
0
;
}
if
(
minix_test_and_set_bit
(
j
,
bh
->
b_data
))
{
printk
(
"new_block: bit already set"
);
goto
repeat
;
}
unlock_kernel
();
mark_buffer_dirty
(
bh
);
j
+=
i
*
8192
+
sbi
->
s_firstdatazone
-
1
;
if
(
j
<
sbi
->
s_firstdatazone
||
...
...
fs/minix/inode.c
View file @
ae99fb7c
...
...
@@ -534,12 +534,10 @@ int minix_sync_inode(struct inode * inode)
*/
void
minix_truncate
(
struct
inode
*
inode
)
{
lock_kernel
();
if
(
INODE_VERSION
(
inode
)
==
MINIX_V1
)
V1_minix_truncate
(
inode
);
else
V2_minix_truncate
(
inode
);
unlock_kernel
();
}
static
struct
super_block
*
minix_get_sb
(
struct
file_system_type
*
fs_type
,
...
...
fs/minix/itree_common.c
View file @
ae99fb7c
...
...
@@ -6,6 +6,8 @@ typedef struct {
struct
buffer_head
*
bh
;
}
Indirect
;
static
rwlock_t
pointers_lock
=
RW_LOCK_UNLOCKED
;
static
inline
void
add_chain
(
Indirect
*
p
,
struct
buffer_head
*
bh
,
block_t
*
v
)
{
p
->
key
=
*
(
p
->
p
=
v
);
...
...
@@ -43,17 +45,18 @@ static inline Indirect *get_branch(struct inode *inode,
bh
=
sb_bread
(
sb
,
block_to_cpu
(
p
->
key
));
if
(
!
bh
)
goto
failure
;
/* Reader: pointers */
read_lock
(
&
pointers_lock
);
if
(
!
verify_chain
(
chain
,
p
))
goto
changed
;
add_chain
(
++
p
,
bh
,
(
block_t
*
)
bh
->
b_data
+
*++
offsets
);
/* Reader: end */
read_unlock
(
&
pointers_lock
);
if
(
!
p
->
key
)
goto
no_block
;
}
return
NULL
;
changed:
read_unlock
(
&
pointers_lock
);
*
err
=
-
EAGAIN
;
goto
no_block
;
failure:
...
...
@@ -108,18 +111,15 @@ static inline int splice_branch(struct inode *inode,
{
int
i
;
/* Verify that place we are splicing to is still there and vacant */
write_lock
(
&
pointers_lock
);
/*
Writer: pointers
*/
/*
Verify that place we are splicing to is still there and vacant
*/
if
(
!
verify_chain
(
chain
,
where
-
1
)
||
*
where
->
p
)
/* Writer: end */
goto
changed
;
/* That's it */
*
where
->
p
=
where
->
key
;
/* Writer: end */
write_unlock
(
&
pointers_lock
);
/* We are done with atomic stuff, now do the rest of housekeeping */
...
...
@@ -133,6 +133,7 @@ static inline int splice_branch(struct inode *inode,
return
0
;
changed:
write_unlock
(
&
pointers_lock
);
for
(
i
=
1
;
i
<
num
;
i
++
)
bforget
(
where
[
i
].
bh
);
for
(
i
=
0
;
i
<
num
;
i
++
)
...
...
@@ -153,7 +154,6 @@ static inline int get_block(struct inode * inode, sector_t block,
if
(
depth
==
0
)
goto
out
;
lock_kernel
();
reread:
partial
=
get_branch
(
inode
,
depth
,
offsets
,
chain
,
&
err
);
...
...
@@ -173,7 +173,6 @@ static inline int get_block(struct inode * inode, sector_t block,
brelse
(
partial
->
bh
);
partial
--
;
}
unlock_kernel
();
out:
return
err
;
}
...
...
@@ -226,12 +225,14 @@ static Indirect *find_shared(struct inode *inode,
for
(
k
=
depth
;
k
>
1
&&
!
offsets
[
k
-
1
];
k
--
)
;
partial
=
get_branch
(
inode
,
k
,
offsets
,
chain
,
&
err
);
/* Writer: pointers */
write_lock
(
&
pointers_lock
);
if
(
!
partial
)
partial
=
chain
+
k
-
1
;
if
(
!
partial
->
key
&&
*
partial
->
p
)
/* Writer: end */
if
(
!
partial
->
key
&&
*
partial
->
p
)
{
write_unlock
(
&
pointers_lock
);
goto
no_top
;
}
for
(
p
=
partial
;
p
>
chain
&&
all_zeroes
((
block_t
*
)
p
->
bh
->
b_data
,
p
->
p
);
p
--
)
;
if
(
p
==
chain
+
k
-
1
&&
p
>
chain
)
{
...
...
@@ -240,7 +241,7 @@ static Indirect *find_shared(struct inode *inode,
*
top
=
*
p
->
p
;
*
p
->
p
=
0
;
}
/* Writer: end */
write_unlock
(
&
pointers_lock
);
while
(
partial
>
p
)
{
...
...
fs/minix/itree_v1.c
View file @
ae99fb7c
#include "minix.h"
#include <linux/locks.h>
#include <linux/smp_lock.h>
enum
{
DEPTH
=
3
,
DIRECT
=
7
};
/* Only double indirect */
...
...
fs/minix/itree_v2.c
View file @
ae99fb7c
#include "minix.h"
#include <linux/locks.h>
#include <linux/smp_lock.h>
enum
{
DIRECT
=
7
,
DEPTH
=
4
};
/* Have triple indirect */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment