From bcffffbc5e0a77316a4f5f8c19bb23eb59ca4cd9 Mon Sep 17 00:00:00 2001 From: "chris.lu@gmail.com" Date: Mon, 16 Jul 2012 04:33:21 +0000 Subject: [PATCH] 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 --- weed-fs/src/pkg/directory/volume_mapping.go | 4 ++-- 1 file 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)