Opened 10 years ago

Closed 10 years ago

#4295 closed Bug (fixed)

download-dir-free-space contains garbage

Reported by: bugmenot Owned by: jordan
Priority: Normal Milestone: 2.32
Component: libtransmission Version: 2.31
Severity: Normal Keywords: statvfs
Cc:

Description

At least on FreeBSD available space is calculated by (number of blocks * fragment size).

from statvfs(2) manpage:

f_frsize   The size in bytes of the minimum unit of allocation on
           this file system.  (This corresponds to the f_bsize mem‐
           ber of struct statfs.)

f_bsize    The preferred length of I/O requests for files on this
           file system.  (Corresponds to the f_iosize member of
           struct statfs.)

For example,

$ df
Filesystem           Size    Used   Avail Capacity  Mounted on
/dev/md0              62M    8.0k     57M     0%    /ufs
tank                  27M     31k     27M     0%    /zfs
tmpfs                 64M    4.0k     64M     0%    /tmpfs
localhost:/zfs        27M     31k     27M     0%    /nfs

and see (f_avail * f_bsize) for them

statfs("/ufs") = 60,313,600 (avail = 14,725, bsize = 4,096, iosize = 32,768)
statvfs("/ufs") = 482,508,800 (avail = 14,725, bsize = 32,768, frsize = 4,096)

statfs("/zfs") = 28,739,584 (avail = 56,132, bsize = 512, iosize = 131,072)
statvfs("/zfs") = 7,357,333,504 (avail = 56,132, bsize = 131,072, frsize = 512)

statfs("/tmpfs") = 67,104,768 (avail = 16,383, bsize = 4,096, iosize = 4,096)
statvfs("/tmpfs") = 67,104,768 (avail = 16,383, bsize = 4,096, frsize = 4,096)

statfs("/nfs") = 28,739,584 (avail = 56,132, bsize = 512, iosize = 65,536)
statvfs("/nfs") = 3,678,666,752 (avail = 56,132, bsize = 65,536, frsize = 512)

And so --session-info for remote client is almost always wrong about free space in download directory.

Attachments (1)

a.diff​ (520 bytes) - added by bugmenot 10 years ago.
use fragment size

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by bugmenot

use fragment size

comment:1 Changed 10 years ago by jordan

  • Milestone changed from None Set to 2.32
  • Status changed from new to assigned

comment:2 Changed 10 years ago by jordan

  • Resolution set to fixed
  • Status changed from assigned to closed

Patch applied in r12478.

Note: See TracTickets for help on using tickets.