From c9dbb9c0fdfb0d411b937f83b97cc5612bebf1f8 Mon Sep 17 00:00:00 2001 From: Kenjiro Nakayama Date: Wed, 7 Dec 2016 22:56:58 +0900 Subject: [PATCH] file: tiny: output trace log before call writeToBlock --- file.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file.go b/file.go index f35f67f..3505434 100644 --- a/file.go +++ b/file.go @@ -177,8 +177,8 @@ func (f *File) WriteAt(b []byte, off int64) (n int, err error) { if frontlen > toWrite { frontlen = toWrite } - wrote, err := f.writeToBlock(blkIndex, int(blkOff), int(blkOff)+frontlen, b[:frontlen]) clog.Tracef("head writing block at index %d, inoderef %s", blkIndex, f.writeINodeRef) + wrote, err := f.writeToBlock(blkIndex, int(blkOff), int(blkOff)+frontlen, b[:frontlen]) if err != nil { return n, err } else if wrote != frontlen { @@ -232,10 +232,10 @@ func (f *File) WriteAt(b []byte, off int64) (n int, err error) { panic("Offset not equal to a block boundary after bulk") } blkIndex = int(off / f.blkSize) - wrote, err := f.writeToBlock(blkIndex, 0, toWrite, b) if clog.LevelAt(capnslog.TRACE) { clog.Tracef("tail writing block at index %d, inoderef %s", blkIndex, f.writeINodeRef) } + wrote, err := f.writeToBlock(blkIndex, 0, toWrite, b) if err != nil { promFileWrittenBytes.WithLabelValues(f.volume.Name).Add(float64(n)) return n, err