On Wed, Sep 11, 2019 at 12:21 PM Yufen Yu <yuyufen@xxxxxxxxxx> wrote: > > > > On 2019/9/11 17:38, Song Liu wrote: > > On Wed, Sep 11, 2019 at 3:44 AM Yufen Yu <yuyufen@xxxxxxxxxx> wrote: > >> Hi, > >> For this patchset , we add a new entry .disk_is_spare in super_type > >> to check if the disk is in 'spare' state. If a disk is in spare, > >> analyze_sbs() should skip the disk to be freshest disk. Otherwise, > >> it may cause md run fail. There is a fail example in the second patch. > >> > > I think we need go a different path. I am sorry that some of early comments > > are misleading. > > > > We can extend the output of load_super() to have "2" for spares. And this > > _should_ make the code simpler. > > > > Does this make sense? > > > > I think we don't need to add extra output value '2'. > > For now, only analyze_sbs() use the output of load_super(). The others > caller just > check whether load_super() have failed, which will return a negative value. > > My first version patch directly modify load_super() and return '0' for > 'spare' disk. > Then analyze_sbs() can skip the spare disk as fresher disk. I think it > does work. > https://www.spinics.net/lists/raid/msg63136.html > > BTW, I don't know how to return '2' from load_super(), which pass events > test as > you say in the first patch. At the same time , it does not affect the > other caller. > You are right that we don't really need output value '2'. I think v1 is closer to the best solution. Let me comment on that again. Song