Hello Jason Brooks, Saggi Mizrahi, Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/8369

to review the following change.

Change subject: Use buffer size in multiplies of the recommended transfer size
......................................................................

Use buffer size in multiplies of the recommended transfer size

Using the recommended transfer size fixes the memory corruption for NFS.

Bug-Id: http://bugzilla.redhat.com/845660
Change-Id: Iadea310039b30073197b7ad90afb930c460bda17
Signed-off-by: Saggi Mizrahi <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/8356
Reviewed-by: Dan Kenigsberg <[email protected]>
Tested-by: Jason Brooks <[email protected]>
---
M vdsm/storage/fileUtils.py
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/8369/1

diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index 511dff9..ccc2bfe 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -48,6 +48,7 @@
 CharPointer = ctypes.POINTER(ctypes.c_char)
 
 _PC_REC_XFER_ALIGN = 17
+_PC_REC_MIN_XFER_SIZE = 16
 
 class TarCopyFailed(RuntimeError): pass
 
@@ -265,6 +266,13 @@
         # Because we usually have fixed sizes for our reads, caching
         # buffers might give a slight performance boost.
         alignment = libc.fpathconf(self.fileno(), _PC_REC_XFER_ALIGN)
+        minXferSize = libc.fpathconf(self.fileno(), _PC_REC_MIN_XFER_SIZE)
+        chunks, remainder = divmod(size, minXferSize)
+        if remainder > 0:
+            chunks += 1
+
+        size = chunks * minXferSize
+
         rc = libc.posix_memalign(ppbuff, alignment, size)
         if rc:
             raise OSError(rc, "Could not allocate aligned buffer")


--
To view, visit http://gerrit.ovirt.org/8369
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadea310039b30073197b7ad90afb930c460bda17
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.1
Gerrit-Owner: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Jason Brooks <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to