Skip to content
Browse files

Add more verbose panic message.

  • Loading branch information...
1 parent eb0de18 commit 8023f107401b5cee58ae46572139b4ff4d6a81b0 @hanwen committed Jun 14, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 fs.go
View
11 fs.go
@@ -138,7 +138,7 @@ func (fs *DeviceFs) newFolder(id uint32, ds *DeviceStorage) *folderNode {
func (fs *DeviceFs) newFile(file *File, store *DeviceStorage) *fileNode {
if file.StorageId() != store.Id() {
- panic("storage mismatch.")
+ log.Panicf("storage mismatch file %s on %d, storage %d", file.Name(), file.StorageId(), store.Id())
}
n := &fileNode{
storage: store,
@@ -333,12 +333,15 @@ func (n *fileNode) fetch() error {
start := time.Now()
err = n.fs.dev.GetFileToFileDescriptor(n.id, f.Fd())
+ dt := time.Now().Sub(start)
if err == nil {
n.backing = f.Name()
+ log.Printf("fetched %q, %d bytes in %d ms. %.1f MB/s", n.file.Name(), sz,
+ dt.Nanoseconds()/1e6, 1e3*float64(sz)/float64(dt.Nanoseconds()))
+ } else {
+ log.Printf("error fetching: %v", err)
}
- dt := time.Now().Sub(start)
- log.Printf("fetched %q, %d bytes in %d ms. %.1f MB/s", n.file.Name(), sz,
- dt.Nanoseconds()/1e6, 1e3*float64(sz)/float64(dt.Nanoseconds()))
+
return err
}

0 comments on commit 8023f10

Please sign in to comment.
Something went wrong with that request. Please try again.