gamecard-microsd icon indicating copy to clipboard operation
gamecard-microsd copied to clipboard

When using sd2vita, sceIoMkdir becomes very slow

Open blastrock opened this issue 6 years ago • 0 comments

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

  • sceIoOpen("ux0:somefile", SCE_O_CREAT|SCE_O_WRONLY) with or without sd2vita => 2ms
  • sceIoMkdir("ux0:data", 06) or any folder that already exists => 2ms
  • sceIoMkdir("ur0:test", 06) => 40ms
  • sceIoMkdir("ux0:test", 06) without sd2vita and StorageMgr or gamesd => 40ms
  • sceIoMkdir("ux0:test", 06) with sd2vita and StorageMgr or gamesd => 250 ms or more

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

Related issue: https://github.com/CelesteBlue-dev/PSVita-StorageMgr/issues/54

blastrock avatar Dec 25 '18 11:12 blastrock