2013-10-24 39 views
0

如何在塊設備驅動程序中禁用此功能? 我的意思是:正如在下面的文檔中提到的,我想將該「標誌」的值設置爲2.我該怎麼做?最好在塊設備驅動程序代碼中。如何禁用塊設備驅動程序中的請求合併?

What:  /sys/block/<disk>/queue/nomerges 
Date:  January 2010 
Contact: 
Description: 
     Standard I/O elevator operations include attempts to 
     merge contiguous I/Os. For known random I/O loads these 
     attempts will always fail and result in extra cycles 
     being spent in the kernel. This allows one to turn off 
     this behavior on one of two ways: When set to 1, complex 
     merge checks are disabled, but the simple one-shot merges 
     with the previous I/O request are enabled. When set to 2, 
     all merge tries are disabled. The default value is 0 - 
     which enables all types of merge tries. 
+1

搜索內核樹QUEUE_FLAG_NOMERGES。當它設置爲2時,sysfs將在請求隊列中設置此標誌。 –

+0

爲什麼要禁用它?如果您的驅動程序在合併的請求中無法正常工作,則它已損壞。 –

+0

是的,我知道它已經壞了。我正在修復它。這就是爲什麼我想禁用請求合併。我懷疑網絡延遲與它有關。 – hebbo

回答

2

首先檢查nomerges值 -

   `cat /sys/block/sda/queue/nomerges` 

,如果它不是已經2,然後執行:

   `echo 2 > /sys/block/sda/queue/nomerges` 
+0

我試過了,實際上我可以看到值改爲2.但是,我仍然可以看到每個請求超過4KB。我有什麼理由看到這種行爲? – hebbo

+0

從哪裏閱讀價值?哪個入口? –

+0

請問我的其他問題:http://stackoverflow.com/questions/19574066/it-is-normal-for-linux-to-read-a-block-of-size-more-than-4kb-or-several-塊 – hebbo

相關問題