linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] md: When resync aborted,using ->curr_resync as the last completed request rather than ->curr_resync_completed.
@ 2012-10-27  2:28 kernelmail
  2012-10-28 21:32 ` NeilBrown
  0 siblings, 1 reply; 4+ messages in thread
From: kernelmail @ 2012-10-27  2:28 UTC (permalink / raw)
  To: NeilBrown; +Cc: linux-raid

In commit(db91ff55bdf06736b849afc1b1fce5763bbb8d5d),it said:
>If a resync is aborted we should record how far we got
>(recovery_cp) the last request that we know has completed
>(->curr_resync_completed) rather than the last request that was
>submitted (->curr_resync).
But when resync aborted, it execed
>wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active));
After this, the ->curr_resync is the last completed request.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
 drivers/md/md.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9ab768a..1d9940d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7558,8 +7558,7 @@ void md_do_sync(struct md_thread *thread)
 					printk(KERN_INFO
 					       "md: checkpointing %s of %s.\n",
 					       desc, mdname(mddev));
-					mddev->recovery_cp =
-						mddev->curr_resync_completed;
+					mddev->recovery_cp = mddev->curr_resync;
 				}
 			} else
 				mddev->recovery_cp = MaxSector;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/5] md: When resync aborted,using ->curr_resync as the last completed request rather than ->curr_resync_completed.
  2012-10-27  2:28 [PATCH 1/5] md: When resync aborted,using ->curr_resync as the last completed request rather than ->curr_resync_completed kernelmail
@ 2012-10-28 21:32 ` NeilBrown
  2012-10-29  3:27   ` majianpeng
  0 siblings, 1 reply; 4+ messages in thread
From: NeilBrown @ 2012-10-28 21:32 UTC (permalink / raw)
  To: kedacomkernel; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 1416 bytes --]

On Sat, 27 Oct 2012 10:28:58 +0800 kernelmail <kedacomkernel@gmail.com> wrote:

> In commit(db91ff55bdf06736b849afc1b1fce5763bbb8d5d),it said:
> >If a resync is aborted we should record how far we got
> >(recovery_cp) the last request that we know has completed
> >(->curr_resync_completed) rather than the last request that was
> >submitted (->curr_resync).
> But when resync aborted, it execed
> >wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active));
> After this, the ->curr_resync is the last completed request.
> 
> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
> ---
>  drivers/md/md.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 9ab768a..1d9940d 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -7558,8 +7558,7 @@ void md_do_sync(struct md_thread *thread)
>  					printk(KERN_INFO
>  					       "md: checkpointing %s of %s.\n",
>  					       desc, mdname(mddev));
> -					mddev->recovery_cp =
> -						mddev->curr_resync_completed;
> +					mddev->recovery_cp = mddev->curr_resync;
>  				}
>  			} else
>  				mddev->recovery_cp = MaxSector;

No.
This reverts commit db91ff55bdf06736b849afc1b1fce5763bbb8d5d

Maybe if we differentiated between an abort-due-to-error and an
abort-due-to-request, then in the second card we could use ->curr_resync.

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: [PATCH 1/5] md: When resync aborted,using ->curr_resync as the last completed request rather than ->curr_resync_completed.
  2012-10-28 21:32 ` NeilBrown
@ 2012-10-29  3:27   ` majianpeng
  2012-11-19  1:37     ` NeilBrown
  0 siblings, 1 reply; 4+ messages in thread
From: majianpeng @ 2012-10-29  3:27 UTC (permalink / raw)
  To: NeilBrown; +Cc: linux-raid

>On Sat, 27 Oct 2012 10:28:58 +0800 kernelmail <kedacomkernel@gmail.com> wrote:
>
>> In commit(db91ff55bdf06736b849afc1b1fce5763bbb8d5d),it said:
>> >If a resync is aborted we should record how far we got
>> >(recovery_cp) the last request that we know has completed
>> >(->curr_resync_completed) rather than the last request that was
>> >submitted (->curr_resync).
>> But when resync aborted, it execed
>> >wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active));
>> After this, the ->curr_resync is the last completed request.
>> 
>> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
>> ---
>>  drivers/md/md.c |    3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>> 
>> diff --git a/drivers/md/md.c b/drivers/md/md.c
>> index 9ab768a..1d9940d 100644
>> --- a/drivers/md/md.c
>> +++ b/drivers/md/md.c
>> @@ -7558,8 +7558,7 @@ void md_do_sync(struct md_thread *thread)
>>  					printk(KERN_INFO
>>  					       "md: checkpointing %s of %s.\n",
>>  					       desc, mdname(mddev));
>> -					mddev->recovery_cp =
>> -						mddev->curr_resync_completed;
>> +					mddev->recovery_cp = mddev->curr_resync;
>>  				}
>>  			} else
>>  				mddev->recovery_cp = MaxSector;
>
>No.
>This reverts commit db91ff55bdf06736b849afc1b1fce5763bbb8d5d
>
>Maybe if we differentiated between an abort-due-to-error and an
>abort-due-to-request, then in the second card we could use ->curr_resync.
>
>NeilBrown
>
Yes, i missed the case which interrupted by io-error.
So i add a flag MD_RECOVERY_ERROR in md_done_sync.
 
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9ab768a..cb9864c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7172,6 +7172,7 @@ void md_done_sync(struct mddev *mddev, int blocks, int ok)
        wake_up(&mddev->recovery_wait);
        if (!ok) {
                set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+               set_bit(MD_RECOVERY_ERROR, &mddev->recovery);
                md_wakeup_thread(mddev->thread);
                // stop recovery, signal do_sync ....
        }
@@ -7558,8 +7559,12 @@ void md_do_sync(struct md_thread *thread)
                                        printk(KERN_INFO
                                               "md: checkpointing %s of %s.\n",
                                               desc, mdname(mddev));
-                                       mddev->recovery_cp =
-                                               mddev->curr_resync_completed;
+                                       if (test_bit(MD_RECOVERY_ERROR, &mddev->recovery))
+                                               mddev->recovery_cp =
+                                                       mddev->curr_resync_completed;
+                                       else
+                                               mddev->recovery_cp =
+                                                       mddev->curr_resync;
                                }
                        } else
                                mddev->recovery_cp = MaxSector;
diff --git a/drivers/md/md.h b/drivers/md/md.h
index af443ab..3b1a35f 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -307,6 +307,7 @@ struct mddev {
         * REQUEST:  user-space has requested a sync (used with SYNC)
         * CHECK:    user-space request for check-only, no repair
         * RESHAPE:  A reshape is happening
+        * ERROR:    interrupted by IO error not by request
         *
         * If neither SYNC or RESHAPE are set, then it is a recovery.
         */
@@ -320,6 +321,7 @@ struct mddev {
 #define        MD_RECOVERY_CHECK       7
 #define MD_RECOVERY_RESHAPE    8
 #define        MD_RECOVERY_FROZEN      9
+#define MD_RECOVERY_ERROR      10
 
        unsigned long                   recovery;
        /* If a RAID personality determines that recovery (of a particular


How about this patch?

Jianpeng



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/5] md: When resync aborted,using ->curr_resync as the last completed request rather than ->curr_resync_completed.
  2012-10-29  3:27   ` majianpeng
@ 2012-11-19  1:37     ` NeilBrown
  0 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2012-11-19  1:37 UTC (permalink / raw)
  To: majianpeng; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 4327 bytes --]

On Mon, 29 Oct 2012 11:27:25 +0800 majianpeng <majianpeng@gmail.com> wrote:

> >On Sat, 27 Oct 2012 10:28:58 +0800 kernelmail <kedacomkernel@gmail.com> wrote:
> >
> >> In commit(db91ff55bdf06736b849afc1b1fce5763bbb8d5d),it said:
> >> >If a resync is aborted we should record how far we got
> >> >(recovery_cp) the last request that we know has completed
> >> >(->curr_resync_completed) rather than the last request that was
> >> >submitted (->curr_resync).
> >> But when resync aborted, it execed
> >> >wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active));
> >> After this, the ->curr_resync is the last completed request.
> >> 
> >> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
> >> ---
> >>  drivers/md/md.c |    3 +--
> >>  1 file changed, 1 insertion(+), 2 deletions(-)
> >> 
> >> diff --git a/drivers/md/md.c b/drivers/md/md.c
> >> index 9ab768a..1d9940d 100644
> >> --- a/drivers/md/md.c
> >> +++ b/drivers/md/md.c
> >> @@ -7558,8 +7558,7 @@ void md_do_sync(struct md_thread *thread)
> >>  					printk(KERN_INFO
> >>  					       "md: checkpointing %s of %s.\n",
> >>  					       desc, mdname(mddev));
> >> -					mddev->recovery_cp =
> >> -						mddev->curr_resync_completed;
> >> +					mddev->recovery_cp = mddev->curr_resync;
> >>  				}
> >>  			} else
> >>  				mddev->recovery_cp = MaxSector;
> >
> >No.
> >This reverts commit db91ff55bdf06736b849afc1b1fce5763bbb8d5d
> >
> >Maybe if we differentiated between an abort-due-to-error and an
> >abort-due-to-request, then in the second card we could use ->curr_resync.
> >
> >NeilBrown
> >
> Yes, i missed the case which interrupted by io-error.
> So i add a flag MD_RECOVERY_ERROR in md_done_sync.
>  
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 9ab768a..cb9864c 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -7172,6 +7172,7 @@ void md_done_sync(struct mddev *mddev, int blocks, int ok)
>         wake_up(&mddev->recovery_wait);
>         if (!ok) {
>                 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
> +               set_bit(MD_RECOVERY_ERROR, &mddev->recovery);
>                 md_wakeup_thread(mddev->thread);
>                 // stop recovery, signal do_sync ....
>         }
> @@ -7558,8 +7559,12 @@ void md_do_sync(struct md_thread *thread)
>                                         printk(KERN_INFO
>                                                "md: checkpointing %s of %s.\n",
>                                                desc, mdname(mddev));
> -                                       mddev->recovery_cp =
> -                                               mddev->curr_resync_completed;
> +                                       if (test_bit(MD_RECOVERY_ERROR, &mddev->recovery))
> +                                               mddev->recovery_cp =
> +                                                       mddev->curr_resync_completed;
> +                                       else
> +                                               mddev->recovery_cp =
> +                                                       mddev->curr_resync;
>                                 }
>                         } else
>                                 mddev->recovery_cp = MaxSector;
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index af443ab..3b1a35f 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -307,6 +307,7 @@ struct mddev {
>          * REQUEST:  user-space has requested a sync (used with SYNC)
>          * CHECK:    user-space request for check-only, no repair
>          * RESHAPE:  A reshape is happening
> +        * ERROR:    interrupted by IO error not by request
>          *
>          * If neither SYNC or RESHAPE are set, then it is a recovery.
>          */
> @@ -320,6 +321,7 @@ struct mddev {
>  #define        MD_RECOVERY_CHECK       7
>  #define MD_RECOVERY_RESHAPE    8
>  #define        MD_RECOVERY_FROZEN      9
> +#define MD_RECOVERY_ERROR      10
>  
>         unsigned long                   recovery;
>         /* If a RAID personality determines that recovery (of a particular
> 
> 
> How about this patch?
> 
> Jianpeng
> 
> 

Look OK except that it is badly white-space damaged.
Could you try resending it properly please?

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-19  1:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-27  2:28 [PATCH 1/5] md: When resync aborted,using ->curr_resync as the last completed request rather than ->curr_resync_completed kernelmail
2012-10-28 21:32 ` NeilBrown
2012-10-29  3:27   ` majianpeng
2012-11-19  1:37     ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).