Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
cc46759a
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 3 年多
通知
13
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
cc46759a
编写于
6月 16, 2009
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get rid of BKL in fs/minix
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
e7ec952f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
20 deletion
+14
-20
fs/minix/bitmap.c
fs/minix/bitmap.c
+13
-12
fs/minix/dir.c
fs/minix/dir.c
+1
-4
fs/minix/inode.c
fs/minix/inode.c
+0
-4
未找到文件。
fs/minix/bitmap.c
浏览文件 @
cc46759a
...
...
@@ -12,13 +12,14 @@
/* bitmap.c contains the code that handles the inode and block bitmaps */
#include "minix.h"
#include <linux/smp_lock.h>
#include <linux/buffer_head.h>
#include <linux/bitops.h>
#include <linux/sched.h>
static
const
int
nibblemap
[]
=
{
4
,
3
,
3
,
2
,
3
,
2
,
2
,
1
,
3
,
2
,
2
,
1
,
2
,
1
,
1
,
0
};
static
DEFINE_SPINLOCK
(
bitmap_lock
);
static
unsigned
long
count_free
(
struct
buffer_head
*
map
[],
unsigned
numblocks
,
__u32
numbits
)
{
unsigned
i
,
j
,
sum
=
0
;
...
...
@@ -69,11 +70,11 @@ void minix_free_block(struct inode *inode, unsigned long block)
return
;
}
bh
=
sbi
->
s_zmap
[
zone
];
lock_kernel
(
);
spin_lock
(
&
bitmap_lock
);
if
(
!
minix_test_and_clear_bit
(
bit
,
bh
->
b_data
))
printk
(
"minix_free_block (%s:%lu): bit already cleared
\n
"
,
sb
->
s_id
,
block
);
unlock_kernel
(
);
spin_unlock
(
&
bitmap_lock
);
mark_buffer_dirty
(
bh
);
return
;
}
...
...
@@ -88,18 +89,18 @@ int minix_new_block(struct inode * inode)
struct
buffer_head
*
bh
=
sbi
->
s_zmap
[
i
];
int
j
;
lock_kernel
(
);
spin_lock
(
&
bitmap_lock
);
j
=
minix_find_first_zero_bit
(
bh
->
b_data
,
bits_per_zone
);
if
(
j
<
bits_per_zone
)
{
minix_set_bit
(
j
,
bh
->
b_data
);
unlock_kernel
(
);
spin_unlock
(
&
bitmap_lock
);
mark_buffer_dirty
(
bh
);
j
+=
i
*
bits_per_zone
+
sbi
->
s_firstdatazone
-
1
;
if
(
j
<
sbi
->
s_firstdatazone
||
j
>=
sbi
->
s_nzones
)
break
;
return
j
;
}
unlock_kernel
(
);
spin_unlock
(
&
bitmap_lock
);
}
return
0
;
}
...
...
@@ -211,10 +212,10 @@ void minix_free_inode(struct inode * inode)
minix_clear_inode
(
inode
);
/* clear on-disk copy */
bh
=
sbi
->
s_imap
[
ino
];
lock_kernel
(
);
spin_lock
(
&
bitmap_lock
);
if
(
!
minix_test_and_clear_bit
(
bit
,
bh
->
b_data
))
printk
(
"minix_free_inode: bit %lu already cleared
\n
"
,
bit
);
unlock_kernel
(
);
spin_unlock
(
&
bitmap_lock
);
mark_buffer_dirty
(
bh
);
out:
clear_inode
(
inode
);
/* clear in-memory copy */
...
...
@@ -237,7 +238,7 @@ struct inode * minix_new_inode(const struct inode * dir, int * error)
j
=
bits_per_zone
;
bh
=
NULL
;
*
error
=
-
ENOSPC
;
lock_kernel
(
);
spin_lock
(
&
bitmap_lock
);
for
(
i
=
0
;
i
<
sbi
->
s_imap_blocks
;
i
++
)
{
bh
=
sbi
->
s_imap
[
i
];
j
=
minix_find_first_zero_bit
(
bh
->
b_data
,
bits_per_zone
);
...
...
@@ -245,17 +246,17 @@ struct inode * minix_new_inode(const struct inode * dir, int * error)
break
;
}
if
(
!
bh
||
j
>=
bits_per_zone
)
{
unlock_kernel
(
);
spin_unlock
(
&
bitmap_lock
);
iput
(
inode
);
return
NULL
;
}
if
(
minix_test_and_set_bit
(
j
,
bh
->
b_data
))
{
/* shouldn't happen */
unlock_kernel
(
);
spin_unlock
(
&
bitmap_lock
);
printk
(
"minix_new_inode: bit already set
\n
"
);
iput
(
inode
);
return
NULL
;
}
unlock_kernel
(
);
spin_unlock
(
&
bitmap_lock
);
mark_buffer_dirty
(
bh
);
j
+=
i
*
bits_per_zone
;
if
(
!
j
||
j
>
sbi
->
s_ninodes
)
{
...
...
fs/minix/dir.c
浏览文件 @
cc46759a
...
...
@@ -11,7 +11,6 @@
#include "minix.h"
#include <linux/buffer_head.h>
#include <linux/highmem.h>
#include <linux/smp_lock.h>
#include <linux/swap.h>
typedef
struct
minix_dir_entry
minix_dirent
;
...
...
@@ -20,6 +19,7 @@ typedef struct minix3_dir_entry minix3_dirent;
static
int
minix_readdir
(
struct
file
*
,
void
*
,
filldir_t
);
const
struct
file_operations
minix_dir_operations
=
{
.
llseek
=
generic_file_llseek
,
.
read
=
generic_read_dir
,
.
readdir
=
minix_readdir
,
.
fsync
=
simple_fsync
,
...
...
@@ -102,8 +102,6 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir)
char
*
name
;
__u32
inumber
;
lock_kernel
();
pos
=
(
pos
+
chunk_size
-
1
)
&
~
(
chunk_size
-
1
);
if
(
pos
>=
inode
->
i_size
)
goto
done
;
...
...
@@ -146,7 +144,6 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir)
done:
filp
->
f_pos
=
(
n
<<
PAGE_CACHE_SHIFT
)
|
offset
;
unlock_kernel
();
return
0
;
}
...
...
fs/minix/inode.c
浏览文件 @
cc46759a
...
...
@@ -35,8 +35,6 @@ static void minix_put_super(struct super_block *sb)
int
i
;
struct
minix_sb_info
*
sbi
=
minix_sb
(
sb
);
lock_kernel
();
if
(
!
(
sb
->
s_flags
&
MS_RDONLY
))
{
if
(
sbi
->
s_version
!=
MINIX_V3
)
/* s_state is now out from V3 sb */
sbi
->
s_ms
->
s_state
=
sbi
->
s_mount_state
;
...
...
@@ -50,8 +48,6 @@ static void minix_put_super(struct super_block *sb)
kfree
(
sbi
->
s_imap
);
sb
->
s_fs_info
=
NULL
;
kfree
(
sbi
);
unlock_kernel
();
}
static
struct
kmem_cache
*
minix_inode_cachep
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录