Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Rockbox Ports are now being developed for various digital audio players!

+  Rockbox Technical Forums
|-+  Rockbox General
| |-+  Rockbox General Discussion
| | |-+  Directory cache rebuilds for no obvious reason
« previous next »
  • Print
Pages: [1]

Author Topic: Directory cache rebuilds for no obvious reason  (Read 5634 times)

Offline pondlife

  • Developer
  • Member
  • *
  • Posts: 248
Directory cache rebuilds for no obvious reason
« on: October 05, 2007, 08:30:11 AM »
If I repeatedly start and immediately shut down my H340, I get similar symptoms.  That is, every OTHER time I start up, I get a "Scanning disk..." splash.

USB is not involved at all.

If I let the player run for awhile before shutting down, this doesn't happen.  So perhaps it's a result of shutting down while the audio is still being buffered?

Whenever I check the dircache status, it's active, and size is well below it's limit (about 1MB, 13829 entries).

pondlife
« Last Edit: October 05, 2007, 08:34:26 AM by pondlife »
Logged

Offline Multiplex

  • Member
  • *
  • Posts: 440
Re: Directory cache rebuilds for no obvious reason
« Reply #1 on: October 05, 2007, 08:41:47 AM »
I have similar bahaviour on my H320 - hadn't characterised it in such detail, but it often does a quick re-scan on startup - doesn't take long on 5500 tracks and lots of other things to deal with to look into it.

I did wonder if it was down the using USB for charging triggering the "USB used, must check the disk logic"

Will pay more attention...
Logged

Offline LambdaCalculus

  • Member
  • *
  • Posts: 2257
  • Dreaming of Turing Machines...
    • The Nostalgia Roadtrip
Re: Directory cache rebuilds for no obvious reason
« Reply #2 on: October 05, 2007, 08:48:33 AM »
I'm also seeing this as well on my 5.5G iPod video. If I stop an audio track while it's playing, then shut down the iPod, it gives me the "Scanning disk..." splash on startup.

My stats are:

Files: 15323
Music: 4254
Dirs: 569
Max files in Dir: 621

I do get "Scanning disk..." when I start up after having transferred files to my iPod, but it's strange seeing it when I start it up when I haven't used USB.
Logged
Former Rockbox dev. Rising from the ashes...

Players: iPod Video /w 128GB SSD mod, H320 /w 128GB SSD mod

Offline Lear

  • Developer
  • Member
  • *
  • Posts: 533
Re: Directory cache rebuilds for no obvious reason
« Reply #3 on: October 06, 2007, 05:07:15 AM »
Actually, the directory cache rebuilds on every boot (unless you run Rockbox from flash on a H1x0, I think, in which case it is loaded from a file). :)

However, it should normally be done in the background, without  a "Scanning disk..." splash. I've no idea why it would do it on every other boot though. Once it has done a proper scan, it should ideally only happen again if you add a "large enough" number of files, so that certain buffer allocations aren't enough any more. Or that's at least how I've understood it.

Sounds like you should make a test build with a few splashes in init_dircache (main.c) and dircache_build (dircache.c) to figure out what is going on.
Logged

Offline AlexP

  • Global Moderator
  • Member
  • *
  • Posts: 3688
  • ex-BigBambi
Re: Directory cache rebuilds for no obvious reason
« Reply #4 on: October 06, 2007, 05:16:24 AM »
I believe it will do a full rescan on boot if you interupt a background scan on the previous boot.  Therefore you get:

Boot 1)  Starts a background scan, you shut it down before it has finished.

Boot 2)  Previous boot had interupted background scan, so do foreground scan

Boot 3)  Previous boot did full foreground scan, therefore start background scan, you shut it down before it has finished.

Boot 4)  Previous boot had interupted background scan, so do foreground scan

and so on.

I don't know whether the behaviour of doing a full foreground scan on next boot if previous boot background scan did not complete is a bug or not, but that is what seems to happen.
Logged
H140, F60, S120, e260, c240, Clip, Fuze v2, Connect, MP170, Meizu M3, Nano 1G, Android

Offline psycho_maniac

  • Member
  • *
  • Posts: 814
    • MyWebPage
Re: Directory cache rebuilds for no obvious reason
« Reply #5 on: October 06, 2007, 05:28:00 AM »
yes my ipod also does this but directory cache is always completed and no sound is being played meaning i stop a playlist and when i start it up i have it to start in the menu. i get a scanning disk... or a loading... pop up at the begining of every OTHER boot.
Logged
Please SEARCH the wiki | Please read the Forum Guidelines | Please Read the Manual
I Own A Gigabeat F80

Offline Lear

  • Developer
  • Member
  • *
  • Posts: 533
Re: Directory cache rebuilds for no obvious reason
« Reply #6 on: October 06, 2007, 05:44:05 AM »
Indeed, that would trigger this behavior. Interrupting a background scan shouldn't force a full rebuild on next boot, IMO, but that happens due to the code in tree_flush (tree.c). It should probably make sure that the dircache isn't initializing before updating global_status.dircache_size (it will be set to 0 in that case)...

Just stopping a track and then shutting down (after dircache scanning is complete) shouldn't trigger it though.

psycho_maniac, it sounds like you don't do a proper shutdown, but rather a forced reset or shutdown. Could that be the case? A proper shutdown comes from a long press on play, from what I can see in the manual.
Logged

Offline pixelma

  • Rockbox Expert
  • Member
  • *
  • Posts: 645
Re: Directory cache rebuilds for no obvious reason
« Reply #7 on: October 06, 2007, 05:51:22 AM »
Maybe the problem here is that Ipods stop playback and shut down with a long press of play, meaning that if you keep holding play from the WPS it will shut down while dircache hasn't finished writing the changes (or whatever it does) yet? There was a short discussion about it in IRC yesterday and this leads me to the question if the same happens if you first stop playback, let it return to the browser or menu (leave it for a few seconds) and then turn the Ipod off?
Logged

(:@)

  • Guest
Re: Directory cache rebuilds for no obvious reason
« Reply #8 on: October 06, 2007, 06:39:58 AM »
It's not a ipod specific problem: pondlife and Multiplex have it on their H320 (first 2 posts) and I also have this "scanning disk" message on my h100 from time to time (without usb usage meanwhile).

I don't think it has something to do with an interrupted scan.
I can let my player run for a while and shut it down without deleting or modifying any files or connected it the pc and the next time I turn it on this message appears.
I cannot say why or if it will popup on the next boot. The message popup doesn't bother me, but it indicates a bug.
Logged

Offline AlexP

  • Global Moderator
  • Member
  • *
  • Posts: 3688
  • ex-BigBambi
Re: Directory cache rebuilds for no obvious reason
« Reply #9 on: October 06, 2007, 06:50:27 AM »
I never get it on my H140 if I let disk activity stop after booting before shuting down.
Logged
H140, F60, S120, e260, c240, Clip, Fuze v2, Connect, MP170, Meizu M3, Nano 1G, Android

Offline Multiplex

  • Member
  • *
  • Posts: 440
Re: Directory cache rebuilds for no obvious reason
« Reply #10 on: October 07, 2007, 11:48:21 AM »
Loking at the recent comits it seems that there may have been an issue that has been looked at - must do an update (except that I let my player at work ...)

"Don't get the dircache size while dircache is still initializing. If done during shutdown, it will force a foreground scan on next boot. "
Logged

Offline Lear

  • Developer
  • Member
  • *
  • Posts: 533
Re: Directory cache rebuilds for no obvious reason
« Reply #11 on: October 07, 2007, 02:02:57 PM »
Quote from: squidkidd on October 07, 2007, 01:47:27 PM
Just updated and it seems to have completely stopped all of the seemingly unnecessary scans, and it has also fixed my broken dircache discussed here:
http://forums.rockbox.org/index.php?topic=13071.0
That's strange. The problem there, at least the one reported by psycho_maniac, should be unrelated to the recent fix... It should only make a difference if you shut down before the background scan has finished. I'd imagine this isn't the normal usage pattern - unless the scanning takes a very long time for some reason.

Oh well, good to know it improved things, even if I don't quite understand why. :)
Logged

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Directory cache rebuilds for no obvious reason
« Reply #12 on: October 07, 2007, 02:31:14 PM »
On 80gb iPods, I believe disk access may still be "slow" while the player's active (resume playback, for example) which might result in long rescans.

As well, many people "testing" this bug would turn on their player, check, turn off, turn on, check, to see the "every other" thing happen. And of course, since the foreground scan wasn't interrupted, it would finish.
Logged

Offline squidkidd

  • Member
  • *
  • Posts: 42
Re: Directory cache rebuilds for no obvious reason
« Reply #13 on: October 07, 2007, 02:33:27 PM »
Well, not only have I yet to get a "scanning disk" since the update, but I have yet to have dircache be reported as "dircache initialized: No" when it should be yes, as it previously would do.  Perhaps when rockbox was previously shutdown before a background scan could be completed, it would not work period upon next boot?

Regards,
Brian

EDIT:

Ok, seems Lear was right.  I take back what I said about it fixing the other problem as well.  After some practical use, I discovered that still on about every other boot, dircache becomes disabled (see http://forums.rockbox.org/index.php?topic=13071.0).  If I turn the player on and off repeatedly, Rockbox will not scan disk, which is good.  This is a result of the fix where if you turn the player off before it has time to build the dircache, it will not do a foreground scan on next boot.  There is still some bug I guess causing dircache to disable, which may or may not have something to do the number of files on the player.
« Last Edit: October 07, 2007, 06:27:08 PM by squidkidd »
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox General
| |-+  Rockbox General Discussion
| | |-+  Directory cache rebuilds for no obvious reason
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.123 seconds with 14 queries.