# 第二次發 linux patch [kernel org](https://lore.kernel.org/dm-devel/20240513064700.88178-1-merqqcury@gmail.com/T/#u) 閱讀 dmcache driver 時注意到 `dm_kcopyd_copy` 底下判斷 flag 的方式有機會優化,所以想試試看發 patch 先到 [linux github](https://github.com/torvalds/linux) 下載最新的 source code 我是下載 .zip ```shell! unzip linux-6.9-rc3 ``` 設定 git ```shell! git init git add . git commit -m "linux-6.9-rc3" ``` 更改程式碼 > linux-6.9-rc3/drivers/md/dm-kcopyd.c ```diff! - if (job->flags & BIT(DM_KCOPYD_WRITE_SEQ) && - job->flags & BIT(DM_KCOPYD_IGNORE_ERROR)) + if (job->flags & BIT(DM_KCOPYD_WRITE_SEQ)) job->flags &= ~BIT(DM_KCOPYD_IGNORE_ERROR); ``` git ```shell! git add . git commit -s -v git format-patch {比較的分支} ls *.patch ``` 檢查 pathc 格式 ``` ./scripts/checkpatch.pl 0001-md-Reduce-flag-condition.patch ``` :::success total: 0 errors, 0 warnings, 9 lines checked 0001-md-Reduce-flag-condition.patch has no obvious style problems and is ready for submission. ::: 接下來要找管理者 ``` ./scripts/get_maintainer.pl -f drivers/md/dm-kcopyd.c ``` 測試 email ```shell! git send-email --to merqqcury@gmail.com 0001-md-Reduce-flag-condition.patch ``` 正式送出 ```shell! git send-email --to snitzer@kernel.org --cc agk@redhat.com --cc mpatocka@redhat.com 0001-md-Reduce-flag-condition.patch ```