[Mesa-dev] [PATCH 2/2] disk_cache: use block size rather than file size

Grazvydas Ignotas notasas at gmail.com
Thu Apr 27 10:31:37 UTC 2017


On Thu, Apr 27, 2017 at 1:26 PM, Grazvydas Ignotas <notasas at gmail.com>
wrote:

> On Thu, Apr 27, 2017 at 4:15 AM, Timothy Arceri <tarceri at itsqueeze.com>
> wrote:
>
>> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
>> index 9fd7b96..2764017 100644
>> --- a/src/util/disk_cache.c
>> +++ b/src/util/disk_cache.c
>> @@ -525,21 +525,21 @@ unlink_lru_file_from_directory(const char *path)
>>        return 0;
>>
>>     if (stat(filename, &sb) == -1) {
>>        free (filename);
>>        return 0;
>>     }
>>
>>     unlink(filename);
>>     free (filename);
>>
>> -   return sb.st_size;
>> +   return sb.st_blocks * 512;
>>
>
> I think other block sizes than 512 are possible, you can use sb.st_blocks
> * sb.st_blksize to take care of that.
>

Ugh ignore that, the manpage says it's always 512-byte units.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170427/aa751603/attachment.html>


More information about the mesa-dev mailing list