diff options
| author | chris.lu@gmail.com <chris.lu@gmail.com@282b0af5-e82d-9cf1-ede4-77906d7719d0> | 2012-07-16 04:33:21 +0000 |
|---|---|---|
| committer | chris.lu@gmail.com <chris.lu@gmail.com@282b0af5-e82d-9cf1-ede4-77906d7719d0> | 2012-07-16 04:33:21 +0000 |
| commit | bcffffbc5e0a77316a4f5f8c19bb23eb59ca4cd9 (patch) | |
| tree | 02c792f3e2cd94242a941c8bf26f357f3a63478c /weed-fs/src/pkg | |
| parent | 68a216586f923f16fa8c780408dd355753bc7f06 (diff) | |
| download | seaweedfs-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
Diffstat (limited to 'weed-fs/src/pkg')
| -rw-r--r-- | weed-fs/src/pkg/directory/volume_mapping.go | 4 |
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) |
