Re: [Nbd] [NBD]Kernel space and User-space
- To: harryxiyou <harryxiyou@...17...>
- Cc: nbd-general@lists.sourceforge.net
- Subject: Re: [Nbd] [NBD]Kernel space and User-space
- From: Paul Clements <paul.clements@...856...>
- Date: Tue, 14 Feb 2012 15:51:14 -0500
- Message-id: <CAECXXi7sO=-6OfutBxNyTz2+j4nsMEXDW0_gTCaWPsZwi2_iVw@...18...>
- In-reply-to: <CAD+1EGN=1FW=O2CvqiO0-ARBf7t6G16VkM+mYwqxGX6Gt+wswQ@...18...>
- References: <CAD+1EGN=1FW=O2CvqiO0-ARBf7t6G16VkM+mYwqxGX6Gt+wswQ@...18...>
On Tue, Feb 14, 2012 at 1:48 PM, harryxiyou <harryxiyou@...17...> wrote:
> 1, Nbd kernel space just establishes device node like /dev/nbd*. And it also has
> drivers for nbd. It is related to nbd-client. But i am not sure
> the interactions
> between nbd kernel space and nbd-client. Right?
Look at the nbd-client code and you'll see. It basically sets up the
connection with the server and does the initial negotation/handshake
and then performs a number of ioctls to set up the kernel nbd device,
which it then starts with a call to NBD_DO_IT. NBD_DO_IT is an unusual
ioctl in that it lasts for the life of the device. This allows the
client to go into a loop receiving replies back from the server.
Meanwhile, the nbd device, once started, handles I/O requests (read
and writes, usually coming from a filesystem) and forwards the
requests to the server over the socket (which was established in
userspace). The server sends replies back for each I/O and the
nbd-client (now in the kernel, running NBD_DO_IT) receives them.
--
Paul
Reply to: