aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchris.lu@gmail.com <chris.lu@gmail.com@282b0af5-e82d-9cf1-ede4-77906d7719d0>2012-07-16 04:33:21 +0000
committerchris.lu@gmail.com <chris.lu@gmail.com@282b0af5-e82d-9cf1-ede4-77906d7719d0>2012-07-16 04:33:21 +0000
commitbcffffbc5e0a77316a4f5f8c19bb23eb59ca4cd9 (patch)
tree02c792f3e2cd94242a941c8bf26f357f3a63478c
parent68a216586f923f16fa8c780408dd355753bc7f06 (diff)
downloadseaweedfs-bcffffbc5e0a77316a4f5f8c19bb23eb59ca4cd9.tar.xz
seaweedfs-bcffffbc5e0a77316a4f5f8c19bb23eb59ca4cd9.zip
add capability to assign a batch of file ids
git-svn-id: https://weed-fs.googlecode.com/svn/trunk@51 282b0af5-e82d-9cf1-ede4-77906d7719d0
-rw-r--r--weed-fs/src/pkg/directory/volume_mapping.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/weed-fs/src/pkg/directory/volume_mapping.go b/weed-fs/src/pkg/directory/volume_mapping.go
index 947eb65e9..114f212e2 100644
--- a/weed-fs/src/pkg/directory/volume_mapping.go
+++ b/weed-fs/src/pkg/directory/volume_mapping.go
@@ -92,12 +92,12 @@ func (m *Mapper) NextFileId(c string) (uint64,int) {
}
count = 1
}
+ m.sequenceLock.Lock()
+ defer m.sequenceLock.Unlock()
if m.fileIdCounter < count {
- m.sequenceLock.Lock();
m.fileIdCounter = FileIdSaveInterval
m.FileIdSequence += FileIdSaveInterval
m.saveSequence()
- m.sequenceLock.Unlock();
}
m.fileIdCounter = m.fileIdCounter - count
return m.FileIdSequence - m.fileIdCounter, int(count)