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
nexedi
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 @@
...
@@ -13,6 +13,7 @@
#include "minix.h"
#include "minix.h"
#include <linux/locks.h>
#include <linux/locks.h>
#include <linux/smp_lock.h>
#include <asm/bitops.h>
#include <asm/bitops.h>
...
@@ -72,9 +73,11 @@ void minix_free_block(struct inode * inode, int block)
...
@@ -72,9 +73,11 @@ void minix_free_block(struct inode * inode, int block)
return
;
return
;
}
}
bh
=
sbi
->
s_zmap
[
zone
];
bh
=
sbi
->
s_zmap
[
zone
];
lock_kernel
();
if
(
!
minix_test_and_clear_bit
(
bit
,
bh
->
b_data
))
if
(
!
minix_test_and_clear_bit
(
bit
,
bh
->
b_data
))
printk
(
"free_block (%s:%d): bit already cleared
\n
"
,
printk
(
"free_block (%s:%d): bit already cleared
\n
"
,
sb
->
s_id
,
block
);
sb
->
s_id
,
block
);
unlock_kernel
();
mark_buffer_dirty
(
bh
);
mark_buffer_dirty
(
bh
);
return
;
return
;
}
}
...
@@ -90,6 +93,7 @@ int minix_new_block(struct inode * inode)
...
@@ -90,6 +93,7 @@ int minix_new_block(struct inode * inode)
printk
(
"trying to get new block from nonexistent device
\n
"
);
printk
(
"trying to get new block from nonexistent device
\n
"
);
return
0
;
return
0
;
}
}
lock_kernel
();
repeat:
repeat:
j
=
8192
;
j
=
8192
;
bh
=
NULL
;
bh
=
NULL
;
...
@@ -98,12 +102,15 @@ int minix_new_block(struct inode * inode)
...
@@ -98,12 +102,15 @@ int minix_new_block(struct inode * inode)
if
((
j
=
minix_find_first_zero_bit
(
bh
->
b_data
,
8192
))
<
8192
)
if
((
j
=
minix_find_first_zero_bit
(
bh
->
b_data
,
8192
))
<
8192
)
break
;
break
;
}
}
if
(
!
bh
||
j
>=
8192
)
if
(
!
bh
||
j
>=
8192
)
{
unlock_kernel
();
return
0
;
return
0
;
}
if
(
minix_test_and_set_bit
(
j
,
bh
->
b_data
))
{
if
(
minix_test_and_set_bit
(
j
,
bh
->
b_data
))
{
printk
(
"new_block: bit already set"
);
printk
(
"new_block: bit already set"
);
goto
repeat
;
goto
repeat
;
}
}
unlock_kernel
();
mark_buffer_dirty
(
bh
);
mark_buffer_dirty
(
bh
);
j
+=
i
*
8192
+
sbi
->
s_firstdatazone
-
1
;
j
+=
i
*
8192
+
sbi
->
s_firstdatazone
-
1
;
if
(
j
<
sbi
->
s_firstdatazone
||
if
(
j
<
sbi
->
s_firstdatazone
||
...
...
fs/minix/inode.c
View file @
ae99fb7c
...
@@ -534,12 +534,10 @@ int minix_sync_inode(struct inode * inode)
...
@@ -534,12 +534,10 @@ int minix_sync_inode(struct inode * inode)
*/
*/
void
minix_truncate
(
struct
inode
*
inode
)
void
minix_truncate
(
struct
inode
*
inode
)
{
{
lock_kernel
();
if
(
INODE_VERSION
(
inode
)
==
MINIX_V1
)
if
(
INODE_VERSION
(
inode
)
==
MINIX_V1
)
V1_minix_truncate
(
inode
);
V1_minix_truncate
(
inode
);
else
else
V2_minix_truncate
(
inode
);
V2_minix_truncate
(
inode
);
unlock_kernel
();
}
}
static
struct
super_block
*
minix_get_sb
(
struct
file_system_type
*
fs_type
,
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 {
...
@@ -6,6 +6,8 @@ typedef struct {
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
}
Indirect
;
}
Indirect
;
static
rwlock_t
pointers_lock
=
RW_LOCK_UNLOCKED
;
static
inline
void
add_chain
(
Indirect
*
p
,
struct
buffer_head
*
bh
,
block_t
*
v
)
static
inline
void
add_chain
(
Indirect
*
p
,
struct
buffer_head
*
bh
,
block_t
*
v
)
{
{
p
->
key
=
*
(
p
->
p
=
v
);
p
->
key
=
*
(
p
->
p
=
v
);
...
@@ -43,17 +45,18 @@ static inline Indirect *get_branch(struct inode *inode,
...
@@ -43,17 +45,18 @@ static inline Indirect *get_branch(struct inode *inode,
bh
=
sb_bread
(
sb
,
block_to_cpu
(
p
->
key
));
bh
=
sb_bread
(
sb
,
block_to_cpu
(
p
->
key
));
if
(
!
bh
)
if
(
!
bh
)
goto
failure
;
goto
failure
;
/* Reader: pointers */
read_lock
(
&
pointers_lock
);
if
(
!
verify_chain
(
chain
,
p
))
if
(
!
verify_chain
(
chain
,
p
))
goto
changed
;
goto
changed
;
add_chain
(
++
p
,
bh
,
(
block_t
*
)
bh
->
b_data
+
*++
offsets
);
add_chain
(
++
p
,
bh
,
(
block_t
*
)
bh
->
b_data
+
*++
offsets
);
/* Reader: end */
read_unlock
(
&
pointers_lock
);
if
(
!
p
->
key
)
if
(
!
p
->
key
)
goto
no_block
;
goto
no_block
;
}
}
return
NULL
;
return
NULL
;
changed:
changed:
read_unlock
(
&
pointers_lock
);
*
err
=
-
EAGAIN
;
*
err
=
-
EAGAIN
;
goto
no_block
;
goto
no_block
;
failure:
failure:
...
@@ -108,18 +111,15 @@ static inline int splice_branch(struct inode *inode,
...
@@ -108,18 +111,15 @@ static inline int splice_branch(struct inode *inode,
{
{
int
i
;
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
)
if
(
!
verify_chain
(
chain
,
where
-
1
)
||
*
where
->
p
)
/* Writer: end */
goto
changed
;
goto
changed
;
/* That's it */
*
where
->
p
=
where
->
key
;
*
where
->
p
=
where
->
key
;
/* Writer: end */
write_unlock
(
&
pointers_lock
);
/* We are done with atomic stuff, now do the rest of housekeeping */
/* We are done with atomic stuff, now do the rest of housekeeping */
...
@@ -133,6 +133,7 @@ static inline int splice_branch(struct inode *inode,
...
@@ -133,6 +133,7 @@ static inline int splice_branch(struct inode *inode,
return
0
;
return
0
;
changed:
changed:
write_unlock
(
&
pointers_lock
);
for
(
i
=
1
;
i
<
num
;
i
++
)
for
(
i
=
1
;
i
<
num
;
i
++
)
bforget
(
where
[
i
].
bh
);
bforget
(
where
[
i
].
bh
);
for
(
i
=
0
;
i
<
num
;
i
++
)
for
(
i
=
0
;
i
<
num
;
i
++
)
...
@@ -153,7 +154,6 @@ static inline int get_block(struct inode * inode, sector_t block,
...
@@ -153,7 +154,6 @@ static inline int get_block(struct inode * inode, sector_t block,
if
(
depth
==
0
)
if
(
depth
==
0
)
goto
out
;
goto
out
;
lock_kernel
();
reread:
reread:
partial
=
get_branch
(
inode
,
depth
,
offsets
,
chain
,
&
err
);
partial
=
get_branch
(
inode
,
depth
,
offsets
,
chain
,
&
err
);
...
@@ -173,7 +173,6 @@ static inline int get_block(struct inode * inode, sector_t block,
...
@@ -173,7 +173,6 @@ static inline int get_block(struct inode * inode, sector_t block,
brelse
(
partial
->
bh
);
brelse
(
partial
->
bh
);
partial
--
;
partial
--
;
}
}
unlock_kernel
();
out:
out:
return
err
;
return
err
;
}
}
...
@@ -226,12 +225,14 @@ static Indirect *find_shared(struct inode *inode,
...
@@ -226,12 +225,14 @@ static Indirect *find_shared(struct inode *inode,
for
(
k
=
depth
;
k
>
1
&&
!
offsets
[
k
-
1
];
k
--
)
for
(
k
=
depth
;
k
>
1
&&
!
offsets
[
k
-
1
];
k
--
)
;
;
partial
=
get_branch
(
inode
,
k
,
offsets
,
chain
,
&
err
);
partial
=
get_branch
(
inode
,
k
,
offsets
,
chain
,
&
err
);
/* Writer: pointers */
write_lock
(
&
pointers_lock
);
if
(
!
partial
)
if
(
!
partial
)
partial
=
chain
+
k
-
1
;
partial
=
chain
+
k
-
1
;
if
(
!
partial
->
key
&&
*
partial
->
p
)
if
(
!
partial
->
key
&&
*
partial
->
p
)
{
/* Writer: end */
write_unlock
(
&
pointers_lock
);
goto
no_top
;
goto
no_top
;
}
for
(
p
=
partial
;
p
>
chain
&&
all_zeroes
((
block_t
*
)
p
->
bh
->
b_data
,
p
->
p
);
p
--
)
for
(
p
=
partial
;
p
>
chain
&&
all_zeroes
((
block_t
*
)
p
->
bh
->
b_data
,
p
->
p
);
p
--
)
;
;
if
(
p
==
chain
+
k
-
1
&&
p
>
chain
)
{
if
(
p
==
chain
+
k
-
1
&&
p
>
chain
)
{
...
@@ -240,7 +241,7 @@ static Indirect *find_shared(struct inode *inode,
...
@@ -240,7 +241,7 @@ static Indirect *find_shared(struct inode *inode,
*
top
=
*
p
->
p
;
*
top
=
*
p
->
p
;
*
p
->
p
=
0
;
*
p
->
p
=
0
;
}
}
/* Writer: end */
write_unlock
(
&
pointers_lock
);
while
(
partial
>
p
)
while
(
partial
>
p
)
{
{
...
...
fs/minix/itree_v1.c
View file @
ae99fb7c
#include "minix.h"
#include "minix.h"
#include <linux/locks.h>
#include <linux/locks.h>
#include <linux/smp_lock.h>
enum
{
DEPTH
=
3
,
DIRECT
=
7
};
/* Only double indirect */
enum
{
DEPTH
=
3
,
DIRECT
=
7
};
/* Only double indirect */
...
...
fs/minix/itree_v2.c
View file @
ae99fb7c
#include "minix.h"
#include "minix.h"
#include <linux/locks.h>
#include <linux/locks.h>
#include <linux/smp_lock.h>
enum
{
DIRECT
=
7
,
DEPTH
=
4
};
/* Have triple indirect */
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