[Top] [All Lists]

preallocate near a specified block

To: linux-xfs@xxxxxxxxxxx
Subject: preallocate near a specified block
From: "Roger Willcocks" <willcor@xxxxxxxxx>
Date: Thu, 20 Jul 2006 15:38:27 +0100
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=UZwpRfSNY1UHuh1ssHVFrQM5gNMAE01PfK099j/qoLb8+6B91zHjF9aGFPmNHB28FDSYYFi+YrHQFOxf8BKqyhxqAZgufIV/Y2Y+H1UOIm5HIDp62W9/51XXI/rxS0WJ717jJGOsZECOrellJRqzojrFBSCpLH/ubcATFJ6jXTA=
Sender: xfs-bounce@xxxxxxxxxxx
Hi folks,

I've put together a 'preallocate near' ioctl, which I've been using in
anger for several months now. The changes are pretty minimal, and boil
down to making xfs_bmap think it's extending a file instead of doing
an initial allocation.

From a user perspective it's a simple extension of the existing RESVSP
ioctl, with the flag bits (allocate near, allocate contiguous) hidden
in the 'whence' parameter.

       xfs_flock64_t flck;
       memset(&flck, 0, sizeof(flck));

       flck.l_whence = SEEK_SET;
       flck.l_start = 0LL;
       flck.l_len = (off64_t)extent;

       if (nearToBlock != 0) {
               flck.l_whence |= RESV_NEAR | RESV_CONTIG; /* if possible */
               flck.l_near = nearToBlock;

       int status = ioctl(fd, XFS_IOC_RESVSP64, &flck);

Any interest?


Attachment: xfs_near.patch
Description: Binary data

<Prev in Thread] Current Thread [Next in Thread>