Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
571dba52
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
571dba52
编写于
9月 24, 2010
作者:
G
Greg Farnum
提交者:
Sage Weil
10月 20, 2010
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ceph: add CEPH_MDS_OP_SETDIRLAYOUT and associated ioctl.
Signed-off-by:
N
Sage Weil
<
sage@newdream.net
>
上级
010e3b48
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
70 addition
and
1 deletion
+70
-1
fs/ceph/ioctl.c
fs/ceph/ioctl.c
+66
-0
fs/ceph/ioctl.h
fs/ceph/ioctl.h
+3
-1
include/linux/ceph/ceph_fs.h
include/linux/ceph/ceph_fs.h
+1
-0
未找到文件。
fs/ceph/ioctl.c
浏览文件 @
571dba52
...
...
@@ -91,6 +91,68 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
return
err
;
}
/*
* Set a layout policy on a directory inode. All items in the tree
* rooted at this inode will inherit this layout on creation,
* (It doesn't apply retroactively )
* unless a subdirectory has its own layout policy.
*/
static
long
ceph_ioctl_set_layout_policy
(
struct
file
*
file
,
void
__user
*
arg
)
{
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
struct
ceph_mds_request
*
req
;
struct
ceph_ioctl_layout
l
;
int
err
,
i
;
struct
ceph_mds_client
*
mdsc
=
ceph_sb_to_client
(
inode
->
i_sb
)
->
mdsc
;
/* copy and validate */
if
(
copy_from_user
(
&
l
,
arg
,
sizeof
(
l
)))
return
-
EFAULT
;
if
((
l
.
object_size
&
~
PAGE_MASK
)
||
(
l
.
stripe_unit
&
~
PAGE_MASK
)
||
!
l
.
stripe_unit
||
(
l
.
object_size
&&
(
unsigned
)
l
.
object_size
%
(
unsigned
)
l
.
stripe_unit
))
return
-
EINVAL
;
/* make sure it's a valid data pool */
if
(
l
.
data_pool
>
0
)
{
mutex_lock
(
&
mdsc
->
mutex
);
err
=
-
EINVAL
;
for
(
i
=
0
;
i
<
mdsc
->
mdsmap
->
m_num_data_pg_pools
;
i
++
)
if
(
mdsc
->
mdsmap
->
m_data_pg_pools
[
i
]
==
l
.
data_pool
)
{
err
=
0
;
break
;
}
mutex_unlock
(
&
mdsc
->
mutex
);
if
(
err
)
return
err
;
}
req
=
ceph_mdsc_create_request
(
mdsc
,
CEPH_MDS_OP_SETDIRLAYOUT
,
USE_AUTH_MDS
);
if
(
IS_ERR
(
req
))
return
PTR_ERR
(
req
);
req
->
r_inode
=
igrab
(
inode
);
req
->
r_args
.
setlayout
.
layout
.
fl_stripe_unit
=
cpu_to_le32
(
l
.
stripe_unit
);
req
->
r_args
.
setlayout
.
layout
.
fl_stripe_count
=
cpu_to_le32
(
l
.
stripe_count
);
req
->
r_args
.
setlayout
.
layout
.
fl_object_size
=
cpu_to_le32
(
l
.
object_size
);
req
->
r_args
.
setlayout
.
layout
.
fl_pg_pool
=
cpu_to_le32
(
l
.
data_pool
);
req
->
r_args
.
setlayout
.
layout
.
fl_pg_preferred
=
cpu_to_le32
(
l
.
preferred_osd
);
err
=
ceph_mdsc_do_request
(
mdsc
,
inode
,
req
);
ceph_mdsc_put_request
(
req
);
return
err
;
}
/*
* Return object name, size/offset information, and location (OSD
* number, network address) for a given file offset.
...
...
@@ -177,11 +239,15 @@ long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case
CEPH_IOC_SET_LAYOUT
:
return
ceph_ioctl_set_layout
(
file
,
(
void
__user
*
)
arg
);
case
CEPH_IOC_SET_LAYOUT_POLICY
:
return
ceph_ioctl_set_layout_policy
(
file
,
(
void
__user
*
)
arg
);
case
CEPH_IOC_GET_DATALOC
:
return
ceph_ioctl_get_dataloc
(
file
,
(
void
__user
*
)
arg
);
case
CEPH_IOC_LAZYIO
:
return
ceph_ioctl_lazyio
(
file
);
}
return
-
ENOTTY
;
}
fs/ceph/ioctl.h
浏览文件 @
571dba52
...
...
@@ -4,7 +4,7 @@
#include <linux/ioctl.h>
#include <linux/types.h>
#define CEPH_IOCTL_MAGIC 0x9
7
#define CEPH_IOCTL_MAGIC 0x9
8
/* just use u64 to align sanely on all archs */
struct
ceph_ioctl_layout
{
...
...
@@ -17,6 +17,8 @@ struct ceph_ioctl_layout {
struct ceph_ioctl_layout)
#define CEPH_IOC_SET_LAYOUT _IOW(CEPH_IOCTL_MAGIC, 2, \
struct ceph_ioctl_layout)
#define CEPH_IOC_SET_LAYOUT_POLICY _IOW(CEPH_IOCTL_MAGIC, 5, \
struct ceph_ioctl_layout)
/*
* Extract identity, address of the OSD and object storing a given
...
...
include/linux/ceph/ceph_fs.h
浏览文件 @
571dba52
...
...
@@ -299,6 +299,7 @@ enum {
CEPH_MDS_OP_SETATTR
=
0x01108
,
CEPH_MDS_OP_SETFILELOCK
=
0x01109
,
CEPH_MDS_OP_GETFILELOCK
=
0x00110
,
CEPH_MDS_OP_SETDIRLAYOUT
=
0x0110a
,
CEPH_MDS_OP_MKNOD
=
0x01201
,
CEPH_MDS_OP_LINK
=
0x01202
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录