From: juncheng b. <bai...@un...> - 2015-06-02 10:29:36
|
Hi, All. I plan to implement asynchronous write in the cache mode, The biggest difficulty is friendly backward compatibility. I don't want to define a series of new interfaces, this is a bad way which there are a lot of duplicate code. 1. The existing process for write(the read is same), the v9fs call function p9_client_write provided by the module 9pnet, p9_client_write calls c->trans_mod->zc_request or c->trans_mod->request provided by the module 9pnet_rdma or 9pnet_virtio, see the define of p9_trans_module, static struct p9_trans_module p9_virtio_trans = { ...... .request = p9_virtio_request, .zc_request = p9_virtio_zc_request, ...... }; In the request or zc_request, wait for the response, and read the return value. 2. Design To implement async-write, the request function of 9pnet_virtio and 9pnet_rdma need check request class, if the request is async, don't wait When get the response, the function req_done or cq_event_handler call the callback function to process the return value. 3. Implement 1).Create a workqueue to process async respone for each mount instance. The workqueue can re-dispatch the write request if don't finish the whole writing. Release resource of the request, reset flag of struct page if finish the whole writing. 2).The response information and request data is passed to the work queue in the function req_done or cq_event_handler 3).Define data structure to save the request information and return information or called async-context struct v9fs_async_header { struct p9_fid *fid; /* writeback fid */ struct page *page; /* writing page */ char *data; /* get from kmap */ u64 offset; /* get from page_offset */ u32 count; /* the total need to write */ u32 written; /* have written the amount of data */ v9fs_write_completion write_done; p9net_response_process process_respone; }; 4).We need limit the number of async requests number Written above is my rough idea. Look forward to comments and opinions. --- juncheng bai |