summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-06-11 23:45:00 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-06-11 23:45:00 -0600
commit515dfcbef2002aacf49b92aa16843eb8d7232db3 (patch)
tree6704c74785b67d5cdd2f91af18f51b4636e06644 /pkg
parent6fc5d416a289235dd4bb56d29fb96c5a003ea89f (diff)
more?
Diffstat (limited to 'pkg')
-rw-r--r--pkg/btrfs/io2_fs.go19
1 files changed, 2 insertions, 17 deletions
diff --git a/pkg/btrfs/io2_fs.go b/pkg/btrfs/io2_fs.go
index cb99d14..1a3a9df 100644
--- a/pkg/btrfs/io2_fs.go
+++ b/pkg/btrfs/io2_fs.go
@@ -150,9 +150,6 @@ type QualifiedPhysicalAddr struct {
Addr PhysicalAddr
}
-var Dbg = false
-var dbg2 = false
-
func (fs *FS) Resolve(laddr LogicalAddr) (paddrs map[QualifiedPhysicalAddr]struct{}, maxlen uint64) {
paddrs = make(map[QualifiedPhysicalAddr]struct{})
maxlen = math.MaxUint64
@@ -160,12 +157,7 @@ func (fs *FS) Resolve(laddr LogicalAddr) (paddrs map[QualifiedPhysicalAddr]struc
for _, chunk := range fs.chunks {
low := LogicalAddr(chunk.Key.Offset)
high := low + LogicalAddr(chunk.Chunk.Head.Size)
- match := low <= laddr && laddr < high
- if dbg2 {
- fmt.Printf("DBG: %v <= %v < %v : %v\n",
- low, laddr, high, match)
- }
- if match {
+ if low <= laddr && laddr < high {
offsetWithinChunk := uint64(laddr) - chunk.Key.Offset
maxlen = util.Min(maxlen, chunk.Chunk.Head.Size-offsetWithinChunk)
for _, stripe := range chunk.Chunk.Stripes {
@@ -176,11 +168,6 @@ func (fs *FS) Resolve(laddr LogicalAddr) (paddrs map[QualifiedPhysicalAddr]struc
}
}
}
- if Dbg && len(paddrs) == 0 {
- dbg2 = true
- fs.Resolve(laddr)
- panic(fmt.Errorf("could not resolve %v", laddr))
- }
return paddrs, maxlen
}
@@ -200,9 +187,7 @@ func (fs *FS) ReadAt(dat []byte, laddr LogicalAddr) (int, error) {
func (fs *FS) maybeShortReadAt(dat []byte, laddr LogicalAddr) (int, error) {
paddrs, maxlen := fs.Resolve(laddr)
if len(paddrs) == 0 {
- err := fmt.Errorf("read: could not map logical address %v", laddr)
- panic(err)
- //return 0, err
+ return 0, fmt.Errorf("read: could not map logical address %v", laddr)
}
if uint64(len(dat)) > maxlen {
dat = dat[:maxlen]