linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Events Counter - How it increments
@ 2020-11-10 14:24 Jorge Fábregas
  2020-11-17 15:50 ` Jorge Fábregas
  2020-11-18 16:45 ` heming.zhao
  0 siblings, 2 replies; 6+ messages in thread
From: Jorge Fábregas @ 2020-11-10 14:24 UTC (permalink / raw)
  To: linux-raid

Hi everyone,

I'm new to Linux RAID. I've searched for a clear explanation on this but
couldn't find it.

How does the "Events" counter (as shown with mdadm --examine) gets
incremented? On what sort of events?

I was initially confused about the "Events" (thinking on the different
events as reported by mdadm --monitor) but I see this is another thing.
I've seen explanations about it incrementing after performing writes but
I've done some test writes and I don't see the counters changing at all
on my RAID1 arrays.  I've also seen explanations that it increments
whenever there are changes to the superblock?

Thank you.

-- 
Jorge

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

* Re: Events Counter - How it increments
  2020-11-10 14:24 Events Counter - How it increments Jorge Fábregas
@ 2020-11-17 15:50 ` Jorge Fábregas
  2020-11-18 16:45 ` heming.zhao
  1 sibling, 0 replies; 6+ messages in thread
From: Jorge Fábregas @ 2020-11-17 15:50 UTC (permalink / raw)
  To: linux-raid

On 11/10/20 10:24 AM, Jorge Fábregas wrote:
> How does the "Events" counter (as shown with mdadm --examine) gets
> incremented? On what sort of events?

Anyone?  :)

Thank you.

-- 
Jorge

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

* Re: Events Counter - How it increments
  2020-11-10 14:24 Events Counter - How it increments Jorge Fábregas
  2020-11-17 15:50 ` Jorge Fábregas
@ 2020-11-18 16:45 ` heming.zhao
  2020-11-19  2:21   ` Jorge Fábregas
  1 sibling, 1 reply; 6+ messages in thread
From: heming.zhao @ 2020-11-18 16:45 UTC (permalink / raw)
  To: Jorge Fábregas, linux-raid

On 11/10/20 10:24 PM, Jorge Fábregas wrote:
> Hi everyone,
> 
> I'm new to Linux RAID. I've searched for a clear explanation on this but
> couldn't find it.
> 
> How does the "Events" counter (as shown with mdadm --examine) gets
> incremented? On what sort of events?
> 
> I was initially confused about the "Events" (thinking on the different
> events as reported by mdadm --monitor) but I see this is another thing.
> I've seen explanations about it incrementing after performing writes but
> I've done some test writes and I don't see the counters changing at all
> on my RAID1 arrays.  I've also seen explanations that it increments
> whenever there are changes to the superblock?
> 
> Thank you.
> 

The events is related with (struct mddev) mddev->events. 
you can search it in kernel source code.

and the 'events' is also recorded in md metadata area, with struct:
```
struct mdp_superblock_1 {
   ... ...
   __le64  events;     /* incremented when superblock updated */
   ... ...
};
```


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

* Re: Events Counter - How it increments
  2020-11-18 16:45 ` heming.zhao
@ 2020-11-19  2:21   ` Jorge Fábregas
  2020-11-19 11:27     ` heming.zhao
  0 siblings, 1 reply; 6+ messages in thread
From: Jorge Fábregas @ 2020-11-19  2:21 UTC (permalink / raw)
  To: linux-raid

On 11/18/20 12:45 PM, heming.zhao@suse.com wrote:
> The events is related with (struct mddev) mddev->events. 
> you can search it in kernel source code.

Thank you Heming.  I was expecting more of a general view since I'm a
new user.  Sorry I wasn't clear.

What sort of events cause the Event counter to increase?  If it's mainly
whenever the superblock is updated then my question is: What sort of
events cause the superblock to be updated? I can imagine detection of
failed disk, read errors, array checks, commands by user/admin,
assembly-reassembly etc? If an array operates fine for months - without
user intervention,  will the Event counter increase at all?

Thanks.

-- 
Jorge

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

* Re: Events Counter - How it increments
  2020-11-19  2:21   ` Jorge Fábregas
@ 2020-11-19 11:27     ` heming.zhao
  2020-11-19 11:46       ` Jorge Fábregas
  0 siblings, 1 reply; 6+ messages in thread
From: heming.zhao @ 2020-11-19 11:27 UTC (permalink / raw)
  To: Jorge Fábregas, linux-raid

Hello,

On 11/19/20 10:21 AM, Jorge Fábregas wrote:
> On 11/18/20 12:45 PM, heming.zhao@suse.com wrote:
>> The events is related with (struct mddev) mddev->events.
>> you can search it in kernel source code.
> 
> Thank you Heming.  I was expecting more of a general view since I'm a
> new user.  Sorry I wasn't clear.
>
very general overview: if array status/superblock is changed, event will increase.


> What sort of events cause the Event counter to increase?  If it's mainly
> whenever the superblock is updated then my question is: What sort of
> events cause the superblock to be updated? I can imagine detection of
> failed disk, read errors, array checks, commands by user/admin,
> assembly-reassembly etc? If an array operates fine for months - without
> user intervention,  will the Event counter increase at all?
> 

the status/event is the content of struct mdp_superblock_1:
    __le64  ctime;      /* lo 40 bits are seconds, top 24 are microseconds or 0*/
    __le32  level;      /* -4 (multipath), -1 (linear), 0,1,4,5 */
    __le32  layout;     /* only for raid5 and raid10 currently */
    __le64  size;       /* used size of component devices, in 512byte sectors */

    __le32  chunksize;  /* in 512byte sectors */
    __le32  raid_disks;
    ... ...
    __le64  reshape_position;   /* next address in array-space for reshape */
    __le32  delta_disks;    /* change in number of raid_disks       */
    __le32  new_layout; /* new layout                   */
    ... ...
    __le32  dev_number; /* permanent identifier of this  device - not role in raid */
    ... ...
    __le16  dev_roles[0];   /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ 

I am not very familiar with md, and can't enumerate all the cases. For your writing:
failed disk - dev_roles[X]
read errors - may change: dev_roles[X], recovery_offset
array checks - normally won't change, except disk fail is detected
commands by user - depend on special cmd
If an array operates fine for months - without user intervention - won't change

at last, please read the code.

Thanks.


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

* Re: Events Counter - How it increments
  2020-11-19 11:27     ` heming.zhao
@ 2020-11-19 11:46       ` Jorge Fábregas
  0 siblings, 0 replies; 6+ messages in thread
From: Jorge Fábregas @ 2020-11-19 11:46 UTC (permalink / raw)
  To: linux-raid

On 11/19/20 7:27 AM, heming.zhao@suse.com wrote:
> the status/event is the content of struct mdp_superblock_1:
>     __le64  ctime;      /* lo 40 bits are seconds, top 24 are microseconds or 0*/
>     __le32  level;      /* -4 (multipath), -1 (linear), 0,1,4,5 */
>     __le32  layout;     /* only for raid5 and raid10 currently */
>     __le64  size;       /* used size of component devices, in 512byte sectors */
> 
>     __le32  chunksize;  /* in 512byte sectors */
>     __le32  raid_disks;
>     ... ...
>     __le64  reshape_position;   /* next address in array-space for reshape */
>     __le32  delta_disks;    /* change in number of raid_disks       */
>     __le32  new_layout; /* new layout                   */
>     ... ...
>     __le32  dev_number; /* permanent identifier of this  device - not role in raid */
>     ... ...
>     __le16  dev_roles[0];   /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ 
> 
> I am not very familiar with md, and can't enumerate all the cases. For your writing:
> failed disk - dev_roles[X]
> read errors - may change: dev_roles[X], recovery_offset
> array checks - normally won't change, except disk fail is detected
> commands by user - depend on special cmd

Thanks Heming for  the breakdown.  That was helpful.

-- -
Jorge


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

end of thread, other threads:[~2020-11-19 11:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 14:24 Events Counter - How it increments Jorge Fábregas
2020-11-17 15:50 ` Jorge Fábregas
2020-11-18 16:45 ` heming.zhao
2020-11-19  2:21   ` Jorge Fábregas
2020-11-19 11:27     ` heming.zhao
2020-11-19 11:46       ` Jorge Fábregas

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).