Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
My NSA-220 spins down it's disks after about 3 minutes of inactivity. That is too short. I couldn't find how to extend this period (the NAS doesn't have an option for this, and hdparm and sdparm don't work for me). So I wrote next script:
#!/ffp/bin/sh #Spindown in minutes SPINDOWN=60 # 'size'of touch TOUCHSIZE=72 RUNNING=0 LASTBT=0 NOTACTIVE=-1 EXPECTED=0 LOGFILE='/ffp/var/log/spindown.log' STATUSFILE='/var/log/spindown' echo "spindown.sh starting" >> $LOGFILE cat /proc/scsi/mvSata/0 >> $LOGFILE while [ true ] do BT=`head -13 /proc/scsi/mvSata/0 | tail -1 | awk '{print $6}' ` DIFF=$( expr ${BT} - ${LASTBT} ) KA='' if [ ${DIFF} -gt ${EXPECTED} ] then NOTACTIVE=0 if [ $RUNNING -eq 0 ] then RUNNING=1 echo Spinup >> $LOGFILE date >> $LOGFILE fi else NOTACTIVE=$( expr ${NOTACTIVE} + 1 ) EXPECTED=0 if [ ${NOTACTIVE} -lt ${SPINDOWN} ] then EXPECTED=${TOUCHSIZE} KA='Keep alive' touch /i-data/md0/.keepalive else if [ ${RUNNING} -eq 1 ] then RUNNING=0 echo Spindown >> $LOGFILE date >> $LOGFILE fi fi fi echo sectors ${BT} diff ${DIFF} na ${NOTACTIVE} $KA > $STATUSFILE LASTBT=${BT} sleep 60 done
The idea is that it reads /proc/scsi/mvSata/0 once a minute, extracts the number of accessed sectors, compares it to the value of 1 minute ago, decides if the disk has been active the last minute.
Then it keeps the disk awake by touching .keepalive on the harddisk when it has been active in the last hour.
Of course touching is an activity too, so the script has to face that. On my disk this touch accesses 64-72 sectors, so the disk is only flagged active when the number of accessed sectors is higher.
This script works. The weird part is it doesn't work when I start it from /ffp/etc/fun_plug.local. The file /var/log/spindown then contains:
sectors diff - na 14 Keep alive
while it should be something like:
sectors 16472 diff 72 na 14 Keep alive
It seems it can't extract line 13 word 6 from mvSata/0. The LOGFILE contains a mvSata/0 like it should be:
Version_1_1 TimeStamp : -23481 100 Number of interrupts generated by the adapter is : 3873 Integrated Sata adapterId 0, channel 0 Adapter Channel Id LUN TO TS Vendor Mode LBA48 -------------------------------------------------------------------------------- 0 0 0 0 1898 15152 Hitach NCQ 1 TO - Total Outstanding commands accumulated TSA - Total number of IOs accumulated TS - Total number of sectors transferred (both read/write) Mode - EDMA mode (TCQ|NCQ|Normal) LBA48 - Large Block Address 48 feature set enabled
so when the script starts this file(?) already has the right contents.
Can somebody shine a light on this?
//sala edit
I did change topic subject
Last edited by sala (2009-03-14 19:39:00)
Offline
I found it. I forgot to add
export PATH=/ffp/sbin:/ffp/bin:/usr/sbin:/sbin:/usr/bin:/bin
to /ffp/etc/fun_plug.local. So my script used different versions of head, tail, awk...
Offline
In kernel source, there is
arch/arm/mach-mv88fxx81/Board/SATA/CoreDriver/mvStorageDev.c
unsigned short time_to_power_save = 3*60; //default 3mins
But this will be later changed in EnablePowerSaving function which will be called from:
arch/arm/mach-mv88fxx81/LSP/mvSata/mvLinuxIalHt.c
EnablePowerSaving(3); //default suspending time
2.30 firmware has web interface option to change default spindown parameter. I might dig around to find out how they manipulate this. But I am not surprised if they are using similar solution as Mijzelf script does.
Offline
Seems like zyxel has released incorrect GPL sources for NSA-220+ (plus). It's just copy of regular NSA-220 outdated kernel source, and seems like other source files are just renamed as well (nsa220build.tar.gz -> nsa220plusbuild.tar.gz).
In NSA-220+ 3.10 and NSA-220 with 3.11 firmware has special kernel patch for disk suspending (d_suspdtime), but released GPL sources has no trace about d_suspdtime in them.
//edit
I will try to get some more recent sources, but It will not be easy...
http://www.zyxelforum.de/viewtopic,p,2880.html
Offline
This GPL issue is heating up pretty fast. Looks to me like they are not interested to release any new GPL code...
Offline
opensource for NSA-220 PLUS is available ftp://opensource.zyxel.com/NSA-220%20PLUS/v3.12/
Offline
chorus wrote:
opensource for NSA-220 PLUS is available ftp://opensource.zyxel.com/NSA-220%20PLUS/v3.12/
Thanks. I know.
I have loaded new kernel to flash and make it to boot system from hdd. Although I have some problems with d_suspdtime. From original firmware it will take parameters and use them correctly but in gentoo it reset's parameters back to 0 (unlimited) as soon as disk state changes.
//edit 1
I have started to suspect that once again they have released in-proper kernel source which has incomplete or broken functions in it. Not pointing any fingers yet...
Will compare kernel binaries soon and trying to find it out.
//edit 2
All string based data seems to be matching but binary code got bunch of differences in them.
Using same kernel source code, using same .config & Makefile, using same make parameter, using same cross-compiler should generate very-very similar kernel binaries.
Now I might try to use built kernel with zyxel firmware and see if d_suspdtime works properly.
Last edited by sala (2009-05-21 15:49:12)
Offline
sala wrote:
chorus wrote:
opensource for NSA-220 PLUS is available ftp://opensource.zyxel.com/NSA-220%20PLUS/v3.12/
Thanks. I know.
I have loaded new kernel to flash and make it to boot system from hdd. Although I have some problems with d_suspdtime. From original firmware it will take parameters and use them correctly but in gentoo it reset's parameters back to 0 (unlimited) as soon as disk state changes.
//edit 1
I have started to suspect that once again they have released in-proper kernel source which has incomplete or broken functions in it. Not pointing any fingers yet...
Will compare kernel binaries soon and trying to find it out.
//edit 2
All string based data seems to be matching but binary code got bunch of differences in them.
Using same kernel source code, using same .config & Makefile, using same make parameter, using same cross-compiler should generate very-very similar kernel binaries.
Now I might try to use built kernel with zyxel firmware and see if d_suspdtime works properly.
It may be required to set it every time it boot up because I think zero is the default value when system is up.
The way to set it is to echo the number of minute to /proc/d_suspdtime
Last edited by chorus (2009-05-30 16:07:13)
Offline
chorus wrote:
It may be required to set it every time it boot up because I think zero is the default value when system is up.
I know already all of this. Problem is that when disk state changes it resets it back to zero.
This state is also stated at d_suspdtime. There are 4 states - no disk, reading, not reading, standby.
I was trying to compile kernel and boot up zyxel firmware but this kernel source they offer is not even booting firmware user-space.
Now when I got some time I will look up if I can fix this time reset problem by debugging all related parameters with printk.
I must say that this is very frustrating. I might also setup a cron script which could renew d_suspdtime parameter with rule "cron script interval = d_suspdtime - 1".
chorus wrote:
The way to set it is to echo the number of minute to /proc/d_suspdtime
Actually zyxel firmware does not use echo method. Zyxel uses ioctl's to communicate with /dev/btncpy, which will set d_suspdtime time.
ioctl(dev_file_desc, GADGETFS_FIFO_FLUSH, minutes);
I have also tried this but resetting back to zero behavior is still present.
Offline
If you upgrade to firmware 3.12 under the admin screen (normal setup, not ffp), you can set the timeout - I use 0 (zero) and it doesn't seem to power down the disks at all.
Either that or my disks don't make their click sound as they power down and my website is held in virtual memory somewhere.
Offline
adrianaitken wrote:
If you upgrade to firmware 3.12 under the admin screen (normal setup, not ffp), you can set the timeout - I use 0 (zero) and it doesn't seem to power down the disks at all.
Either that or my disks don't make their click sound as they power down and my website is held in virtual memory somewhere.
0 (zero) means unlimited time and no standby will never happen.
Standby time problem I am describing is only happening when using kernel built from 3.12 gpl sources available from zyxel.
Offline
The provided 2.10 kernelsources doesn't equal to the fw 2.10 kernel either. I build a kernel following the readme directions, but after booting it I get a line '//--- power saving time = 180 ---//' in dmesg, repeating each 3 minutes as long as the drive isn't spinned down.
Never saw that line before.
Offline
I know, the source is somewhere between.
But in my case I did find out that after umounting my 2TB hdd, d_suspdtime started working correctly, so it must be some incompatibility or issue with two separate drives, as zyxel does not support this mode (just rair1, raid0 and jbod is supported).
Weird think is that disconecting 2TB WD and using just 750GB samsung then d_suspdtime is not working again.
Offline
On my box d_suspdtime seems to work correctly. I have two disks, one 500GB containing a singledisk raid1 array to satisfy the firmware neediness, and a 1TB disk, which is mostly unmounted. It's only mounted once a week to make an rsnapshot.
The box is running the 3.12 kernel, without your hd patches, compiled with the codesourcery compiler. Firmware 2.10 is running on top of it.
Offline
The 'echo nnn >/proc/d_suspdtime' function has two functions.
echo n >/proc/d_suspdtime sets the suspension time to n minutes, and
echo n,m >/proc/d_suspdtime sets channel n to state m, where the only valid value for m is 0. The action done when called is
hd_flag[channelIndex] = 0; SATA_hd_read_write[channelIndex] = 0; // SATA_HD_NO_ACTIVE SATA_State_Counter[channelIndex] = 0; SendPowerSavingModeCommand(channelIndex);
So far so good. The problem is that in this file (linux/arch/arm/mach-mv88fxx81/LSP/mvSata/mvLinuxIalHt.c ) SATA_State_Counter is declared as extern unsigned long [4], while the implementation in linux/arch/arm/mach-mv88fxx81/Board/SATA/CoreDriver/mvStorageDev.c is unsigned short [2].
So putting channel 1 asleep using /proc/d_suspdtime has a nasty side effect.
Maybe this is the source of your problem, sala?
Offline
Thanks for looking into it. I was using echo nnn >/proc/d_suspdtime and ioctl(dev_file_desc, GADGETFS_FIFO_FLUSH, minutes) to /dev/btncpy bethod to set suspend time but I did never figured out why it did get reseted back to 0. So I gave up on this because lack of time and its hard for me to restart debugging when a lot of time has passed.
I probably try to run vanialla kernel on it. I think it is more useful thing to do and hopefully not to painful since many 88F5182 devices are already supported
Offline