* Write mostly flag
@ 2017-01-01 7:37 Victor Garcia
2017-01-03 9:38 ` Guoqing Jiang
0 siblings, 1 reply; 2+ messages in thread
From: Victor Garcia @ 2017-01-01 7:37 UTC (permalink / raw)
To: linux-raid
Hello all
I am trying to set up a raid 1 array using an SSD and a standard SAT
HDD drives. As I read, it's better to set the write-mostly flag to the
HDD partition of the array to keep SSD performance times.
This is the command I'm using:
# mdadm --create /dev/md1 -n 2 -l 1 --metadata=0.90 --bitmap=internal
/dev/nvme0n1p5 -W /dev/sda8 --write-behind
I expect seeing the (W) indicator in mdstat, but this is not showing:
# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda8[1] nvme0n1p5[0]
52400064 blocks [2/2] [UU]
[>....................] resync = 0.3% (175936/52400064)
finish=9.8min speed=87968K/sec
unused devices: <none>
But if I force later on the flag by means of the sys FS handle, then
it does appear:
# cat /sys/block/md1/md/dev-sda8/state
in_sync
# echo writemostly > /sys/block/md1/md/dev-sda8/state
# cat /sys/block/md1/md/dev-sda8/state
in_sync,write_mostly
# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sda8[1](W) nvme0n1p5[0]
52400064 blocks [2/2] [UU]
[==>..................] resync = 11.0% (5806336/52400064)
finish=9.8min speed=78966K/sec
bitmap: 1/1 pages [4KB], 65536KB chunk
unused devices: <none>
How is it that the (W) is not showing in the first place?
BTW, this is the system being used:
# uname -a
Linux ubuntu 4.8.0-22-generic #24-Ubuntu SMP Sat Oct 8 09:15:00 UTC
2016 x86_64 x86_64 x86_64 GNU/Linu
Thanks and regards
Victor
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Write mostly flag
2017-01-01 7:37 Write mostly flag Victor Garcia
@ 2017-01-03 9:38 ` Guoqing Jiang
0 siblings, 0 replies; 2+ messages in thread
From: Guoqing Jiang @ 2017-01-03 9:38 UTC (permalink / raw)
To: Victor Garcia, linux-raid
On 01/01/2017 03:37 PM, Victor Garcia wrote:
> Hello all
>
> I am trying to set up a raid 1 array using an SSD and a standard SAT
> HDD drives. As I read, it's better to set the write-mostly flag to the
> HDD partition of the array to keep SSD performance times.
>
> This is the command I'm using:
>
> # mdadm --create /dev/md1 -n 2 -l 1 --metadata=0.90 --bitmap=internal
> /dev/nvme0n1p5 -W /dev/sda8 --write-behind
>
> I expect seeing the (W) indicator in mdstat, but this is not showing:
>
> # cat /proc/mdstat
> Personalities : [raid1]
> md1 : active raid1 sda8[1] nvme0n1p5[0]
> 52400064 blocks [2/2] [UU]
> [>....................] resync = 0.3% (175936/52400064)
> finish=9.8min speed=87968K/sec
>
> unused devices: <none>
>
> But if I force later on the flag by means of the sys FS handle, then
> it does appear:
>
> # cat /sys/block/md1/md/dev-sda8/state
> in_sync
> # echo writemostly > /sys/block/md1/md/dev-sda8/state
> # cat /sys/block/md1/md/dev-sda8/state
> in_sync,write_mostly
> # cat /proc/mdstat
> Personalities : [raid1]
> md1 : active raid1 sda8[1](W) nvme0n1p5[0]
> 52400064 blocks [2/2] [UU]
> [==>..................] resync = 11.0% (5806336/52400064)
> finish=9.8min speed=78966K/sec
> bitmap: 1/1 pages [4KB], 65536KB chunk
>
> unused devices: <none>
>
> How is it that the (W) is not showing in the first place?
Seems only 0.9 metadata has the issue while 1.x is ok from my side,
maybe below changes could help you.
diff --git a/super0.c b/super0.c
index 938cfd95fa25..4ad591ba022e 100644
--- a/super0.c
+++ b/super0.c
@@ -915,6 +915,9 @@ static int write_init_super0(struct supertype *st)
while (Kill(di->devname, NULL, 0, -1, 1) == 0)
;
+ if (di->disk.state & (1 << MD_DISK_WRITEMOSTLY))
+ sb->disks[di->disk.number].state |=
1<<MD_DISK_WRITEMOSTLY;
+
sb->disks[di->disk.number].state &= ~(1<<MD_DISK_FAULTY);
sb->this_disk = sb->disks[di->disk.number];
Regards,
Guoqing
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-03 9:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-01 7:37 Write mostly flag Victor Garcia
2017-01-03 9:38 ` Guoqing Jiang
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).