Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
5b911354
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
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看板
提交
5b911354
编写于
5月 20, 2016
作者:
D
Dave Chinner
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'xfs-4.7-optimise-inline-symlinks' into for-next
上级
d6bd9615
30ee052e
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
125 addition
and
85 deletion
+125
-85
fs/namei.c
fs/namei.c
+0
-1
fs/xfs/libxfs/xfs_dir2_sf.c
fs/xfs/libxfs/xfs_dir2_sf.c
+3
-6
fs/xfs/libxfs/xfs_inode_fork.c
fs/xfs/libxfs/xfs_inode_fork.c
+44
-18
fs/xfs/libxfs/xfs_inode_fork.h
fs/xfs/libxfs/xfs_inode_fork.h
+1
-0
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.c
+1
-0
fs/xfs/xfs_inode.h
fs/xfs/xfs_inode.h
+4
-1
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_inode_item.c
+2
-2
fs/xfs/xfs_ioctl.c
fs/xfs/xfs_ioctl.c
+2
-16
fs/xfs/xfs_iops.c
fs/xfs/xfs_iops.c
+63
-25
fs/xfs/xfs_symlink.c
fs/xfs/xfs_symlink.c
+5
-16
未找到文件。
fs/namei.c
浏览文件 @
5b911354
...
@@ -4515,7 +4515,6 @@ int readlink_copy(char __user *buffer, int buflen, const char *link)
...
@@ -4515,7 +4515,6 @@ int readlink_copy(char __user *buffer, int buflen, const char *link)
out:
out:
return
len
;
return
len
;
}
}
EXPORT_SYMBOL
(
readlink_copy
);
/*
/*
* A helper for ->readlink(). This should be used *ONLY* for symlinks that
* A helper for ->readlink(). This should be used *ONLY* for symlinks that
...
...
fs/xfs/libxfs/xfs_dir2_sf.c
浏览文件 @
5b911354
...
@@ -257,15 +257,12 @@ xfs_dir2_block_to_sf(
...
@@ -257,15 +257,12 @@ xfs_dir2_block_to_sf(
*
*
* Convert the inode to local format and copy the data in.
* Convert the inode to local format and copy the data in.
*/
*/
dp
->
i_df
.
if_flags
&=
~
XFS_IFEXTENTS
;
dp
->
i_df
.
if_flags
|=
XFS_IFINLINE
;
dp
->
i_d
.
di_format
=
XFS_DINODE_FMT_LOCAL
;
ASSERT
(
dp
->
i_df
.
if_bytes
==
0
);
ASSERT
(
dp
->
i_df
.
if_bytes
==
0
);
xfs_idata_realloc
(
dp
,
size
,
XFS_DATA_FORK
);
xfs_init_local_fork
(
dp
,
XFS_DATA_FORK
,
dst
,
size
);
dp
->
i_d
.
di_format
=
XFS_DINODE_FMT_LOCAL
;
dp
->
i_d
.
di_size
=
size
;
logflags
|=
XFS_ILOG_DDATA
;
logflags
|=
XFS_ILOG_DDATA
;
memcpy
(
dp
->
i_df
.
if_u1
.
if_data
,
dst
,
size
);
dp
->
i_d
.
di_size
=
size
;
xfs_dir2_sf_check
(
args
);
xfs_dir2_sf_check
(
args
);
out:
out:
xfs_trans_log_inode
(
args
->
trans
,
dp
,
logflags
);
xfs_trans_log_inode
(
args
->
trans
,
dp
,
logflags
);
...
...
fs/xfs/libxfs/xfs_inode_fork.c
浏览文件 @
5b911354
...
@@ -231,6 +231,48 @@ xfs_iformat_fork(
...
@@ -231,6 +231,48 @@ xfs_iformat_fork(
return
error
;
return
error
;
}
}
void
xfs_init_local_fork
(
struct
xfs_inode
*
ip
,
int
whichfork
,
const
void
*
data
,
int
size
)
{
struct
xfs_ifork
*
ifp
=
XFS_IFORK_PTR
(
ip
,
whichfork
);
int
mem_size
=
size
,
real_size
=
0
;
bool
zero_terminate
;
/*
* If we are using the local fork to store a symlink body we need to
* zero-terminate it so that we can pass it back to the VFS directly.
* Overallocate the in-memory fork by one for that and add a zero
* to terminate it below.
*/
zero_terminate
=
S_ISLNK
(
VFS_I
(
ip
)
->
i_mode
);
if
(
zero_terminate
)
mem_size
++
;
if
(
size
==
0
)
ifp
->
if_u1
.
if_data
=
NULL
;
else
if
(
mem_size
<=
sizeof
(
ifp
->
if_u2
.
if_inline_data
))
ifp
->
if_u1
.
if_data
=
ifp
->
if_u2
.
if_inline_data
;
else
{
real_size
=
roundup
(
mem_size
,
4
);
ifp
->
if_u1
.
if_data
=
kmem_alloc
(
real_size
,
KM_SLEEP
|
KM_NOFS
);
}
if
(
size
)
{
memcpy
(
ifp
->
if_u1
.
if_data
,
data
,
size
);
if
(
zero_terminate
)
ifp
->
if_u1
.
if_data
[
size
]
=
'\0'
;
}
ifp
->
if_bytes
=
size
;
ifp
->
if_real_bytes
=
real_size
;
ifp
->
if_flags
&=
~
(
XFS_IFEXTENTS
|
XFS_IFBROOT
);
ifp
->
if_flags
|=
XFS_IFINLINE
;
}
/*
/*
* The file is in-lined in the on-disk inode.
* The file is in-lined in the on-disk inode.
* If it fits into if_inline_data, then copy
* If it fits into if_inline_data, then copy
...
@@ -248,8 +290,6 @@ xfs_iformat_local(
...
@@ -248,8 +290,6 @@ xfs_iformat_local(
int
whichfork
,
int
whichfork
,
int
size
)
int
size
)
{
{
xfs_ifork_t
*
ifp
;
int
real_size
;
/*
/*
* If the size is unreasonable, then something
* If the size is unreasonable, then something
...
@@ -265,22 +305,8 @@ xfs_iformat_local(
...
@@ -265,22 +305,8 @@ xfs_iformat_local(
ip
->
i_mount
,
dip
);
ip
->
i_mount
,
dip
);
return
-
EFSCORRUPTED
;
return
-
EFSCORRUPTED
;
}
}
ifp
=
XFS_IFORK_PTR
(
ip
,
whichfork
);
real_size
=
0
;
xfs_init_local_fork
(
ip
,
whichfork
,
XFS_DFORK_PTR
(
dip
,
whichfork
),
size
);
if
(
size
==
0
)
ifp
->
if_u1
.
if_data
=
NULL
;
else
if
(
size
<=
sizeof
(
ifp
->
if_u2
.
if_inline_data
))
ifp
->
if_u1
.
if_data
=
ifp
->
if_u2
.
if_inline_data
;
else
{
real_size
=
roundup
(
size
,
4
);
ifp
->
if_u1
.
if_data
=
kmem_alloc
(
real_size
,
KM_SLEEP
|
KM_NOFS
);
}
ifp
->
if_bytes
=
size
;
ifp
->
if_real_bytes
=
real_size
;
if
(
size
)
memcpy
(
ifp
->
if_u1
.
if_data
,
XFS_DFORK_PTR
(
dip
,
whichfork
),
size
);
ifp
->
if_flags
&=
~
XFS_IFEXTENTS
;
ifp
->
if_flags
|=
XFS_IFINLINE
;
return
0
;
return
0
;
}
}
...
...
fs/xfs/libxfs/xfs_inode_fork.h
浏览文件 @
5b911354
...
@@ -134,6 +134,7 @@ void xfs_iroot_realloc(struct xfs_inode *, int, int);
...
@@ -134,6 +134,7 @@ void xfs_iroot_realloc(struct xfs_inode *, int, int);
int
xfs_iread_extents
(
struct
xfs_trans
*
,
struct
xfs_inode
*
,
int
);
int
xfs_iread_extents
(
struct
xfs_trans
*
,
struct
xfs_inode
*
,
int
);
int
xfs_iextents_copy
(
struct
xfs_inode
*
,
struct
xfs_bmbt_rec
*
,
int
xfs_iextents_copy
(
struct
xfs_inode
*
,
struct
xfs_bmbt_rec
*
,
int
);
int
);
void
xfs_init_local_fork
(
struct
xfs_inode
*
,
int
,
const
void
*
,
int
);
struct
xfs_bmbt_rec_host
*
struct
xfs_bmbt_rec_host
*
xfs_iext_get_ext
(
struct
xfs_ifork
*
,
xfs_extnum_t
);
xfs_iext_get_ext
(
struct
xfs_ifork
*
,
xfs_extnum_t
);
...
...
fs/xfs/xfs_inode.c
浏览文件 @
5b911354
...
@@ -2840,6 +2840,7 @@ xfs_rename_alloc_whiteout(
...
@@ -2840,6 +2840,7 @@ xfs_rename_alloc_whiteout(
* and flag it as linkable.
* and flag it as linkable.
*/
*/
drop_nlink
(
VFS_I
(
tmpfile
));
drop_nlink
(
VFS_I
(
tmpfile
));
xfs_setup_iops
(
tmpfile
);
xfs_finish_inode_setup
(
tmpfile
);
xfs_finish_inode_setup
(
tmpfile
);
VFS_I
(
tmpfile
)
->
i_state
|=
I_LINKABLE
;
VFS_I
(
tmpfile
)
->
i_state
|=
I_LINKABLE
;
...
...
fs/xfs/xfs_inode.h
浏览文件 @
5b911354
...
@@ -440,6 +440,9 @@ loff_t __xfs_seek_hole_data(struct inode *inode, loff_t start,
...
@@ -440,6 +440,9 @@ loff_t __xfs_seek_hole_data(struct inode *inode, loff_t start,
/* from xfs_iops.c */
/* from xfs_iops.c */
extern
void
xfs_setup_inode
(
struct
xfs_inode
*
ip
);
extern
void
xfs_setup_iops
(
struct
xfs_inode
*
ip
);
/*
/*
* When setting up a newly allocated inode, we need to call
* When setting up a newly allocated inode, we need to call
* xfs_finish_inode_setup() once the inode is fully instantiated at
* xfs_finish_inode_setup() once the inode is fully instantiated at
...
@@ -447,7 +450,6 @@ loff_t __xfs_seek_hole_data(struct inode *inode, loff_t start,
...
@@ -447,7 +450,6 @@ loff_t __xfs_seek_hole_data(struct inode *inode, loff_t start,
* before we've completed instantiation. Otherwise we can do it
* before we've completed instantiation. Otherwise we can do it
* the moment the inode lookup is complete.
* the moment the inode lookup is complete.
*/
*/
extern
void
xfs_setup_inode
(
struct
xfs_inode
*
ip
);
static
inline
void
xfs_finish_inode_setup
(
struct
xfs_inode
*
ip
)
static
inline
void
xfs_finish_inode_setup
(
struct
xfs_inode
*
ip
)
{
{
xfs_iflags_clear
(
ip
,
XFS_INEW
);
xfs_iflags_clear
(
ip
,
XFS_INEW
);
...
@@ -458,6 +460,7 @@ static inline void xfs_finish_inode_setup(struct xfs_inode *ip)
...
@@ -458,6 +460,7 @@ static inline void xfs_finish_inode_setup(struct xfs_inode *ip)
static
inline
void
xfs_setup_existing_inode
(
struct
xfs_inode
*
ip
)
static
inline
void
xfs_setup_existing_inode
(
struct
xfs_inode
*
ip
)
{
{
xfs_setup_inode
(
ip
);
xfs_setup_inode
(
ip
);
xfs_setup_iops
(
ip
);
xfs_finish_inode_setup
(
ip
);
xfs_finish_inode_setup
(
ip
);
}
}
...
...
fs/xfs/xfs_inode_item.c
浏览文件 @
5b911354
...
@@ -210,7 +210,7 @@ xfs_inode_item_format_data_fork(
...
@@ -210,7 +210,7 @@ xfs_inode_item_format_data_fork(
*/
*/
data_bytes
=
roundup
(
ip
->
i_df
.
if_bytes
,
4
);
data_bytes
=
roundup
(
ip
->
i_df
.
if_bytes
,
4
);
ASSERT
(
ip
->
i_df
.
if_real_bytes
==
0
||
ASSERT
(
ip
->
i_df
.
if_real_bytes
==
0
||
ip
->
i_df
.
if_real_bytes
=
=
data_bytes
);
ip
->
i_df
.
if_real_bytes
>
=
data_bytes
);
ASSERT
(
ip
->
i_df
.
if_u1
.
if_data
!=
NULL
);
ASSERT
(
ip
->
i_df
.
if_u1
.
if_data
!=
NULL
);
ASSERT
(
ip
->
i_d
.
di_size
>
0
);
ASSERT
(
ip
->
i_d
.
di_size
>
0
);
xlog_copy_iovec
(
lv
,
vecp
,
XLOG_REG_TYPE_ILOCAL
,
xlog_copy_iovec
(
lv
,
vecp
,
XLOG_REG_TYPE_ILOCAL
,
...
@@ -305,7 +305,7 @@ xfs_inode_item_format_attr_fork(
...
@@ -305,7 +305,7 @@ xfs_inode_item_format_attr_fork(
*/
*/
data_bytes
=
roundup
(
ip
->
i_afp
->
if_bytes
,
4
);
data_bytes
=
roundup
(
ip
->
i_afp
->
if_bytes
,
4
);
ASSERT
(
ip
->
i_afp
->
if_real_bytes
==
0
||
ASSERT
(
ip
->
i_afp
->
if_real_bytes
==
0
||
ip
->
i_afp
->
if_real_bytes
=
=
data_bytes
);
ip
->
i_afp
->
if_real_bytes
>
=
data_bytes
);
ASSERT
(
ip
->
i_afp
->
if_u1
.
if_data
!=
NULL
);
ASSERT
(
ip
->
i_afp
->
if_u1
.
if_data
!=
NULL
);
xlog_copy_iovec
(
lv
,
vecp
,
XLOG_REG_TYPE_IATTR_LOCAL
,
xlog_copy_iovec
(
lv
,
vecp
,
XLOG_REG_TYPE_IATTR_LOCAL
,
ip
->
i_afp
->
if_u1
.
if_data
,
ip
->
i_afp
->
if_u1
.
if_data
,
...
...
fs/xfs/xfs_ioctl.c
浏览文件 @
5b911354
...
@@ -277,7 +277,6 @@ xfs_readlink_by_handle(
...
@@ -277,7 +277,6 @@ xfs_readlink_by_handle(
{
{
struct
dentry
*
dentry
;
struct
dentry
*
dentry
;
__u32
olen
;
__u32
olen
;
void
*
link
;
int
error
;
int
error
;
if
(
!
capable
(
CAP_SYS_ADMIN
))
if
(
!
capable
(
CAP_SYS_ADMIN
))
...
@@ -288,7 +287,7 @@ xfs_readlink_by_handle(
...
@@ -288,7 +287,7 @@ xfs_readlink_by_handle(
return
PTR_ERR
(
dentry
);
return
PTR_ERR
(
dentry
);
/* Restrict this handle operation to symlinks only. */
/* Restrict this handle operation to symlinks only. */
if
(
!
d_i
s_symlink
(
dentry
)
)
{
if
(
!
d_i
node
(
dentry
)
->
i_op
->
readlink
)
{
error
=
-
EINVAL
;
error
=
-
EINVAL
;
goto
out_dput
;
goto
out_dput
;
}
}
...
@@ -298,21 +297,8 @@ xfs_readlink_by_handle(
...
@@ -298,21 +297,8 @@ xfs_readlink_by_handle(
goto
out_dput
;
goto
out_dput
;
}
}
link
=
kmalloc
(
MAXPATHLEN
+
1
,
GFP_KERNEL
);
error
=
d_inode
(
dentry
)
->
i_op
->
readlink
(
dentry
,
hreq
->
ohandle
,
olen
);
if
(
!
link
)
{
error
=
-
ENOMEM
;
goto
out_dput
;
}
error
=
xfs_readlink
(
XFS_I
(
d_inode
(
dentry
)),
link
);
if
(
error
)
goto
out_kfree
;
error
=
readlink_copy
(
hreq
->
ohandle
,
olen
,
link
);
if
(
error
)
goto
out_kfree
;
out_kfree:
kfree
(
link
);
out_dput:
out_dput:
dput
(
dentry
);
dput
(
dentry
);
return
error
;
return
error
;
...
...
fs/xfs/xfs_iops.c
浏览文件 @
5b911354
...
@@ -181,6 +181,8 @@ xfs_generic_create(
...
@@ -181,6 +181,8 @@ xfs_generic_create(
}
}
#endif
#endif
xfs_setup_iops
(
ip
);
if
(
tmpfile
)
if
(
tmpfile
)
d_tmpfile
(
dentry
,
inode
);
d_tmpfile
(
dentry
,
inode
);
else
else
...
@@ -368,6 +370,8 @@ xfs_vn_symlink(
...
@@ -368,6 +370,8 @@ xfs_vn_symlink(
if
(
unlikely
(
error
))
if
(
unlikely
(
error
))
goto
out_cleanup_inode
;
goto
out_cleanup_inode
;
xfs_setup_iops
(
cip
);
d_instantiate
(
dentry
,
inode
);
d_instantiate
(
dentry
,
inode
);
xfs_finish_inode_setup
(
cip
);
xfs_finish_inode_setup
(
cip
);
return
0
;
return
0
;
...
@@ -442,6 +446,16 @@ xfs_vn_get_link(
...
@@ -442,6 +446,16 @@ xfs_vn_get_link(
return
ERR_PTR
(
error
);
return
ERR_PTR
(
error
);
}
}
STATIC
const
char
*
xfs_vn_get_link_inline
(
struct
dentry
*
dentry
,
struct
inode
*
inode
,
struct
delayed_call
*
done
)
{
ASSERT
(
XFS_I
(
inode
)
->
i_df
.
if_flags
&
XFS_IFINLINE
);
return
XFS_I
(
inode
)
->
i_df
.
if_u1
.
if_data
;
}
STATIC
int
STATIC
int
xfs_vn_getattr
(
xfs_vn_getattr
(
struct
vfsmount
*
mnt
,
struct
vfsmount
*
mnt
,
...
@@ -1160,6 +1174,18 @@ static const struct inode_operations xfs_symlink_inode_operations = {
...
@@ -1160,6 +1174,18 @@ static const struct inode_operations xfs_symlink_inode_operations = {
.
update_time
=
xfs_vn_update_time
,
.
update_time
=
xfs_vn_update_time
,
};
};
static
const
struct
inode_operations
xfs_inline_symlink_inode_operations
=
{
.
readlink
=
generic_readlink
,
.
get_link
=
xfs_vn_get_link_inline
,
.
getattr
=
xfs_vn_getattr
,
.
setattr
=
xfs_vn_setattr
,
.
setxattr
=
generic_setxattr
,
.
getxattr
=
generic_getxattr
,
.
removexattr
=
generic_removexattr
,
.
listxattr
=
xfs_vn_listxattr
,
.
update_time
=
xfs_vn_update_time
,
};
STATIC
void
STATIC
void
xfs_diflags_to_iflags
(
xfs_diflags_to_iflags
(
struct
inode
*
inode
,
struct
inode
*
inode
,
...
@@ -1186,7 +1212,7 @@ xfs_diflags_to_iflags(
...
@@ -1186,7 +1212,7 @@ xfs_diflags_to_iflags(
}
}
/*
/*
* Initialize the Linux inode
and set up the operation vectors
.
* Initialize the Linux inode.
*
*
* When reading existing inodes from disk this is called directly from xfs_iget,
* When reading existing inodes from disk this is called directly from xfs_iget,
* when creating a new inode it is called from xfs_ialloc after setting up the
* when creating a new inode it is called from xfs_ialloc after setting up the
...
@@ -1225,8 +1251,38 @@ xfs_setup_inode(
...
@@ -1225,8 +1251,38 @@ xfs_setup_inode(
i_size_write
(
inode
,
ip
->
i_d
.
di_size
);
i_size_write
(
inode
,
ip
->
i_d
.
di_size
);
xfs_diflags_to_iflags
(
inode
,
ip
);
xfs_diflags_to_iflags
(
inode
,
ip
);
if
(
S_ISDIR
(
inode
->
i_mode
))
{
lockdep_set_class
(
&
ip
->
i_lock
.
mr_lock
,
&
xfs_dir_ilock_class
);
ip
->
d_ops
=
ip
->
i_mount
->
m_dir_inode_ops
;
}
else
{
ip
->
d_ops
=
ip
->
i_mount
->
m_nondir_inode_ops
;
ip
->
d_ops
=
ip
->
i_mount
->
m_nondir_inode_ops
;
lockdep_set_class
(
&
ip
->
i_lock
.
mr_lock
,
&
xfs_nondir_ilock_class
);
lockdep_set_class
(
&
ip
->
i_lock
.
mr_lock
,
&
xfs_nondir_ilock_class
);
}
/*
* Ensure all page cache allocations are done from GFP_NOFS context to
* prevent direct reclaim recursion back into the filesystem and blowing
* stacks or deadlocking.
*/
gfp_mask
=
mapping_gfp_mask
(
inode
->
i_mapping
);
mapping_set_gfp_mask
(
inode
->
i_mapping
,
(
gfp_mask
&
~
(
__GFP_FS
)));
/*
* If there is no attribute fork no ACL can exist on this inode,
* and it can't have any file capabilities attached to it either.
*/
if
(
!
XFS_IFORK_Q
(
ip
))
{
inode_has_no_xattr
(
inode
);
cache_no_acl
(
inode
);
}
}
void
xfs_setup_iops
(
struct
xfs_inode
*
ip
)
{
struct
inode
*
inode
=
&
ip
->
i_vnode
;
switch
(
inode
->
i_mode
&
S_IFMT
)
{
switch
(
inode
->
i_mode
&
S_IFMT
)
{
case
S_IFREG
:
case
S_IFREG
:
inode
->
i_op
=
&
xfs_inode_operations
;
inode
->
i_op
=
&
xfs_inode_operations
;
...
@@ -1234,39 +1290,21 @@ xfs_setup_inode(
...
@@ -1234,39 +1290,21 @@ xfs_setup_inode(
inode
->
i_mapping
->
a_ops
=
&
xfs_address_space_operations
;
inode
->
i_mapping
->
a_ops
=
&
xfs_address_space_operations
;
break
;
break
;
case
S_IFDIR
:
case
S_IFDIR
:
lockdep_set_class
(
&
ip
->
i_lock
.
mr_lock
,
&
xfs_dir_ilock_class
);
if
(
xfs_sb_version_hasasciici
(
&
XFS_M
(
inode
->
i_sb
)
->
m_sb
))
if
(
xfs_sb_version_hasasciici
(
&
XFS_M
(
inode
->
i_sb
)
->
m_sb
))
inode
->
i_op
=
&
xfs_dir_ci_inode_operations
;
inode
->
i_op
=
&
xfs_dir_ci_inode_operations
;
else
else
inode
->
i_op
=
&
xfs_dir_inode_operations
;
inode
->
i_op
=
&
xfs_dir_inode_operations
;
inode
->
i_fop
=
&
xfs_dir_file_operations
;
inode
->
i_fop
=
&
xfs_dir_file_operations
;
ip
->
d_ops
=
ip
->
i_mount
->
m_dir_inode_ops
;
break
;
break
;
case
S_IFLNK
:
case
S_IFLNK
:
if
(
ip
->
i_df
.
if_flags
&
XFS_IFINLINE
)
inode
->
i_op
=
&
xfs_inline_symlink_inode_operations
;
else
inode
->
i_op
=
&
xfs_symlink_inode_operations
;
inode
->
i_op
=
&
xfs_symlink_inode_operations
;
if
(
!
(
ip
->
i_df
.
if_flags
&
XFS_IFINLINE
))
inode
->
i_mapping
->
a_ops
=
&
xfs_address_space_operations
;
break
;
break
;
default:
default:
inode
->
i_op
=
&
xfs_inode_operations
;
inode
->
i_op
=
&
xfs_inode_operations
;
init_special_inode
(
inode
,
inode
->
i_mode
,
inode
->
i_rdev
);
init_special_inode
(
inode
,
inode
->
i_mode
,
inode
->
i_rdev
);
break
;
break
;
}
}
/*
* Ensure all page cache allocations are done from GFP_NOFS context to
* prevent direct reclaim recursion back into the filesystem and blowing
* stacks or deadlocking.
*/
gfp_mask
=
mapping_gfp_mask
(
inode
->
i_mapping
);
mapping_set_gfp_mask
(
inode
->
i_mapping
,
(
gfp_mask
&
~
(
__GFP_FS
)));
/*
* If there is no attribute fork no ACL can exist on this inode,
* and it can't have any file capabilities attached to it either.
*/
if
(
!
XFS_IFORK_Q
(
ip
))
{
inode_has_no_xattr
(
inode
);
cache_no_acl
(
inode
);
}
}
}
fs/xfs/xfs_symlink.c
浏览文件 @
5b911354
...
@@ -131,6 +131,8 @@ xfs_readlink(
...
@@ -131,6 +131,8 @@ xfs_readlink(
trace_xfs_readlink
(
ip
);
trace_xfs_readlink
(
ip
);
ASSERT
(
!
(
ip
->
i_df
.
if_flags
&
XFS_IFINLINE
));
if
(
XFS_FORCED_SHUTDOWN
(
mp
))
if
(
XFS_FORCED_SHUTDOWN
(
mp
))
return
-
EIO
;
return
-
EIO
;
...
@@ -150,12 +152,7 @@ xfs_readlink(
...
@@ -150,12 +152,7 @@ xfs_readlink(
}
}
if
(
ip
->
i_df
.
if_flags
&
XFS_IFINLINE
)
{
memcpy
(
link
,
ip
->
i_df
.
if_u1
.
if_data
,
pathlen
);
link
[
pathlen
]
=
'\0'
;
}
else
{
error
=
xfs_readlink_bmap
(
ip
,
link
);
error
=
xfs_readlink_bmap
(
ip
,
link
);
}
out:
out:
xfs_iunlock
(
ip
,
XFS_ILOCK_SHARED
);
xfs_iunlock
(
ip
,
XFS_ILOCK_SHARED
);
...
@@ -303,19 +300,11 @@ xfs_symlink(
...
@@ -303,19 +300,11 @@ xfs_symlink(
* If the symlink will fit into the inode, write it inline.
* If the symlink will fit into the inode, write it inline.
*/
*/
if
(
pathlen
<=
XFS_IFORK_DSIZE
(
ip
))
{
if
(
pathlen
<=
XFS_IFORK_DSIZE
(
ip
))
{
xfs_idata_realloc
(
ip
,
pathlen
,
XFS_DATA_FORK
);
xfs_init_local_fork
(
ip
,
XFS_DATA_FORK
,
target_path
,
pathlen
);
memcpy
(
ip
->
i_df
.
if_u1
.
if_data
,
target_path
,
pathlen
);
ip
->
i_d
.
di_size
=
pathlen
;
/*
* The inode was initially created in extent format.
*/
ip
->
i_df
.
if_flags
&=
~
(
XFS_IFEXTENTS
|
XFS_IFBROOT
);
ip
->
i_df
.
if_flags
|=
XFS_IFINLINE
;
ip
->
i_d
.
di_size
=
pathlen
;
ip
->
i_d
.
di_format
=
XFS_DINODE_FMT_LOCAL
;
ip
->
i_d
.
di_format
=
XFS_DINODE_FMT_LOCAL
;
xfs_trans_log_inode
(
tp
,
ip
,
XFS_ILOG_DDATA
|
XFS_ILOG_CORE
);
xfs_trans_log_inode
(
tp
,
ip
,
XFS_ILOG_DDATA
|
XFS_ILOG_CORE
);
}
else
{
}
else
{
int
offset
;
int
offset
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录