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
Kirill Smelkov
linux
Commits
737cc81e
Commit
737cc81e
authored
May 26, 2016
by
Ilya Dryomov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libceph: support for subscribing to "mdsmap.<id>" maps
Signed-off-by:
Ilya Dryomov
<
idryomov@gmail.com
>
parent
7cca78c9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
5 deletions
+17
-5
include/linux/ceph/ceph_fs.h
include/linux/ceph/ceph_fs.h
+2
-0
include/linux/ceph/mon_client.h
include/linux/ceph/mon_client.h
+1
-0
net/ceph/debugfs.c
net/ceph/debugfs.c
+1
-0
net/ceph/mon_client.c
net/ceph/mon_client.c
+13
-5
No files found.
include/linux/ceph/ceph_fs.h
View file @
737cc81e
...
@@ -208,6 +208,8 @@ struct ceph_mon_subscribe_ack {
...
@@ -208,6 +208,8 @@ struct ceph_mon_subscribe_ack {
struct
ceph_fsid
fsid
;
struct
ceph_fsid
fsid
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
#define CEPH_FS_CLUSTER_ID_NONE -1
/*
/*
* mdsmap flags
* mdsmap flags
*/
*/
...
...
include/linux/ceph/mon_client.h
View file @
737cc81e
...
@@ -96,6 +96,7 @@ struct ceph_mon_client {
...
@@ -96,6 +96,7 @@ struct ceph_mon_client {
bool
want
;
bool
want
;
u32
have
;
/* epoch */
u32
have
;
/* epoch */
}
subs
[
3
];
}
subs
[
3
];
int
fs_cluster_id
;
/* "mdsmap.<id>" sub */
#ifdef CONFIG_DEBUG_FS
#ifdef CONFIG_DEBUG_FS
struct
dentry
*
debugfs_file
;
struct
dentry
*
debugfs_file
;
...
...
net/ceph/debugfs.c
View file @
737cc81e
...
@@ -128,6 +128,7 @@ static int monc_show(struct seq_file *s, void *p)
...
@@ -128,6 +128,7 @@ static int monc_show(struct seq_file *s, void *p)
CEPH_SUBSCRIBE_ONETIME
?
""
:
"+"
));
CEPH_SUBSCRIBE_ONETIME
?
""
:
"+"
));
seq_putc
(
s
,
'\n'
);
seq_putc
(
s
,
'\n'
);
}
}
seq_printf
(
s
,
"fs_cluster_id %d
\n
"
,
monc
->
fs_cluster_id
);
for
(
rp
=
rb_first
(
&
monc
->
generic_request_tree
);
rp
;
rp
=
rb_next
(
rp
))
{
for
(
rp
=
rb_first
(
&
monc
->
generic_request_tree
);
rp
;
rp
=
rb_next
(
rp
))
{
__u16
op
;
__u16
op
;
...
...
net/ceph/mon_client.c
View file @
737cc81e
...
@@ -260,20 +260,26 @@ static void __send_subscribe(struct ceph_mon_client *monc)
...
@@ -260,20 +260,26 @@ static void __send_subscribe(struct ceph_mon_client *monc)
BUG_ON
(
num
<
1
);
/* monmap sub is always there */
BUG_ON
(
num
<
1
);
/* monmap sub is always there */
ceph_encode_32
(
&
p
,
num
);
ceph_encode_32
(
&
p
,
num
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
monc
->
subs
);
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
monc
->
subs
);
i
++
)
{
const
char
*
s
=
ceph_sub_str
[
i
];
char
buf
[
32
];
int
len
;
if
(
!
monc
->
subs
[
i
].
want
)
if
(
!
monc
->
subs
[
i
].
want
)
continue
;
continue
;
dout
(
"%s %s start %llu flags 0x%x
\n
"
,
__func__
,
s
,
len
=
sprintf
(
buf
,
"%s"
,
ceph_sub_str
[
i
]);
if
(
i
==
CEPH_SUB_MDSMAP
&&
monc
->
fs_cluster_id
!=
CEPH_FS_CLUSTER_ID_NONE
)
len
+=
sprintf
(
buf
+
len
,
".%d"
,
monc
->
fs_cluster_id
);
dout
(
"%s %s start %llu flags 0x%x
\n
"
,
__func__
,
buf
,
le64_to_cpu
(
monc
->
subs
[
i
].
item
.
start
),
le64_to_cpu
(
monc
->
subs
[
i
].
item
.
start
),
monc
->
subs
[
i
].
item
.
flags
);
monc
->
subs
[
i
].
item
.
flags
);
ceph_encode_string
(
&
p
,
end
,
s
,
strlen
(
s
)
);
ceph_encode_string
(
&
p
,
end
,
buf
,
len
);
memcpy
(
p
,
&
monc
->
subs
[
i
].
item
,
sizeof
(
monc
->
subs
[
i
].
item
));
memcpy
(
p
,
&
monc
->
subs
[
i
].
item
,
sizeof
(
monc
->
subs
[
i
].
item
));
p
+=
sizeof
(
monc
->
subs
[
i
].
item
);
p
+=
sizeof
(
monc
->
subs
[
i
].
item
);
}
}
BUG_ON
(
p
!=
(
end
-
35
-
(
ARRAY_SIZE
(
monc
->
subs
)
-
num
)
*
19
)
);
BUG_ON
(
p
>
end
);
msg
->
front
.
iov_len
=
p
-
msg
->
front
.
iov_base
;
msg
->
front
.
iov_len
=
p
-
msg
->
front
.
iov_base
;
msg
->
hdr
.
front_len
=
cpu_to_le32
(
msg
->
front
.
iov_len
);
msg
->
hdr
.
front_len
=
cpu_to_le32
(
msg
->
front
.
iov_len
);
ceph_msg_revoke
(
msg
);
ceph_msg_revoke
(
msg
);
...
@@ -948,7 +954,7 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
...
@@ -948,7 +954,7 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
if
(
!
monc
->
m_subscribe_ack
)
if
(
!
monc
->
m_subscribe_ack
)
goto
out_auth
;
goto
out_auth
;
monc
->
m_subscribe
=
ceph_msg_new
(
CEPH_MSG_MON_SUBSCRIBE
,
96
,
GFP_NOFS
,
monc
->
m_subscribe
=
ceph_msg_new
(
CEPH_MSG_MON_SUBSCRIBE
,
128
,
GFP_NOFS
,
true
);
true
);
if
(
!
monc
->
m_subscribe
)
if
(
!
monc
->
m_subscribe
)
goto
out_subscribe_ack
;
goto
out_subscribe_ack
;
...
@@ -974,6 +980,8 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
...
@@ -974,6 +980,8 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
monc
->
generic_request_tree
=
RB_ROOT
;
monc
->
generic_request_tree
=
RB_ROOT
;
monc
->
last_tid
=
0
;
monc
->
last_tid
=
0
;
monc
->
fs_cluster_id
=
CEPH_FS_CLUSTER_ID_NONE
;
return
0
;
return
0
;
out_auth_reply:
out_auth_reply:
...
...
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