TeamFAPS / PSVita-StorageMgr

kernel plugin that automatically mounts/redirects any storage device on any mount points you want
GNU General Public License v3.0
388 stars 40 forks source link

[3.0][GCD=ux0]When using sd2vita, sceIoMkdir becomes very slow #54

Open blastrock opened 5 years ago

blastrock commented 5 years ago

I have made some tests on sceIoMkdir and I get the following results:

This issue causes massive download speed drops in pkgj for games that contains hundreds of folders and eventually lead to a download failure due to HTTP timeout. I am also wondering if these 250ms aren't spent doing a FS sync to the sdcard which may wear it out sooner than necessary.

I tried a couple things (on the gamesd plugin, not this one, they are similar though). Replacing

static SceIoDevice uma_ux0_dev = { "ux0:", "exfatux0", "sdstor0:gcd-lp-ign-entire", "sdstor0:gcd-lp-ign-entire", MOUNT_POINT_ID };

with

static SceIoDevice uma_ux0_dev = { "ux0:", "exfatux0", "sdstor0:gcd-lp-ign-entire", NULL, MOUNT_POINT_ID };

Because that's what the structure looks like before being replaced. It did not help.

I also tried using sdstor0:gcd-lp-act-entire because that's a string that appears in the exfat kernel module.

Here is the small c++ snippet I used to benchmark mkdir:

void testmkdir(char const* path, int mode)
{
    sceIoRmdir(path);
    auto const start = std::chrono::high_resolution_clock::now();
    int err = sceIoMkdir(path, mode);
    auto const end = std::chrono::high_resolution_clock::now();
    auto const total =
            std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
                    .count();

    if (err < 0)
        LOGF("sceIoMkdir({}, {:x}) time: {} failed: {:#08x}",
             path,
             mode,
             total,
             static_cast<uint32_t>(err));
    else
        LOGF("sceIoMkdir({}, {:x}) time: {} success", path, mode, total);
}
CelesteBlue-dev commented 5 years ago

Is ux0: the memcard or the SD2VITA ? Maybe your microSD is slower than official memcards...

blastrock commented 5 years ago

ux0: is the sd2vita, or the internal memory, depending on the test. When it's the sd2vita it takes 250ms. The problem is specific to mkdir, so I don't think the issue is with the sd card. It also works fine when plugged in a computer.

CelesteBlue-dev commented 4 years ago

Happens in gamesd too (see https://github.com/xyzz/gamecard-microsd/issues/30) so it is directly related to the way the sd2vita (GCD) patch is done.