Re: Can read and write on the same connection at the same time?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 13 Oct 2011,  wrote:
> kclient will establish only one connection with each osdÿÿbut there is
> a mutex in the ceph_connection.
> 
> partial code about con_work
> 
> static void con_work(struct work_struct *work)
> {
> struct ceph_connection *con = container_of(work, struct ceph_connection,
>   work.work);
> mutex_lock(&con->mutex);
> ÿÿÿÿ
>       if (test_and_clear_bit(SOCK_CLOSED, &con->state) ||
>    try_read(con) < 0 ||
>    try_write(con) < 0) {
> mutex_unlock(&con->mutex);
> bsdocfs_fault(con);     /* error/fault path */
> goto done_unlocked;
> }
> ÿÿÿÿ
> }
> 
> if kclient read data from osdNÿÿcan kclient write data to osdN at the 
> same timeÿÿ

Yes.  The messenger code wakes up whenever there is new data queued to 
send, or new data available on the socket.  We only ever read or write as 
much data as we can without emptying or filling the socket buffer at a 
time.  We never block on network IO, so the mutex is only ever held for 
very short periods.  The model is asynchronous message passing.  We have a 
queue of outgoing messages that we send as quickly as the socket will 
accept them, and when a complete incoming message is read we process it.

sage

[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux