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
969e5aa3
Commit
969e5aa3
authored
Jan 30, 2013
by
Alex Elder
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'testing' of github.com:ceph/ceph-client into v3.8-rc5-testing
parents
949db153
1ec3911d
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
652 additions
and
611 deletions
+652
-611
drivers/block/rbd.c
drivers/block/rbd.c
+444
-411
fs/ceph/caps.c
fs/ceph/caps.c
+25
-7
fs/ceph/file.c
fs/ceph/file.c
+6
-0
fs/ceph/ioctl.c
fs/ceph/ioctl.c
+1
-1
fs/ceph/mds_client.c
fs/ceph/mds_client.c
+31
-2
fs/ceph/mds_client.h
fs/ceph/mds_client.h
+6
-0
include/linux/ceph/ceph_features.h
include/linux/ceph/ceph_features.h
+7
-1
include/linux/ceph/decode.h
include/linux/ceph/decode.h
+17
-12
include/linux/ceph/osd_client.h
include/linux/ceph/osd_client.h
+9
-15
include/linux/ceph/osdmap.h
include/linux/ceph/osdmap.h
+1
-1
include/linux/crush/crush.h
include/linux/crush/crush.h
+2
-0
net/ceph/crush/mapper.c
net/ceph/crush/mapper.c
+11
-4
net/ceph/osd_client.c
net/ceph/osd_client.c
+72
-134
net/ceph/osdmap.c
net/ceph/osdmap.c
+20
-23
No files found.
drivers/block/rbd.c
View file @
969e5aa3
This diff is collapsed.
Click to expand it.
fs/ceph/caps.c
View file @
969e5aa3
...
@@ -611,8 +611,16 @@ int ceph_add_cap(struct inode *inode,
...
@@ -611,8 +611,16 @@ int ceph_add_cap(struct inode *inode,
if
(
flags
&
CEPH_CAP_FLAG_AUTH
)
if
(
flags
&
CEPH_CAP_FLAG_AUTH
)
ci
->
i_auth_cap
=
cap
;
ci
->
i_auth_cap
=
cap
;
else
if
(
ci
->
i_auth_cap
==
cap
)
else
if
(
ci
->
i_auth_cap
==
cap
)
{
ci
->
i_auth_cap
=
NULL
;
ci
->
i_auth_cap
=
NULL
;
spin_lock
(
&
mdsc
->
cap_dirty_lock
);
if
(
!
list_empty
(
&
ci
->
i_dirty_item
))
{
dout
(
" moving %p to cap_dirty_migrating
\n
"
,
inode
);
list_move
(
&
ci
->
i_dirty_item
,
&
mdsc
->
cap_dirty_migrating
);
}
spin_unlock
(
&
mdsc
->
cap_dirty_lock
);
}
dout
(
"add_cap inode %p (%llx.%llx) cap %p %s now %s seq %d mds%d
\n
"
,
dout
(
"add_cap inode %p (%llx.%llx) cap %p %s now %s seq %d mds%d
\n
"
,
inode
,
ceph_vinop
(
inode
),
cap
,
ceph_cap_string
(
issued
),
inode
,
ceph_vinop
(
inode
),
cap
,
ceph_cap_string
(
issued
),
...
@@ -1460,7 +1468,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
...
@@ -1460,7 +1468,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
struct
ceph_mds_client
*
mdsc
=
fsc
->
mdsc
;
struct
ceph_mds_client
*
mdsc
=
fsc
->
mdsc
;
struct
inode
*
inode
=
&
ci
->
vfs_inode
;
struct
inode
*
inode
=
&
ci
->
vfs_inode
;
struct
ceph_cap
*
cap
;
struct
ceph_cap
*
cap
;
int
file_wanted
,
used
;
int
file_wanted
,
used
,
cap_used
;
int
took_snap_rwsem
=
0
;
/* true if mdsc->snap_rwsem held */
int
took_snap_rwsem
=
0
;
/* true if mdsc->snap_rwsem held */
int
issued
,
implemented
,
want
,
retain
,
revoking
,
flushing
=
0
;
int
issued
,
implemented
,
want
,
retain
,
revoking
,
flushing
=
0
;
int
mds
=
-
1
;
/* keep track of how far we've gone through i_caps list
int
mds
=
-
1
;
/* keep track of how far we've gone through i_caps list
...
@@ -1563,9 +1571,14 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
...
@@ -1563,9 +1571,14 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
/* NOTE: no side-effects allowed, until we take s_mutex */
/* NOTE: no side-effects allowed, until we take s_mutex */
cap_used
=
used
;
if
(
ci
->
i_auth_cap
&&
cap
!=
ci
->
i_auth_cap
)
cap_used
&=
~
ci
->
i_auth_cap
->
issued
;
revoking
=
cap
->
implemented
&
~
cap
->
issued
;
revoking
=
cap
->
implemented
&
~
cap
->
issued
;
dout
(
" mds%d cap %p issued %s implemented %s revoking %s
\n
"
,
dout
(
" mds%d cap %p
used %s
issued %s implemented %s revoking %s
\n
"
,
cap
->
mds
,
cap
,
ceph_cap_string
(
cap
->
issued
),
cap
->
mds
,
cap
,
ceph_cap_string
(
cap
->
issued
),
ceph_cap_string
(
cap_used
),
ceph_cap_string
(
cap
->
implemented
),
ceph_cap_string
(
cap
->
implemented
),
ceph_cap_string
(
revoking
));
ceph_cap_string
(
revoking
));
...
@@ -1593,7 +1606,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
...
@@ -1593,7 +1606,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
}
}
/* completed revocation? going down and there are no caps? */
/* completed revocation? going down and there are no caps? */
if
(
revoking
&&
(
revoking
&
used
)
==
0
)
{
if
(
revoking
&&
(
revoking
&
cap_
used
)
==
0
)
{
dout
(
"completed revocation of %s
\n
"
,
dout
(
"completed revocation of %s
\n
"
,
ceph_cap_string
(
cap
->
implemented
&
~
cap
->
issued
));
ceph_cap_string
(
cap
->
implemented
&
~
cap
->
issued
));
goto
ack
;
goto
ack
;
...
@@ -1670,8 +1683,8 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
...
@@ -1670,8 +1683,8 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
sent
++
;
sent
++
;
/* __send_cap drops i_ceph_lock */
/* __send_cap drops i_ceph_lock */
delayed
+=
__send_cap
(
mdsc
,
cap
,
CEPH_CAP_OP_UPDATE
,
used
,
want
,
delayed
+=
__send_cap
(
mdsc
,
cap
,
CEPH_CAP_OP_UPDATE
,
cap_used
,
retain
,
flushing
,
NULL
);
want
,
retain
,
flushing
,
NULL
);
goto
retry
;
/* retake i_ceph_lock and restart our cap scan. */
goto
retry
;
/* retake i_ceph_lock and restart our cap scan. */
}
}
...
@@ -2416,7 +2429,9 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
...
@@ -2416,7 +2429,9 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
dout
(
"mds wanted %s -> %s
\n
"
,
dout
(
"mds wanted %s -> %s
\n
"
,
ceph_cap_string
(
le32_to_cpu
(
grant
->
wanted
)),
ceph_cap_string
(
le32_to_cpu
(
grant
->
wanted
)),
ceph_cap_string
(
wanted
));
ceph_cap_string
(
wanted
));
grant
->
wanted
=
cpu_to_le32
(
wanted
);
/* imported cap may not have correct mds_wanted */
if
(
le32_to_cpu
(
grant
->
op
)
==
CEPH_CAP_OP_IMPORT
)
check_caps
=
1
;
}
}
cap
->
seq
=
seq
;
cap
->
seq
=
seq
;
...
@@ -2820,6 +2835,9 @@ void ceph_handle_caps(struct ceph_mds_session *session,
...
@@ -2820,6 +2835,9 @@ void ceph_handle_caps(struct ceph_mds_session *session,
dout
(
" mds%d seq %lld cap seq %u
\n
"
,
session
->
s_mds
,
session
->
s_seq
,
dout
(
" mds%d seq %lld cap seq %u
\n
"
,
session
->
s_mds
,
session
->
s_seq
,
(
unsigned
)
seq
);
(
unsigned
)
seq
);
if
(
op
==
CEPH_CAP_OP_IMPORT
)
ceph_add_cap_releases
(
mdsc
,
session
);
/* lookup ino */
/* lookup ino */
inode
=
ceph_find_inode
(
sb
,
vino
);
inode
=
ceph_find_inode
(
sb
,
vino
);
ci
=
ceph_inode
(
inode
);
ci
=
ceph_inode
(
inode
);
...
...
fs/ceph/file.c
View file @
969e5aa3
...
@@ -243,6 +243,9 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
...
@@ -243,6 +243,9 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
err
=
ceph_mdsc_do_request
(
mdsc
,
err
=
ceph_mdsc_do_request
(
mdsc
,
(
flags
&
(
O_CREAT
|
O_TRUNC
))
?
dir
:
NULL
,
(
flags
&
(
O_CREAT
|
O_TRUNC
))
?
dir
:
NULL
,
req
);
req
);
if
(
err
)
goto
out_err
;
err
=
ceph_handle_snapdir
(
req
,
dentry
,
err
);
err
=
ceph_handle_snapdir
(
req
,
dentry
,
err
);
if
(
err
==
0
&&
(
flags
&
O_CREAT
)
&&
!
req
->
r_reply_info
.
head
->
is_dentry
)
if
(
err
==
0
&&
(
flags
&
O_CREAT
)
&&
!
req
->
r_reply_info
.
head
->
is_dentry
)
err
=
ceph_handle_notrace_create
(
dir
,
dentry
);
err
=
ceph_handle_notrace_create
(
dir
,
dentry
);
...
@@ -263,6 +266,9 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
...
@@ -263,6 +266,9 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
err
=
finish_no_open
(
file
,
dn
);
err
=
finish_no_open
(
file
,
dn
);
}
else
{
}
else
{
dout
(
"atomic_open finish_open on dn %p
\n
"
,
dn
);
dout
(
"atomic_open finish_open on dn %p
\n
"
,
dn
);
if
(
req
->
r_op
==
CEPH_MDS_OP_CREATE
&&
req
->
r_reply_info
.
has_create_ino
)
{
*
opened
|=
FILE_CREATED
;
}
err
=
finish_open
(
file
,
dentry
,
ceph_open
,
opened
);
err
=
finish_open
(
file
,
dentry
,
ceph_open
,
opened
);
}
}
...
...
fs/ceph/ioctl.c
View file @
969e5aa3
...
@@ -194,7 +194,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
...
@@ -194,7 +194,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
return
-
EFAULT
;
return
-
EFAULT
;
down_read
(
&
osdc
->
map_sem
);
down_read
(
&
osdc
->
map_sem
);
r
=
ceph_calc_file_object_mapping
(
&
ci
->
i_layout
,
dl
.
file_offset
,
&
len
,
r
=
ceph_calc_file_object_mapping
(
&
ci
->
i_layout
,
dl
.
file_offset
,
len
,
&
dl
.
object_no
,
&
dl
.
object_offset
,
&
dl
.
object_no
,
&
dl
.
object_offset
,
&
olen
);
&
olen
);
if
(
r
<
0
)
if
(
r
<
0
)
...
...
fs/ceph/mds_client.c
View file @
969e5aa3
...
@@ -232,6 +232,30 @@ static int parse_reply_info_filelock(void **p, void *end,
...
@@ -232,6 +232,30 @@ static int parse_reply_info_filelock(void **p, void *end,
return
-
EIO
;
return
-
EIO
;
}
}
/*
* parse create results
*/
static
int
parse_reply_info_create
(
void
**
p
,
void
*
end
,
struct
ceph_mds_reply_info_parsed
*
info
,
int
features
)
{
if
(
features
&
CEPH_FEATURE_REPLY_CREATE_INODE
)
{
if
(
*
p
==
end
)
{
info
->
has_create_ino
=
false
;
}
else
{
info
->
has_create_ino
=
true
;
info
->
ino
=
ceph_decode_64
(
p
);
}
}
if
(
unlikely
(
*
p
!=
end
))
goto
bad
;
return
0
;
bad:
return
-
EIO
;
}
/*
/*
* parse extra results
* parse extra results
*/
*/
...
@@ -241,8 +265,12 @@ static int parse_reply_info_extra(void **p, void *end,
...
@@ -241,8 +265,12 @@ static int parse_reply_info_extra(void **p, void *end,
{
{
if
(
info
->
head
->
op
==
CEPH_MDS_OP_GETFILELOCK
)
if
(
info
->
head
->
op
==
CEPH_MDS_OP_GETFILELOCK
)
return
parse_reply_info_filelock
(
p
,
end
,
info
,
features
);
return
parse_reply_info_filelock
(
p
,
end
,
info
,
features
);
else
else
if
(
info
->
head
->
op
==
CEPH_MDS_OP_READDIR
)
return
parse_reply_info_dir
(
p
,
end
,
info
,
features
);
return
parse_reply_info_dir
(
p
,
end
,
info
,
features
);
else
if
(
info
->
head
->
op
==
CEPH_MDS_OP_CREATE
)
return
parse_reply_info_create
(
p
,
end
,
info
,
features
);
else
return
-
EIO
;
}
}
/*
/*
...
@@ -2170,7 +2198,8 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
...
@@ -2170,7 +2198,8 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
mutex_lock
(
&
req
->
r_fill_mutex
);
mutex_lock
(
&
req
->
r_fill_mutex
);
err
=
ceph_fill_trace
(
mdsc
->
fsc
->
sb
,
req
,
req
->
r_session
);
err
=
ceph_fill_trace
(
mdsc
->
fsc
->
sb
,
req
,
req
->
r_session
);
if
(
err
==
0
)
{
if
(
err
==
0
)
{
if
(
result
==
0
&&
req
->
r_op
!=
CEPH_MDS_OP_GETFILELOCK
&&
if
(
result
==
0
&&
(
req
->
r_op
==
CEPH_MDS_OP_READDIR
||
req
->
r_op
==
CEPH_MDS_OP_LSSNAP
)
&&
rinfo
->
dir_nr
)
rinfo
->
dir_nr
)
ceph_readdir_prepopulate
(
req
,
req
->
r_session
);
ceph_readdir_prepopulate
(
req
,
req
->
r_session
);
ceph_unreserve_caps
(
mdsc
,
&
req
->
r_caps_reservation
);
ceph_unreserve_caps
(
mdsc
,
&
req
->
r_caps_reservation
);
...
...
fs/ceph/mds_client.h
View file @
969e5aa3
...
@@ -74,6 +74,12 @@ struct ceph_mds_reply_info_parsed {
...
@@ -74,6 +74,12 @@ struct ceph_mds_reply_info_parsed {
struct
ceph_mds_reply_info_in
*
dir_in
;
struct
ceph_mds_reply_info_in
*
dir_in
;
u8
dir_complete
,
dir_end
;
u8
dir_complete
,
dir_end
;
};
};
/* for create results */
struct
{
bool
has_create_ino
;
u64
ino
;
};
};
};
/* encoded blob describing snapshot contexts for certain
/* encoded blob describing snapshot contexts for certain
...
...
include/linux/ceph/ceph_features.h
View file @
969e5aa3
...
@@ -14,13 +14,19 @@
...
@@ -14,13 +14,19 @@
#define CEPH_FEATURE_DIRLAYOUTHASH (1<<7)
#define CEPH_FEATURE_DIRLAYOUTHASH (1<<7)
/* bits 8-17 defined by user-space; not supported yet here */
/* bits 8-17 defined by user-space; not supported yet here */
#define CEPH_FEATURE_CRUSH_TUNABLES (1<<18)
#define CEPH_FEATURE_CRUSH_TUNABLES (1<<18)
/* bits 19-24 defined by user-space; not supported yet here */
#define CEPH_FEATURE_CRUSH_TUNABLES2 (1<<25)
/* bit 26 defined by user-space; not supported yet here */
#define CEPH_FEATURE_REPLY_CREATE_INODE (1<<27)
/*
/*
* Features supported.
* Features supported.
*/
*/
#define CEPH_FEATURES_SUPPORTED_DEFAULT \
#define CEPH_FEATURES_SUPPORTED_DEFAULT \
(CEPH_FEATURE_NOSRCADDR | \
(CEPH_FEATURE_NOSRCADDR | \
CEPH_FEATURE_CRUSH_TUNABLES)
CEPH_FEATURE_CRUSH_TUNABLES | \
CEPH_FEATURE_CRUSH_TUNABLES2 | \
CEPH_FEATURE_REPLY_CREATE_INODE)
#define CEPH_FEATURES_REQUIRED_DEFAULT \
#define CEPH_FEATURES_REQUIRED_DEFAULT \
(CEPH_FEATURE_NOSRCADDR)
(CEPH_FEATURE_NOSRCADDR)
...
...
include/linux/ceph/decode.h
View file @
969e5aa3
...
@@ -52,10 +52,10 @@ static inline int ceph_has_room(void **p, void *end, size_t n)
...
@@ -52,10 +52,10 @@ static inline int ceph_has_room(void **p, void *end, size_t n)
return
end
>=
*
p
&&
n
<=
end
-
*
p
;
return
end
>=
*
p
&&
n
<=
end
-
*
p
;
}
}
#define ceph_decode_need(p, end, n, bad) \
#define ceph_decode_need(p, end, n, bad)
\
do { \
do {
\
if (!likely(ceph_has_room(p, end, n))) \
if (!likely(ceph_has_room(p, end, n)))
\
goto bad; \
goto bad;
\
} while (0)
} while (0)
#define ceph_decode_64_safe(p, end, v, bad) \
#define ceph_decode_64_safe(p, end, v, bad) \
...
@@ -99,8 +99,8 @@ static inline int ceph_has_room(void **p, void *end, size_t n)
...
@@ -99,8 +99,8 @@ static inline int ceph_has_room(void **p, void *end, size_t n)
*
*
* There are two possible failures:
* There are two possible failures:
* - converting the string would require accessing memory at or
* - converting the string would require accessing memory at or
* beyond the "end" pointer provided (-E
* beyond the "end" pointer provided (-E
RANGE)
* - memory could not be allocated for the result
* - memory could not be allocated for the result
(-ENOMEM)
*/
*/
static
inline
char
*
ceph_extract_encoded_string
(
void
**
p
,
void
*
end
,
static
inline
char
*
ceph_extract_encoded_string
(
void
**
p
,
void
*
end
,
size_t
*
lenp
,
gfp_t
gfp
)
size_t
*
lenp
,
gfp_t
gfp
)
...
@@ -217,10 +217,10 @@ static inline void ceph_encode_string(void **p, void *end,
...
@@ -217,10 +217,10 @@ static inline void ceph_encode_string(void **p, void *end,
*
p
+=
len
;
*
p
+=
len
;
}
}
#define ceph_encode_need(p, end, n, bad) \
#define ceph_encode_need(p, end, n, bad)
\
do { \
do {
\
if (!likely(ceph_has_room(p, end, n))) \
if (!likely(ceph_has_room(p, end, n)))
\
goto bad; \
goto bad;
\
} while (0)
} while (0)
#define ceph_encode_64_safe(p, end, v, bad) \
#define ceph_encode_64_safe(p, end, v, bad) \
...
@@ -231,12 +231,17 @@ static inline void ceph_encode_string(void **p, void *end,
...
@@ -231,12 +231,17 @@ static inline void ceph_encode_string(void **p, void *end,
#define ceph_encode_32_safe(p, end, v, bad) \
#define ceph_encode_32_safe(p, end, v, bad) \
do { \
do { \
ceph_encode_need(p, end, sizeof(u32), bad); \
ceph_encode_need(p, end, sizeof(u32), bad); \
ceph_encode_32(p, v); \
ceph_encode_32(p, v);
\
} while (0)
} while (0)
#define ceph_encode_16_safe(p, end, v, bad) \
#define ceph_encode_16_safe(p, end, v, bad) \
do { \
do { \
ceph_encode_need(p, end, sizeof(u16), bad); \
ceph_encode_need(p, end, sizeof(u16), bad); \
ceph_encode_16(p, v); \
ceph_encode_16(p, v); \
} while (0)
#define ceph_encode_8_safe(p, end, v, bad) \
do { \
ceph_encode_need(p, end, sizeof(u8), bad); \
ceph_encode_8(p, v); \
} while (0)
} while (0)
#define ceph_encode_copy_safe(p, end, pv, n, bad) \
#define ceph_encode_copy_safe(p, end, pv, n, bad) \
...
...
include/linux/ceph/osd_client.h
View file @
969e5aa3
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <linux/ceph/osdmap.h>
#include <linux/ceph/osdmap.h>
#include <linux/ceph/messenger.h>
#include <linux/ceph/messenger.h>
#include <linux/ceph/auth.h>
#include <linux/ceph/auth.h>
#include <linux/ceph/pagelist.h>
/*
/*
* Maximum object name size
* Maximum object name size
...
@@ -22,7 +23,6 @@ struct ceph_snap_context;
...
@@ -22,7 +23,6 @@ struct ceph_snap_context;
struct
ceph_osd_request
;
struct
ceph_osd_request
;
struct
ceph_osd_client
;
struct
ceph_osd_client
;
struct
ceph_authorizer
;
struct
ceph_authorizer
;
struct
ceph_pagelist
;
/*
/*
* completion callback for async writepages
* completion callback for async writepages
...
@@ -95,7 +95,7 @@ struct ceph_osd_request {
...
@@ -95,7 +95,7 @@ struct ceph_osd_request {
struct
bio
*
r_bio
;
/* instead of pages */
struct
bio
*
r_bio
;
/* instead of pages */
#endif
#endif
struct
ceph_pagelist
*
r_trail
;
/* trailing part of the data */
struct
ceph_pagelist
r_trail
;
/* trailing part of the data */
};
};
struct
ceph_osd_event
{
struct
ceph_osd_event
{
...
@@ -157,7 +157,6 @@ struct ceph_osd_client {
...
@@ -157,7 +157,6 @@ struct ceph_osd_client {
struct
ceph_osd_req_op
{
struct
ceph_osd_req_op
{
u16
op
;
/* CEPH_OSD_OP_* */
u16
op
;
/* CEPH_OSD_OP_* */
u32
flags
;
/* CEPH_OSD_FLAG_* */
union
{
union
{
struct
{
struct
{
u64
offset
,
length
;
u64
offset
,
length
;
...
@@ -207,29 +206,24 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
...
@@ -207,29 +206,24 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
extern
void
ceph_osdc_handle_map
(
struct
ceph_osd_client
*
osdc
,
extern
void
ceph_osdc_handle_map
(
struct
ceph_osd_client
*
osdc
,
struct
ceph_msg
*
msg
);
struct
ceph_msg
*
msg
);
extern
int
ceph_calc_raw_layout
(
struct
ceph_osd_client
*
osdc
,
extern
int
ceph_calc_raw_layout
(
struct
ceph_file_layout
*
layout
,
struct
ceph_file_layout
*
layout
,
u64
snapid
,
u64
off
,
u64
*
plen
,
u64
*
bno
,
u64
off
,
u64
*
plen
,
u64
*
bno
,
struct
ceph_osd_request
*
req
,
struct
ceph_osd_request
*
req
,
struct
ceph_osd_req_op
*
op
);
struct
ceph_osd_req_op
*
op
);
extern
struct
ceph_osd_request
*
ceph_osdc_alloc_request
(
struct
ceph_osd_client
*
osdc
,
extern
struct
ceph_osd_request
*
ceph_osdc_alloc_request
(
struct
ceph_osd_client
*
osdc
,
int
flags
,
struct
ceph_snap_context
*
snapc
,
struct
ceph_snap_context
*
snapc
,
struct
ceph_osd_req_op
*
ops
,
unsigned
int
num_op
,
bool
use_mempool
,
bool
use_mempool
,
gfp_t
gfp_flags
,
gfp_t
gfp_flags
);
struct
page
**
pages
,
struct
bio
*
bio
);
extern
void
ceph_osdc_build_request
(
struct
ceph_osd_request
*
req
,
extern
void
ceph_osdc_build_request
(
struct
ceph_osd_request
*
req
,
u64
off
,
u64
*
plen
,
u64
off
,
u64
len
,
unsigned
int
num_op
,
struct
ceph_osd_req_op
*
src_ops
,
struct
ceph_osd_req_op
*
src_ops
,
struct
ceph_snap_context
*
snapc
,
struct
ceph_snap_context
*
snapc
,
struct
timespec
*
mtime
,
u64
snap_id
,
const
char
*
oid
,
struct
timespec
*
mtime
);
int
oid_len
);
extern
struct
ceph_osd_request
*
ceph_osdc_new_request
(
struct
ceph_osd_client
*
,
extern
struct
ceph_osd_request
*
ceph_osdc_new_request
(
struct
ceph_osd_client
*
,
struct
ceph_file_layout
*
layout
,
struct
ceph_file_layout
*
layout
,
...
...
include/linux/ceph/osdmap.h
View file @
969e5aa3
...
@@ -110,7 +110,7 @@ extern void ceph_osdmap_destroy(struct ceph_osdmap *map);
...
@@ -110,7 +110,7 @@ extern void ceph_osdmap_destroy(struct ceph_osdmap *map);
/* calculate mapping of a file extent to an object */
/* calculate mapping of a file extent to an object */
extern
int
ceph_calc_file_object_mapping
(
struct
ceph_file_layout
*
layout
,
extern
int
ceph_calc_file_object_mapping
(
struct
ceph_file_layout
*
layout
,
u64
off
,
u64
*
p
len
,
u64
off
,
u64
len
,
u64
*
bno
,
u64
*
oxoff
,
u64
*
oxlen
);
u64
*
bno
,
u64
*
oxoff
,
u64
*
oxlen
);
/* calculate mapping of object to a placement group */
/* calculate mapping of object to a placement group */
...
...
include/linux/crush/crush.h
View file @
969e5aa3
...
@@ -162,6 +162,8 @@ struct crush_map {
...
@@ -162,6 +162,8 @@ struct crush_map {
__u32
choose_local_fallback_tries
;
__u32
choose_local_fallback_tries
;
/* choose attempts before giving up */
/* choose attempts before giving up */
__u32
choose_total_tries
;
__u32
choose_total_tries
;
/* attempt chooseleaf inner descent once; on failure retry outer descent */
__u32
chooseleaf_descend_once
;
};
};
...
...
net/ceph/crush/mapper.c
View file @
969e5aa3
...
@@ -287,6 +287,7 @@ static int is_out(const struct crush_map *map, const __u32 *weight, int item, in
...
@@ -287,6 +287,7 @@ static int is_out(const struct crush_map *map, const __u32 *weight, int item, in
* @outpos: our position in that vector
* @outpos: our position in that vector
* @firstn: true if choosing "first n" items, false if choosing "indep"
* @firstn: true if choosing "first n" items, false if choosing "indep"
* @recurse_to_leaf: true if we want one device under each item of given type
* @recurse_to_leaf: true if we want one device under each item of given type
* @descend_once: true if we should only try one descent before giving up
* @out2: second output vector for leaf items (if @recurse_to_leaf)
* @out2: second output vector for leaf items (if @recurse_to_leaf)
*/
*/
static
int
crush_choose
(
const
struct
crush_map
*
map
,
static
int
crush_choose
(
const
struct
crush_map
*
map
,
...
@@ -295,7 +296,7 @@ static int crush_choose(const struct crush_map *map,
...
@@ -295,7 +296,7 @@ static int crush_choose(const struct crush_map *map,
int
x
,
int
numrep
,
int
type
,
int
x
,
int
numrep
,
int
type
,
int
*
out
,
int
outpos
,
int
*
out
,
int
outpos
,
int
firstn
,
int
recurse_to_leaf
,
int
firstn
,
int
recurse_to_leaf
,
int
*
out2
)
int
descend_once
,
int
*
out2
)
{
{
int
rep
;
int
rep
;
unsigned
int
ftotal
,
flocal
;
unsigned
int
ftotal
,
flocal
;
...
@@ -391,7 +392,7 @@ static int crush_choose(const struct crush_map *map,
...
@@ -391,7 +392,7 @@ static int crush_choose(const struct crush_map *map,
}
}
reject
=
0
;
reject
=
0
;
if
(
recurse_to_leaf
)
{
if
(
!
collide
&&
recurse_to_leaf
)
{
if
(
item
<
0
)
{
if
(
item
<
0
)
{
if
(
crush_choose
(
map
,
if
(
crush_choose
(
map
,
map
->
buckets
[
-
1
-
item
],
map
->
buckets
[
-
1
-
item
],
...
@@ -399,6 +400,7 @@ static int crush_choose(const struct crush_map *map,
...
@@ -399,6 +400,7 @@ static int crush_choose(const struct crush_map *map,
x
,
outpos
+
1
,
0
,
x
,
outpos
+
1
,
0
,
out2
,
outpos
,
out2
,
outpos
,
firstn
,
0
,
firstn
,
0
,
map
->
chooseleaf_descend_once
,
NULL
)
<=
outpos
)
NULL
)
<=
outpos
)
/* didn't get leaf */
/* didn't get leaf */
reject
=
1
;
reject
=
1
;
...
@@ -422,7 +424,10 @@ static int crush_choose(const struct crush_map *map,
...
@@ -422,7 +424,10 @@ static int crush_choose(const struct crush_map *map,
ftotal
++
;
ftotal
++
;
flocal
++
;
flocal
++
;
if
(
collide
&&
flocal
<=
map
->
choose_local_tries
)
if
(
reject
&&
descend_once
)
/* let outer call try again */
skip_rep
=
1
;
else
if
(
collide
&&
flocal
<=
map
->
choose_local_tries
)
/* retry locally a few times */
/* retry locally a few times */
retry_bucket
=
1
;
retry_bucket
=
1
;
else
if
(
map
->
choose_local_fallback_tries
>
0
&&
else
if
(
map
->
choose_local_fallback_tries
>
0
&&
...
@@ -485,6 +490,7 @@ int crush_do_rule(const struct crush_map *map,
...
@@ -485,6 +490,7 @@ int crush_do_rule(const struct crush_map *map,
int
i
,
j
;
int
i
,
j
;
int
numrep
;
int
numrep
;
int
firstn
;
int
firstn
;
const
int
descend_once
=
0
;
if
((
__u32
)
ruleno
>=
map
->
max_rules
)
{
if
((
__u32
)
ruleno
>=
map
->
max_rules
)
{
dprintk
(
" bad ruleno %d
\n
"
,
ruleno
);
dprintk
(
" bad ruleno %d
\n
"
,
ruleno
);
...
@@ -544,7 +550,8 @@ int crush_do_rule(const struct crush_map *map,
...
@@ -544,7 +550,8 @@ int crush_do_rule(const struct crush_map *map,
curstep
->
arg2
,
curstep
->
arg2
,
o
+
osize
,
j
,
o
+
osize
,
j
,
firstn
,
firstn
,
recurse_to_leaf
,
c
+
osize
);
recurse_to_leaf
,
descend_once
,
c
+
osize
);
}
}
if
(
recurse_to_leaf
)
if
(
recurse_to_leaf
)
...
...
net/ceph/osd_client.c
View file @
969e5aa3
This diff is collapsed.
Click to expand it.
net/ceph/osdmap.c
View file @
969e5aa3
...
@@ -13,26 +13,18 @@
...
@@ -13,26 +13,18 @@
char
*
ceph_osdmap_state_str
(
char
*
str
,
int
len
,
int
state
)
char
*
ceph_osdmap_state_str
(
char
*
str
,
int
len
,
int
state
)
{
{
int
flag
=
0
;
if
(
!
len
)
if
(
!
len
)
goto
done
;
return
str
;
*
str
=
'\0'
;
if
((
state
&
CEPH_OSD_EXISTS
)
&&
(
state
&
CEPH_OSD_UP
))
if
(
state
)
{
snprintf
(
str
,
len
,
"exists, up"
);
if
(
state
&
CEPH_OSD_EXISTS
)
{
else
if
(
state
&
CEPH_OSD_EXISTS
)
snprintf
(
str
,
len
,
"exists"
);
snprintf
(
str
,
len
,
"exists"
);
flag
=
1
;
else
if
(
state
&
CEPH_OSD_UP
)
}
snprintf
(
str
,
len
,
"up"
);
if
(
state
&
CEPH_OSD_UP
)
{
else
snprintf
(
str
,
len
,
"%s%s%s"
,
str
,
(
flag
?
", "
:
""
),
"up"
);
flag
=
1
;
}
}
else
{
snprintf
(
str
,
len
,
"doesn't exist"
);
snprintf
(
str
,
len
,
"doesn't exist"
);
}
done:
return
str
;
return
str
;
}
}
...
@@ -170,6 +162,7 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
...
@@ -170,6 +162,7 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
c
->
choose_local_tries
=
2
;
c
->
choose_local_tries
=
2
;
c
->
choose_local_fallback_tries
=
5
;
c
->
choose_local_fallback_tries
=
5
;
c
->
choose_total_tries
=
19
;
c
->
choose_total_tries
=
19
;
c
->
chooseleaf_descend_once
=
0
;
ceph_decode_need
(
p
,
end
,
4
*
sizeof
(
u32
),
bad
);
ceph_decode_need
(
p
,
end
,
4
*
sizeof
(
u32
),
bad
);
magic
=
ceph_decode_32
(
p
);
magic
=
ceph_decode_32
(
p
);
...
@@ -336,6 +329,11 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
...
@@ -336,6 +329,11 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
dout
(
"crush decode tunable choose_total_tries = %d"
,
dout
(
"crush decode tunable choose_total_tries = %d"
,
c
->
choose_total_tries
);
c
->
choose_total_tries
);
ceph_decode_need
(
p
,
end
,
sizeof
(
u32
),
done
);
c
->
chooseleaf_descend_once
=
ceph_decode_32
(
p
);
dout
(
"crush decode tunable chooseleaf_descend_once = %d"
,
c
->
chooseleaf_descend_once
);
done:
done:
dout
(
"crush_decode success
\n
"
);
dout
(
"crush_decode success
\n
"
);
return
c
;
return
c
;
...
@@ -1010,7 +1008,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
...
@@ -1010,7 +1008,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
* pass a stride back to the caller.
* pass a stride back to the caller.
*/
*/
int
ceph_calc_file_object_mapping
(
struct
ceph_file_layout
*
layout
,
int
ceph_calc_file_object_mapping
(
struct
ceph_file_layout
*
layout
,
u64
off
,
u64
*
p
len
,
u64
off
,
u64
len
,
u64
*
ono
,
u64
*
ono
,
u64
*
oxoff
,
u64
*
oxlen
)
u64
*
oxoff
,
u64
*
oxlen
)
{
{
...
@@ -1021,7 +1019,7 @@ int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
...
@@ -1021,7 +1019,7 @@ int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
u32
su_per_object
;
u32
su_per_object
;
u64
t
,
su_offset
;
u64
t
,
su_offset
;
dout
(
"mapping %llu~%llu osize %u fl_su %u
\n
"
,
off
,
*
p
len
,
dout
(
"mapping %llu~%llu osize %u fl_su %u
\n
"
,
off
,
len
,
osize
,
su
);
osize
,
su
);
if
(
su
==
0
||
sc
==
0
)
if
(
su
==
0
||
sc
==
0
)
goto
invalid
;
goto
invalid
;
...
@@ -1054,11 +1052,10 @@ int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
...
@@ -1054,11 +1052,10 @@ int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
/*
/*
* Calculate the length of the extent being written to the selected
* Calculate the length of the extent being written to the selected
* object. This is the minimum of the full length requested (
p
len) or
* object. This is the minimum of the full length requested (len) or
* the remainder of the current stripe being written to.
* the remainder of the current stripe being written to.
*/
*/
*
oxlen
=
min_t
(
u64
,
*
plen
,
su
-
su_offset
);
*
oxlen
=
min_t
(
u64
,
len
,
su
-
su_offset
);
*
plen
=
*
oxlen
;
dout
(
" obj extent %llu~%llu
\n
"
,
*
oxoff
,
*
oxlen
);
dout
(
" obj extent %llu~%llu
\n
"
,
*
oxoff
,
*
oxlen
);
return
0
;
return
0
;
...
...
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