>>> On 8/22/16, 10:32 PM, "Shaohua Li" <shli@xxxxxxxxxx> wrote: >> > > +enum r5c_cache_mode { > > + R5C_MODE_NO_CACHE = 0, > > + R5C_MODE_WRITE_THROUGH = 1, > > + R5C_MODE_WRITE_BACK = 2, > > + R5C_MODE_BROKEN_CACHE = 3, > The idea of setting different modes makes sense. > But this is a little confusing. The first three are modes, the last one is status. > We can't set BROKEN_CACHE mode, right? How about we name it as r5c_cache_state? Splitting it into two entries seems an overkill to me. >> + spin_lock_irq(&conf->device_lock); > > + if (log) > > + conf->log->cache_mode = val; > > + if (val == R5C_MODE_NO_CACHE) { > > + clear_bit(MD_HAS_JOURNAL, &mddev->flags); > > + set_bit(MD_UPDATE_SB_FLAGS, &mddev->flags); > If the journal disk is Faulty and we clear HAS_JOURNAL, what's role of journal > disk? The on disk role is faulty (0xffff). The in memory data structure will show both Faulty and Journal. It works in my test (create -> fail journal -> remove journal -> write -> stop -> assemble). > This sounds incomplete. If we assemble the array and journal disk is missing, > can we set the mode to NO_CACHE and allow the array writeable? Do you mean setting to NO_CACHE automatically? I think it is not safe, as we may assemble and run the array accidentally without the journal. If the array is set to NO_CACHE, we will lost pending data on the journal. >> +extern ssize_t r5c_show_cache_mode(struct mddev *mddev, char *page); > > +extern ssize_t > > +r5c_store_cache_mode(struct mddev *mddev, const char *page, size_t len); > > Instead of export two functions, you can move r5c_cache_mode sysfs entry to raid5-cache.c > and export it. Will fix it in the next version. Thanks, Song ��.n��������+%������w��{.n�����{����w��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f