提交 49521de1 编写于 作者: J Jan Kara

udf: Remove BKL from udf_update_inode

udf_update_inode() does not need BKL since on-disk inode modifications are
protected by the buffer lock and reading of values of in-memory inode is
safe without any lock. In some cases we can write inconsistent inode state
to disk but in that case inode will be marked dirty and overwritten later.

Also make unnecessarily global udf_sync_inode() static.
Signed-off-by: NJan Kara <jack@suse.cz>
上级 f2a6cc1f
...@@ -51,6 +51,7 @@ MODULE_LICENSE("GPL"); ...@@ -51,6 +51,7 @@ MODULE_LICENSE("GPL");
static mode_t udf_convert_permissions(struct fileEntry *); static mode_t udf_convert_permissions(struct fileEntry *);
static int udf_update_inode(struct inode *, int); static int udf_update_inode(struct inode *, int);
static void udf_fill_inode(struct inode *, struct buffer_head *); static void udf_fill_inode(struct inode *, struct buffer_head *);
static int udf_sync_inode(struct inode *inode);
static int udf_alloc_i_data(struct inode *inode, size_t size); static int udf_alloc_i_data(struct inode *inode, size_t size);
static struct buffer_head *inode_getblk(struct inode *, sector_t, int *, static struct buffer_head *inode_getblk(struct inode *, sector_t, int *,
sector_t *, int *); sector_t *, int *);
...@@ -79,9 +80,7 @@ void udf_evict_inode(struct inode *inode) ...@@ -79,9 +80,7 @@ void udf_evict_inode(struct inode *inode)
want_delete = 1; want_delete = 1;
inode->i_size = 0; inode->i_size = 0;
udf_truncate(inode); udf_truncate(inode);
lock_kernel();
udf_update_inode(inode, IS_SYNC(inode)); udf_update_inode(inode, IS_SYNC(inode));
unlock_kernel();
} }
invalidate_inode_buffers(inode); invalidate_inode_buffers(inode);
end_writeback(inode); end_writeback(inode);
...@@ -1373,16 +1372,10 @@ static mode_t udf_convert_permissions(struct fileEntry *fe) ...@@ -1373,16 +1372,10 @@ static mode_t udf_convert_permissions(struct fileEntry *fe)
int udf_write_inode(struct inode *inode, struct writeback_control *wbc) int udf_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
int ret; return udf_update_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
lock_kernel();
ret = udf_update_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
unlock_kernel();
return ret;
} }
int udf_sync_inode(struct inode *inode) static int udf_sync_inode(struct inode *inode)
{ {
return udf_update_inode(inode, 1); return udf_update_inode(inode, 1);
} }
......
...@@ -135,7 +135,6 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *, ...@@ -135,7 +135,6 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *,
extern long udf_ioctl(struct file *, unsigned int, unsigned long); extern long udf_ioctl(struct file *, unsigned int, unsigned long);
/* inode.c */ /* inode.c */
extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *); extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *);
extern int udf_sync_inode(struct inode *);
extern void udf_expand_file_adinicb(struct inode *, int, int *); extern void udf_expand_file_adinicb(struct inode *, int, int *);
extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *);
extern struct buffer_head *udf_bread(struct inode *, int, int, int *); extern struct buffer_head *udf_bread(struct inode *, int, int, int *);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册