Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __FS_CEPH_MESSENGER_H
0003 #define __FS_CEPH_MESSENGER_H
0004 
0005 #include <linux/bvec.h>
0006 #include <linux/crypto.h>
0007 #include <linux/kref.h>
0008 #include <linux/mutex.h>
0009 #include <linux/net.h>
0010 #include <linux/radix-tree.h>
0011 #include <linux/uio.h>
0012 #include <linux/workqueue.h>
0013 #include <net/net_namespace.h>
0014 
0015 #include <linux/ceph/types.h>
0016 #include <linux/ceph/buffer.h>
0017 
0018 struct ceph_msg;
0019 struct ceph_connection;
0020 
0021 /*
0022  * Ceph defines these callbacks for handling connection events.
0023  */
0024 struct ceph_connection_operations {
0025     struct ceph_connection *(*get)(struct ceph_connection *);
0026     void (*put)(struct ceph_connection *);
0027 
0028     /* handle an incoming message. */
0029     void (*dispatch) (struct ceph_connection *con, struct ceph_msg *m);
0030 
0031     /* authorize an outgoing connection */
0032     struct ceph_auth_handshake *(*get_authorizer) (
0033                 struct ceph_connection *con,
0034                    int *proto, int force_new);
0035     int (*add_authorizer_challenge)(struct ceph_connection *con,
0036                     void *challenge_buf,
0037                     int challenge_buf_len);
0038     int (*verify_authorizer_reply) (struct ceph_connection *con);
0039     int (*invalidate_authorizer)(struct ceph_connection *con);
0040 
0041     /* there was some error on the socket (disconnect, whatever) */
0042     void (*fault) (struct ceph_connection *con);
0043 
0044     /* a remote host as terminated a message exchange session, and messages
0045      * we sent (or they tried to send us) may be lost. */
0046     void (*peer_reset) (struct ceph_connection *con);
0047 
0048     struct ceph_msg * (*alloc_msg) (struct ceph_connection *con,
0049                     struct ceph_msg_header *hdr,
0050                     int *skip);
0051 
0052     void (*reencode_message) (struct ceph_msg *msg);
0053 
0054     int (*sign_message) (struct ceph_msg *msg);
0055     int (*check_message_signature) (struct ceph_msg *msg);
0056 
0057     /* msgr2 authentication exchange */
0058     int (*get_auth_request)(struct ceph_connection *con,
0059                 void *buf, int *buf_len,
0060                 void **authorizer, int *authorizer_len);
0061     int (*handle_auth_reply_more)(struct ceph_connection *con,
0062                       void *reply, int reply_len,
0063                       void *buf, int *buf_len,
0064                       void **authorizer, int *authorizer_len);
0065     int (*handle_auth_done)(struct ceph_connection *con,
0066                 u64 global_id, void *reply, int reply_len,
0067                 u8 *session_key, int *session_key_len,
0068                 u8 *con_secret, int *con_secret_len);
0069     int (*handle_auth_bad_method)(struct ceph_connection *con,
0070                       int used_proto, int result,
0071                       const int *allowed_protos, int proto_cnt,
0072                       const int *allowed_modes, int mode_cnt);
0073 };
0074 
0075 /* use format string %s%lld */
0076 #define ENTITY_NAME(n) ceph_entity_type_name((n).type), le64_to_cpu((n).num)
0077 
0078 struct ceph_messenger {
0079     struct ceph_entity_inst inst;    /* my name+address */
0080     struct ceph_entity_addr my_enc_addr;
0081 
0082     atomic_t stopping;
0083     possible_net_t net;
0084 
0085     /*
0086      * the global_seq counts connections i (attempt to) initiate
0087      * in order to disambiguate certain connect race conditions.
0088      */
0089     u32 global_seq;
0090     spinlock_t global_seq_lock;
0091 };
0092 
0093 enum ceph_msg_data_type {
0094     CEPH_MSG_DATA_NONE, /* message contains no data payload */
0095     CEPH_MSG_DATA_PAGES,    /* data source/destination is a page array */
0096     CEPH_MSG_DATA_PAGELIST, /* data source/destination is a pagelist */
0097 #ifdef CONFIG_BLOCK
0098     CEPH_MSG_DATA_BIO,  /* data source/destination is a bio list */
0099 #endif /* CONFIG_BLOCK */
0100     CEPH_MSG_DATA_BVECS,    /* data source/destination is a bio_vec array */
0101 };
0102 
0103 #ifdef CONFIG_BLOCK
0104 
0105 struct ceph_bio_iter {
0106     struct bio *bio;
0107     struct bvec_iter iter;
0108 };
0109 
0110 #define __ceph_bio_iter_advance_step(it, n, STEP) do {                \
0111     unsigned int __n = (n), __cur_n;                      \
0112                                           \
0113     while (__n) {                                 \
0114         BUG_ON(!(it)->iter.bi_size);                      \
0115         __cur_n = min((it)->iter.bi_size, __n);               \
0116         (void)(STEP);                             \
0117         bio_advance_iter((it)->bio, &(it)->iter, __cur_n);        \
0118         if (!(it)->iter.bi_size && (it)->bio->bi_next) {          \
0119             dout("__ceph_bio_iter_advance_step next bio\n");      \
0120             (it)->bio = (it)->bio->bi_next;               \
0121             (it)->iter = (it)->bio->bi_iter;              \
0122         }                                 \
0123         __n -= __cur_n;                           \
0124     }                                     \
0125 } while (0)
0126 
0127 /*
0128  * Advance @it by @n bytes.
0129  */
0130 #define ceph_bio_iter_advance(it, n)                          \
0131     __ceph_bio_iter_advance_step(it, n, 0)
0132 
0133 /*
0134  * Advance @it by @n bytes, executing BVEC_STEP for each bio_vec.
0135  */
0136 #define ceph_bio_iter_advance_step(it, n, BVEC_STEP)                  \
0137     __ceph_bio_iter_advance_step(it, n, ({                    \
0138         struct bio_vec bv;                        \
0139         struct bvec_iter __cur_iter;                      \
0140                                           \
0141         __cur_iter = (it)->iter;                      \
0142         __cur_iter.bi_size = __cur_n;                     \
0143         __bio_for_each_segment(bv, (it)->bio, __cur_iter, __cur_iter) \
0144             (void)(BVEC_STEP);                    \
0145     }))
0146 
0147 #endif /* CONFIG_BLOCK */
0148 
0149 struct ceph_bvec_iter {
0150     struct bio_vec *bvecs;
0151     struct bvec_iter iter;
0152 };
0153 
0154 #define __ceph_bvec_iter_advance_step(it, n, STEP) do {               \
0155     BUG_ON((n) > (it)->iter.bi_size);                     \
0156     (void)(STEP);                                 \
0157     bvec_iter_advance((it)->bvecs, &(it)->iter, (n));             \
0158 } while (0)
0159 
0160 /*
0161  * Advance @it by @n bytes.
0162  */
0163 #define ceph_bvec_iter_advance(it, n)                         \
0164     __ceph_bvec_iter_advance_step(it, n, 0)
0165 
0166 /*
0167  * Advance @it by @n bytes, executing BVEC_STEP for each bio_vec.
0168  */
0169 #define ceph_bvec_iter_advance_step(it, n, BVEC_STEP)                 \
0170     __ceph_bvec_iter_advance_step(it, n, ({                   \
0171         struct bio_vec bv;                        \
0172         struct bvec_iter __cur_iter;                      \
0173                                           \
0174         __cur_iter = (it)->iter;                      \
0175         __cur_iter.bi_size = (n);                     \
0176         for_each_bvec(bv, (it)->bvecs, __cur_iter, __cur_iter)        \
0177             (void)(BVEC_STEP);                    \
0178     }))
0179 
0180 #define ceph_bvec_iter_shorten(it, n) do {                    \
0181     BUG_ON((n) > (it)->iter.bi_size);                     \
0182     (it)->iter.bi_size = (n);                         \
0183 } while (0)
0184 
0185 struct ceph_msg_data {
0186     enum ceph_msg_data_type     type;
0187     union {
0188 #ifdef CONFIG_BLOCK
0189         struct {
0190             struct ceph_bio_iter    bio_pos;
0191             u32         bio_length;
0192         };
0193 #endif /* CONFIG_BLOCK */
0194         struct ceph_bvec_iter   bvec_pos;
0195         struct {
0196             struct page **pages;
0197             size_t      length;     /* total # bytes */
0198             unsigned int    alignment;  /* first page */
0199             bool        own_pages;
0200         };
0201         struct ceph_pagelist    *pagelist;
0202     };
0203 };
0204 
0205 struct ceph_msg_data_cursor {
0206     size_t          total_resid;    /* across all data items */
0207 
0208     struct ceph_msg_data    *data;      /* current data item */
0209     size_t          resid;      /* bytes not yet consumed */
0210     bool            last_piece; /* current is last piece */
0211     bool            need_crc;   /* crc update needed */
0212     union {
0213 #ifdef CONFIG_BLOCK
0214         struct ceph_bio_iter    bio_iter;
0215 #endif /* CONFIG_BLOCK */
0216         struct bvec_iter    bvec_iter;
0217         struct {                /* pages */
0218             unsigned int    page_offset;    /* offset in page */
0219             unsigned short  page_index; /* index in array */
0220             unsigned short  page_count; /* pages in array */
0221         };
0222         struct {                /* pagelist */
0223             struct page *page;      /* page from list */
0224             size_t      offset;     /* bytes from list */
0225         };
0226     };
0227 };
0228 
0229 /*
0230  * a single message.  it contains a header (src, dest, message type, etc.),
0231  * footer (crc values, mainly), a "front" message body, and possibly a
0232  * data payload (stored in some number of pages).
0233  */
0234 struct ceph_msg {
0235     struct ceph_msg_header hdr; /* header */
0236     union {
0237         struct ceph_msg_footer footer;      /* footer */
0238         struct ceph_msg_footer_old old_footer;  /* old format footer */
0239     };
0240     struct kvec front;              /* unaligned blobs of message */
0241     struct ceph_buffer *middle;
0242 
0243     size_t              data_length;
0244     struct ceph_msg_data        *data;
0245     int             num_data_items;
0246     int             max_data_items;
0247     struct ceph_msg_data_cursor cursor;
0248 
0249     struct ceph_connection *con;
0250     struct list_head list_head; /* links for connection lists */
0251 
0252     struct kref kref;
0253     bool more_to_follow;
0254     bool needs_out_seq;
0255     int front_alloc_len;
0256 
0257     struct ceph_msgpool *pool;
0258 };
0259 
0260 /*
0261  * connection states
0262  */
0263 #define CEPH_CON_S_CLOSED       1
0264 #define CEPH_CON_S_PREOPEN      2
0265 #define CEPH_CON_S_V1_BANNER        3
0266 #define CEPH_CON_S_V1_CONNECT_MSG   4
0267 #define CEPH_CON_S_V2_BANNER_PREFIX 5
0268 #define CEPH_CON_S_V2_BANNER_PAYLOAD    6
0269 #define CEPH_CON_S_V2_HELLO     7
0270 #define CEPH_CON_S_V2_AUTH      8
0271 #define CEPH_CON_S_V2_AUTH_SIGNATURE    9
0272 #define CEPH_CON_S_V2_SESSION_CONNECT   10
0273 #define CEPH_CON_S_V2_SESSION_RECONNECT 11
0274 #define CEPH_CON_S_OPEN         12
0275 #define CEPH_CON_S_STANDBY      13
0276 
0277 /*
0278  * ceph_connection flag bits
0279  */
0280 #define CEPH_CON_F_LOSSYTX      0  /* we can close channel or drop
0281                           messages on errors */
0282 #define CEPH_CON_F_KEEPALIVE_PENDING    1  /* we need to send a keepalive */
0283 #define CEPH_CON_F_WRITE_PENDING    2  /* we have data ready to send */
0284 #define CEPH_CON_F_SOCK_CLOSED      3  /* socket state changed to closed */
0285 #define CEPH_CON_F_BACKOFF      4  /* need to retry queuing delayed
0286                           work */
0287 
0288 /* ceph connection fault delay defaults, for exponential backoff */
0289 #define BASE_DELAY_INTERVAL (HZ / 4)
0290 #define MAX_DELAY_INTERVAL  (15 * HZ)
0291 
0292 struct ceph_connection_v1_info {
0293     struct kvec out_kvec[8],         /* sending header/footer data */
0294         *out_kvec_cur;
0295     int out_kvec_left;   /* kvec's left in out_kvec */
0296     int out_skip;        /* skip this many bytes */
0297     int out_kvec_bytes;  /* total bytes left */
0298     bool out_more;       /* there is more data after the kvecs */
0299     bool out_msg_done;
0300 
0301     struct ceph_auth_handshake *auth;
0302     int auth_retry;       /* true if we need a newer authorizer */
0303 
0304     /* connection negotiation temps */
0305     u8 in_banner[CEPH_BANNER_MAX_LEN];
0306     struct ceph_entity_addr actual_peer_addr;
0307     struct ceph_entity_addr peer_addr_for_me;
0308     struct ceph_msg_connect out_connect;
0309     struct ceph_msg_connect_reply in_reply;
0310 
0311     int in_base_pos;     /* bytes read */
0312 
0313     /* message in temps */
0314     u8 in_tag;           /* protocol control byte */
0315     struct ceph_msg_header in_hdr;
0316     __le64 in_temp_ack;  /* for reading an ack */
0317 
0318     /* message out temps */
0319     struct ceph_msg_header out_hdr;
0320     __le64 out_temp_ack;  /* for writing an ack */
0321     struct ceph_timespec out_temp_keepalive2;  /* for writing keepalive2
0322                               stamp */
0323 
0324     u32 connect_seq;      /* identify the most recent connection
0325                  attempt for this session */
0326     u32 peer_global_seq;  /* peer's global seq for this connection */
0327 };
0328 
0329 #define CEPH_CRC_LEN            4
0330 #define CEPH_GCM_KEY_LEN        16
0331 #define CEPH_GCM_IV_LEN         sizeof(struct ceph_gcm_nonce)
0332 #define CEPH_GCM_BLOCK_LEN      16
0333 #define CEPH_GCM_TAG_LEN        16
0334 
0335 #define CEPH_PREAMBLE_LEN       32
0336 #define CEPH_PREAMBLE_INLINE_LEN    48
0337 #define CEPH_PREAMBLE_PLAIN_LEN     CEPH_PREAMBLE_LEN
0338 #define CEPH_PREAMBLE_SECURE_LEN    (CEPH_PREAMBLE_LEN +        \
0339                      CEPH_PREAMBLE_INLINE_LEN + \
0340                      CEPH_GCM_TAG_LEN)
0341 #define CEPH_EPILOGUE_PLAIN_LEN     (1 + 3 * CEPH_CRC_LEN)
0342 #define CEPH_EPILOGUE_SECURE_LEN    (CEPH_GCM_BLOCK_LEN + CEPH_GCM_TAG_LEN)
0343 
0344 #define CEPH_FRAME_MAX_SEGMENT_COUNT    4
0345 
0346 struct ceph_frame_desc {
0347     int fd_tag;  /* FRAME_TAG_* */
0348     int fd_seg_cnt;
0349     int fd_lens[CEPH_FRAME_MAX_SEGMENT_COUNT];  /* logical */
0350     int fd_aligns[CEPH_FRAME_MAX_SEGMENT_COUNT];
0351 };
0352 
0353 struct ceph_gcm_nonce {
0354     __le32 fixed;
0355     __le64 counter __packed;
0356 };
0357 
0358 struct ceph_connection_v2_info {
0359     struct iov_iter in_iter;
0360     struct kvec in_kvecs[5];  /* recvmsg */
0361     struct bio_vec in_bvec;  /* recvmsg (in_cursor) */
0362     int in_kvec_cnt;
0363     int in_state;  /* IN_S_* */
0364 
0365     struct iov_iter out_iter;
0366     struct kvec out_kvecs[8];  /* sendmsg */
0367     struct bio_vec out_bvec;  /* sendpage (out_cursor, out_zero),
0368                      sendmsg (out_enc_pages) */
0369     int out_kvec_cnt;
0370     int out_state;  /* OUT_S_* */
0371 
0372     int out_zero;  /* # of zero bytes to send */
0373     bool out_iter_sendpage;  /* use sendpage if possible */
0374 
0375     struct ceph_frame_desc in_desc;
0376     struct ceph_msg_data_cursor in_cursor;
0377     struct ceph_msg_data_cursor out_cursor;
0378 
0379     struct crypto_shash *hmac_tfm;  /* post-auth signature */
0380     struct crypto_aead *gcm_tfm;  /* on-wire encryption */
0381     struct aead_request *gcm_req;
0382     struct crypto_wait gcm_wait;
0383     struct ceph_gcm_nonce in_gcm_nonce;
0384     struct ceph_gcm_nonce out_gcm_nonce;
0385 
0386     struct page **in_enc_pages;
0387     int in_enc_page_cnt;
0388     int in_enc_resid;
0389     int in_enc_i;
0390     struct page **out_enc_pages;
0391     int out_enc_page_cnt;
0392     int out_enc_resid;
0393     int out_enc_i;
0394 
0395     int con_mode;  /* CEPH_CON_MODE_* */
0396 
0397     void *conn_bufs[16];
0398     int conn_buf_cnt;
0399 
0400     struct kvec in_sign_kvecs[8];
0401     struct kvec out_sign_kvecs[8];
0402     int in_sign_kvec_cnt;
0403     int out_sign_kvec_cnt;
0404 
0405     u64 client_cookie;
0406     u64 server_cookie;
0407     u64 global_seq;
0408     u64 connect_seq;
0409     u64 peer_global_seq;
0410 
0411     u8 in_buf[CEPH_PREAMBLE_SECURE_LEN];
0412     u8 out_buf[CEPH_PREAMBLE_SECURE_LEN];
0413     struct {
0414         u8 late_status;  /* FRAME_LATE_STATUS_* */
0415         union {
0416             struct {
0417                 u32 front_crc;
0418                 u32 middle_crc;
0419                 u32 data_crc;
0420             } __packed;
0421             u8 pad[CEPH_GCM_BLOCK_LEN - 1];
0422         };
0423     } out_epil;
0424 };
0425 
0426 /*
0427  * A single connection with another host.
0428  *
0429  * We maintain a queue of outgoing messages, and some session state to
0430  * ensure that we can preserve the lossless, ordered delivery of
0431  * messages in the case of a TCP disconnect.
0432  */
0433 struct ceph_connection {
0434     void *private;
0435 
0436     const struct ceph_connection_operations *ops;
0437 
0438     struct ceph_messenger *msgr;
0439 
0440     int state;  /* CEPH_CON_S_* */
0441     atomic_t sock_state;
0442     struct socket *sock;
0443 
0444     unsigned long flags;  /* CEPH_CON_F_* */
0445     const char *error_msg;  /* error message, if any */
0446 
0447     struct ceph_entity_name peer_name; /* peer name */
0448     struct ceph_entity_addr peer_addr; /* peer address */
0449     u64 peer_features;
0450 
0451     struct mutex mutex;
0452 
0453     /* out queue */
0454     struct list_head out_queue;
0455     struct list_head out_sent;   /* sending or sent but unacked */
0456     u64 out_seq;             /* last message queued for send */
0457 
0458     u64 in_seq, in_seq_acked;  /* last message received, acked */
0459 
0460     struct ceph_msg *in_msg;
0461     struct ceph_msg *out_msg;        /* sending message (== tail of
0462                         out_sent) */
0463 
0464     struct page *bounce_page;
0465     u32 in_front_crc, in_middle_crc, in_data_crc;  /* calculated crc */
0466 
0467     struct timespec64 last_keepalive_ack; /* keepalive2 ack stamp */
0468 
0469     struct delayed_work work;       /* send|recv work */
0470     unsigned long       delay;          /* current delay interval */
0471 
0472     union {
0473         struct ceph_connection_v1_info v1;
0474         struct ceph_connection_v2_info v2;
0475     };
0476 };
0477 
0478 extern struct page *ceph_zero_page;
0479 
0480 void ceph_con_flag_clear(struct ceph_connection *con, unsigned long con_flag);
0481 void ceph_con_flag_set(struct ceph_connection *con, unsigned long con_flag);
0482 bool ceph_con_flag_test(struct ceph_connection *con, unsigned long con_flag);
0483 bool ceph_con_flag_test_and_clear(struct ceph_connection *con,
0484                   unsigned long con_flag);
0485 bool ceph_con_flag_test_and_set(struct ceph_connection *con,
0486                 unsigned long con_flag);
0487 
0488 void ceph_encode_my_addr(struct ceph_messenger *msgr);
0489 
0490 int ceph_tcp_connect(struct ceph_connection *con);
0491 int ceph_con_close_socket(struct ceph_connection *con);
0492 void ceph_con_reset_session(struct ceph_connection *con);
0493 
0494 u32 ceph_get_global_seq(struct ceph_messenger *msgr, u32 gt);
0495 void ceph_con_discard_sent(struct ceph_connection *con, u64 ack_seq);
0496 void ceph_con_discard_requeued(struct ceph_connection *con, u64 reconnect_seq);
0497 
0498 void ceph_msg_data_cursor_init(struct ceph_msg_data_cursor *cursor,
0499                    struct ceph_msg *msg, size_t length);
0500 struct page *ceph_msg_data_next(struct ceph_msg_data_cursor *cursor,
0501                 size_t *page_offset, size_t *length,
0502                 bool *last_piece);
0503 void ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor, size_t bytes);
0504 
0505 u32 ceph_crc32c_page(u32 crc, struct page *page, unsigned int page_offset,
0506              unsigned int length);
0507 
0508 bool ceph_addr_is_blank(const struct ceph_entity_addr *addr);
0509 int ceph_addr_port(const struct ceph_entity_addr *addr);
0510 void ceph_addr_set_port(struct ceph_entity_addr *addr, int p);
0511 
0512 void ceph_con_process_message(struct ceph_connection *con);
0513 int ceph_con_in_msg_alloc(struct ceph_connection *con,
0514               struct ceph_msg_header *hdr, int *skip);
0515 void ceph_con_get_out_msg(struct ceph_connection *con);
0516 
0517 /* messenger_v1.c */
0518 int ceph_con_v1_try_read(struct ceph_connection *con);
0519 int ceph_con_v1_try_write(struct ceph_connection *con);
0520 void ceph_con_v1_revoke(struct ceph_connection *con);
0521 void ceph_con_v1_revoke_incoming(struct ceph_connection *con);
0522 bool ceph_con_v1_opened(struct ceph_connection *con);
0523 void ceph_con_v1_reset_session(struct ceph_connection *con);
0524 void ceph_con_v1_reset_protocol(struct ceph_connection *con);
0525 
0526 /* messenger_v2.c */
0527 int ceph_con_v2_try_read(struct ceph_connection *con);
0528 int ceph_con_v2_try_write(struct ceph_connection *con);
0529 void ceph_con_v2_revoke(struct ceph_connection *con);
0530 void ceph_con_v2_revoke_incoming(struct ceph_connection *con);
0531 bool ceph_con_v2_opened(struct ceph_connection *con);
0532 void ceph_con_v2_reset_session(struct ceph_connection *con);
0533 void ceph_con_v2_reset_protocol(struct ceph_connection *con);
0534 
0535 
0536 extern const char *ceph_pr_addr(const struct ceph_entity_addr *addr);
0537 
0538 extern int ceph_parse_ips(const char *c, const char *end,
0539               struct ceph_entity_addr *addr,
0540               int max_count, int *count, char delim);
0541 
0542 extern int ceph_msgr_init(void);
0543 extern void ceph_msgr_exit(void);
0544 extern void ceph_msgr_flush(void);
0545 
0546 extern void ceph_messenger_init(struct ceph_messenger *msgr,
0547                 struct ceph_entity_addr *myaddr);
0548 extern void ceph_messenger_fini(struct ceph_messenger *msgr);
0549 extern void ceph_messenger_reset_nonce(struct ceph_messenger *msgr);
0550 
0551 extern void ceph_con_init(struct ceph_connection *con, void *private,
0552             const struct ceph_connection_operations *ops,
0553             struct ceph_messenger *msgr);
0554 extern void ceph_con_open(struct ceph_connection *con,
0555               __u8 entity_type, __u64 entity_num,
0556               struct ceph_entity_addr *addr);
0557 extern bool ceph_con_opened(struct ceph_connection *con);
0558 extern void ceph_con_close(struct ceph_connection *con);
0559 extern void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg);
0560 
0561 extern void ceph_msg_revoke(struct ceph_msg *msg);
0562 extern void ceph_msg_revoke_incoming(struct ceph_msg *msg);
0563 
0564 extern void ceph_con_keepalive(struct ceph_connection *con);
0565 extern bool ceph_con_keepalive_expired(struct ceph_connection *con,
0566                        unsigned long interval);
0567 
0568 void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
0569                  size_t length, size_t alignment, bool own_pages);
0570 extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg,
0571                 struct ceph_pagelist *pagelist);
0572 #ifdef CONFIG_BLOCK
0573 void ceph_msg_data_add_bio(struct ceph_msg *msg, struct ceph_bio_iter *bio_pos,
0574                u32 length);
0575 #endif /* CONFIG_BLOCK */
0576 void ceph_msg_data_add_bvecs(struct ceph_msg *msg,
0577                  struct ceph_bvec_iter *bvec_pos);
0578 
0579 struct ceph_msg *ceph_msg_new2(int type, int front_len, int max_data_items,
0580                    gfp_t flags, bool can_fail);
0581 extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
0582                      bool can_fail);
0583 
0584 extern struct ceph_msg *ceph_msg_get(struct ceph_msg *msg);
0585 extern void ceph_msg_put(struct ceph_msg *msg);
0586 
0587 extern void ceph_msg_dump(struct ceph_msg *msg);
0588 
0589 #endif