summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-07-29 14:21:14 +0200
committerVolker Lendecke <vl@samba.org>2010-07-29 22:46:44 +0200
commita86cad3921c4a8ddbcab1929c825356aec4fe76a (patch)
tree64539d2856ae68a7bddd75ebbd023be5ae82a0d1
parentfec8505e0be067a09929216cfe476802f21d14fe (diff)
downloadsamba-a86cad3921c4a8ddbcab1929c825356aec4fe76a.tar.gz
samba-a86cad3921c4a8ddbcab1929c825356aec4fe76a.tar.bz2
samba-a86cad3921c4a8ddbcab1929c825356aec4fe76a.zip
Revert "s3: Avoid pwrite calls for the 1-byte writes with zero content"
This reverts commit 6763730304627a58139450fd3e03a0ce48e31bb9.
-rw-r--r--source3/smbd/fileio.c54
1 files changed, 4 insertions, 50 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index e5a288822e..c6094f902b 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -649,31 +649,10 @@ nonop=%u allocated=%u active=%u direct=%u perfect=%u readhits=%u\n",
*/
flush_write_cache(fsp, WRITE_FLUSH);
-
- if (data[0] == '\0') {
- /*
- * This is a 1-byte write of a 0
- * beyond the EOF, the typical
- * file-extending (and allocating, but
- * we're using the write cache here)
- * write done by Windows. We just have
- * to ftruncate the file and rely on
- * posix semantics to return zeros for
- * non-written file data that is
- * within the file length.
- *
- * We have to cheat the offset to make
- * wcp_file_size_change do the right
- * thing with the ftruncate call.
- */
- wcp->offset = pos + 1;
- wcp->data_size = 0;
- } else {
- wcp->offset = wcp->file_size;
- wcp->data_size = pos - wcp->file_size + 1;
- memset(wcp->data, '\0', wcp->data_size);
- memcpy(wcp->data + wcp->data_size-1, data, 1);
- }
+ wcp->offset = wcp->file_size;
+ wcp->data_size = pos - wcp->file_size + 1;
+ memset(wcp->data, '\0', wcp->data_size);
+ memcpy(wcp->data + wcp->data_size-1, data, 1);
/*
* Update the file size if changed.
@@ -816,31 +795,6 @@ n = %u, wcp->offset=%.0f, wcp->data_size=%u\n",
if ((wcp->data_size == 0)
&& (pos > wcp->file_size)
- && (n == 1)
- && (data[0] == '\0')) {
- /*
- * This is a 1-byte write of a 0 beyond the
- * EOF, the typical file-extending (and
- * allocating, but we're using the write cache
- * here) write done by Windows. We just have
- * to ftruncate the file and rely on posix
- * semantics to return zeros for non-written
- * file data that is within the file length.
- *
- * We have to cheat the offset to make
- * wcp_file_size_change do the right thing
- * with the ftruncate call.
- */
- wcp->offset = pos+1;
- wcp->data_size = 0;
- if (wcp_file_size_change(fsp) == -1) {
- return -1;
- }
- return 1;
- }
-
- if ((wcp->data_size == 0)
- && (pos > wcp->file_size)
&& (pos + n <= wcp->file_size + wcp->alloc_size)) {
/*
* This is a write completely beyond the