1、主OSD讀處理流程session
OSD::ms_fast_dispatch()函數
|__OSD::dispatch_session_waiting()spa
|__OSD::dispatch_op_fast()對象
|__OSD::handle_op()隊列
|__OSD::get_pg_or_queue_for_pg() 找到OpRequest中對應的PG和Pool信息get
|__OSD::enqueue_op()it
|__PG::queue_op()io
|__OSD::ShardedThreadPool::ShardedWQ::queue() 將PG和Op一塊兒放入隊列中ast
OSD::ShardedOpWQ::_process() 負責處理OSD::ShardedThreadPool::ShardedWQ隊列中的Opcli
|__PGQueueable::RunVis::operator()(const OpRequestRef &op)
|__OSD::dequeue_op()
|__ReplicatedPG::do_request()
|__檢查當前PG是否處於flush或peering狀態,如果則將op放入waiting_for_peered隊列中等待PG變成可用狀態
|__檢查當前PG是否處於Active狀態,若不是則將op放入waiting_for_active隊列中
|__檢查當前PG是否處於REPLAY狀態,如果則將op放入waiting_for_active隊列中
|__ReplicatedPG::do_op()
|__RepliatedPG::do_pg_op() 對於請求中包含對PG的操做CEPH_OSD_RMW_FLAG_PGOP
|__根據op請求建立hobject_t類對象(head)
|__檢查對象名字長度/對象locator key長度/對象locator名稱空間長度是否大於osd_max_object_name_len
|__經過FileStore檢查object的head是否有效
|__檢查op請求地址是否在OSDMap的blacklist中
|__對於寫請求,檢查寫請求的數據大小是否大於osd_max_write_size值
|__對於op請求的head目前不可讀,則將op放入waiting_for_unreadable_object隊列中且調用maybe_kick_recovery()函數嘗試啓動recovery
|__ReplicatedPG::is_degraded_or_backfilling_object() 檢查當前op請求的head是否處於recovery或backfill狀態
|__ReplicatedPG::wait_for_degraded_object() 將當前op請求的head放入waiting_for_degraded_object隊列中
|__檢查head是否在objects_blocked_on_degraded_snap隊列中,如果則將當前op請求的head放入waiting_for_degraded_object隊列中
|__檢查head是否在objects_blocked_on_snap_promotion隊列中,如果則將當前op請求的head放入waiting_for_blocked_object隊列中
|__檢查head是否在objects_blocked_on_cache_full隊列中,如果則將當前op請求的head放入waiting_for_cache_not_full隊列中
|__檢查head的snapdir是否不可讀,如果則將head的snapdir放入waiting_for_unreadable_object隊列中且調用maybe_kick_recovery()函數嘗試啓動recovery
|__檢查head的snapdir是否處於recovery或backfill狀態,如果則將head的snapdir放入waiting_for_degraded_object隊列中
|__對於op寫請求已經在PGLog中,則若已經完成了寫操做則直接給客戶端返回MOSDOpReply消息且設置CEPH_OSD_FLAG_ACK,不然將op放入到waiting_for_ack或waiting_for_ondisk隊列中
|__ReplicatedPG::find_object_context() 獲得object context信息
|__檢查object context是否處於io blocked狀態,如果則將op請求放入到waiting_for_blocked_object或waiting_for_degraded_object隊列中
|__ReplicatedPG::execute_ctx()
|__ReplicatedPG::prepare_transaction()
|__建立MOSDOpReply消息實例
|__調用ReplicatePG::complete_read_ctx() 將讀操做的結果返回給client端