* punching holes in files @ 2007-11-01 19:16 Steve French 2007-11-01 23:17 ` Anton Altaparmakov 2007-11-03 0:43 ` Large SMBwriteX testing Jeremy Allison 0 siblings, 2 replies; 5+ messages in thread From: Steve French @ 2007-11-01 19:16 UTC (permalink / raw) To: samba-technical, linux-cifs-client; +Cc: Amit K. Arora, linux-fsdevel madvise_remove (in Linux) is used to free the backing store associated with pages (punching a hole in a file). This is one of the vfs operations that we do not send over the wire to Samba (so this call would return -ENOSYS locally). Any thoughts on whether this could be done with an obscure SetFileInfo level or FCNTL or whether it is worth adding to the CIFS POSIX Extensions? A second interesting question is whether to implement fallocate over the wire. sys_fallocate takes a range (and also a flag which indicates whether to extend the size beyond end of file). SET_FILE_ALLOCATION_INFO takes a size field rather than a range. For the case of the range starting at zero, we could simply call Trans2 set pathinfo (or file info) with SET_FILE_ALLOCATION_INFO. Should we add a CIFS POSIX Extension operation for this too? By the way it looks like OCFS2 (not just ext4) implement these. -- Thanks, Steve ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: punching holes in files 2007-11-01 19:16 punching holes in files Steve French @ 2007-11-01 23:17 ` Anton Altaparmakov 2007-11-02 7:30 ` Volker Lendecke 2007-11-03 0:43 ` Large SMBwriteX testing Jeremy Allison 1 sibling, 1 reply; 5+ messages in thread From: Anton Altaparmakov @ 2007-11-01 23:17 UTC (permalink / raw) To: Steve French Cc: samba-technical, linux-cifs-client, Amit K. Arora, linux-fsdevel On 1 Nov 2007, at 19:16, Steve French wrote: > madvise_remove (in Linux) is used to free the backing store associated > with pages (punching a hole in a file). This is one of the vfs > operations that we do not send over the wire to Samba (so this call > would return -ENOSYS locally). Any thoughts on whether this could be > done with an obscure SetFileInfo level or FCNTL or whether it is worth > adding to the CIFS POSIX Extensions? Don't know about SMB/CIFS but on Windows locally you would need to first set the file sparse, and then to punch the hole. These two things are accomplished like so on Windows (STARTING_OFFSET is the first byte of the hole to be punched and END_OFFSET is the first byte after the hole to be punched): HANDLE f; // This is obtained from a CreateFile() call... DWORD bw; /* Set file sparse. */ if (!DeviceIoControl(f, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &bw, NULL)) { // Failed. return 1; } FILE_ZERO_DATA_INFORMATION z; /* Create a hole. */ z.FileOffset.QuadPart = STARTING_OFFSET; z.BeyondFinalZero.QuadPart = END_OFFSET; if (!DeviceIoControl(f, FSCTL_SET_ZERO_DATA, &z, sizeof(z), NULL, 0, &bw, NULL)) { // Failed. return 1; } > A second interesting question is whether to implement fallocate over > the wire. sys_fallocate takes a range (and also a flag which > indicates whether to extend the size beyond end of file). > SET_FILE_ALLOCATION_INFO takes a size field rather than a range. For > the case of the range starting at zero, we could simply call Trans2 > set pathinfo (or file info) with SET_FILE_ALLOCATION_INFO. Should we > add a CIFS POSIX Extension operation for this too? > > By the way it looks like OCFS2 (not just ext4) implement these. Again, I don't know about SMB/CIFS but Windows locally supports this, too. To pre-allocate some space without changing the file size (i.e. this only allocates space on disk, assigns it to the file, and changes the allocated_size on NTFS appropriately but does not change the data_size), one would call (note BYTE_OFFSET_IN_FILE_TO_PREALLOCATE_TO is the logical file offset to which to pre-allocate to): HANDLE f; // This is obtained from a CreateFile() call... FILE_ALLOCATION_INFO ai; ai.AllocationSize.QuadPart = BYTE_OFFSET_IN_FILE_TO_PREALLOCATE_TO; if (!SetFileInformationByHandle(f, FileAllocationInfo, &ai, sizeof(ai))) { // Failed. return 1; } Hope this is of some use to use... Best regards, Anton -- Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK Linux NTFS maintainer, http://www.linux-ntfs.org/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: punching holes in files 2007-11-01 23:17 ` Anton Altaparmakov @ 2007-11-02 7:30 ` Volker Lendecke 0 siblings, 0 replies; 5+ messages in thread From: Volker Lendecke @ 2007-11-02 7:30 UTC (permalink / raw) To: Anton Altaparmakov Cc: linux-fsdevel, Steve French, Amit K. Arora, linux-cifs-client, samba-technical [-- Attachment #1.1: Type: text/plain, Size: 969 bytes --] On Thu, Nov 01, 2007 at 11:17:32PM +0000, Anton Altaparmakov wrote: > On 1 Nov 2007, at 19:16, Steve French wrote: > >madvise_remove (in Linux) is used to free the backing store associated > >with pages (punching a hole in a file). This is one of the vfs > >operations that we do not send over the wire to Samba (so this call > >would return -ENOSYS locally). Any thoughts on whether this could be > >done with an obscure SetFileInfo level or FCNTL or whether it is worth > >adding to the CIFS POSIX Extensions? > > Don't know about SMB/CIFS but on Windows locally you would need to > first set the file sparse, and then to punch the hole. These two > things are accomplished like so on Windows (STARTING_OFFSET is the > first byte of the hole to be punched and END_OFFSET is the first byte > after the hole to be punched): It would be really great if you could try this with a file on a Windows server and send us the sniffs! Volker [-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --] [-- Attachment #2: Type: text/plain, Size: 172 bytes --] _______________________________________________ linux-cifs-client mailing list linux-cifs-client@lists.samba.org https://lists.samba.org/mailman/listinfo/linux-cifs-client ^ permalink raw reply [flat|nested] 5+ messages in thread
* Large SMBwriteX testing. 2007-11-01 19:16 punching holes in files Steve French 2007-11-01 23:17 ` Anton Altaparmakov @ 2007-11-03 0:43 ` Jeremy Allison 2007-11-07 22:56 ` Steve French 1 sibling, 1 reply; 5+ messages in thread From: Jeremy Allison @ 2007-11-03 0:43 UTC (permalink / raw) To: Steve French Cc: linux-fsdevel, linux-cifs-client, Amit K. Arora, samba-technical Hi Steve, I've finished adding the ability for smbd to support up to 16MB writeX calls in the latest git 3.2 tree. To enable, set the parameter : min receivefile size = XXX where XXX is the smallest writeX you want to handle with recvfile. The linux kernel doesn't yet support zerocopy from network to file (ie. splice only works one way currently) so it's emulated in userspace (with a 128k staging buffer) for now. Also it must be an unsigned connection (for obvious reasons). Once you've set this param smbd will start reporting CIFS_UNIX_LARGE_WRITE_CAP on a SMB_QUERY_CIFS_UNIX_INFO: call and you should be good to go. You'll need to use a writeX call identical to Windows (14 wct with a 1 byte pad field) in order to trigger the new code. Let me know if you get the chance to test it and if it makes a speed difference for CIFSFS. Cheers, Jeremy. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Large SMBwriteX testing. 2007-11-03 0:43 ` Large SMBwriteX testing Jeremy Allison @ 2007-11-07 22:56 ` Steve French 0 siblings, 0 replies; 5+ messages in thread From: Steve French @ 2007-11-07 22:56 UTC (permalink / raw) To: Jeremy Allison Cc: samba-technical, linux-cifs-client, Amit K. Arora, linux-fsdevel I have verified that it works for the case in which "min receivefile size" is under 128K. When I set it to 250000 and tried to read 148000 there were two or three problems (reply_write_and_X in Samba is calling smb_len instead of smb_len_large and it is looking for "req->unread_bytes" incorrectly in a few places in reply.c and fileio.c On Nov 2, 2007 6:43 PM, Jeremy Allison <jra@samba.org> wrote: > Hi Steve, > > I've finished adding the ability for smbd to support up to > 16MB writeX calls in the latest git 3.2 tree. > > To enable, set the parameter : > > min receivefile size = XXX > > where XXX is the smallest writeX you want to handle with recvfile. > > The linux kernel doesn't yet support zerocopy from network to > file (ie. splice only works one way currently) so it's emulated > in userspace (with a 128k staging buffer) for now. > > Also it must be an unsigned connection (for obvious reasons). > > Once you've set this param smbd will start reporting > CIFS_UNIX_LARGE_WRITE_CAP on a SMB_QUERY_CIFS_UNIX_INFO: > call and you should be good to go. You'll need to use > a writeX call identical to Windows (14 wct with a 1 byte > pad field) in order to trigger the new code. > > Let me know if you get the chance to test it and if > it makes a speed difference for CIFSFS. > > Cheers, > > Jeremy. > -- Thanks, Steve ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-11-07 22:56 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-11-01 19:16 punching holes in files Steve French 2007-11-01 23:17 ` Anton Altaparmakov 2007-11-02 7:30 ` Volker Lendecke 2007-11-03 0:43 ` Large SMBwriteX testing Jeremy Allison 2007-11-07 22:56 ` Steve French
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).