~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_dynrec.cc

  • Committer: Brian Aker
  • Date: 2010-08-11 17:06:22 UTC
  • mto: This revision was merged to the branch mainline in revision 1702.
  • Revision ID: brian@gaz-20100811170622-mu43l3tjk0kvmffw
Remove additional lock around mmap.

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
size_t mi_mmap_pread(MI_INFO *info, unsigned char *Buffer,
143
143
                    size_t Count, internal::my_off_t offset, myf MyFlags)
144
144
{
145
 
  if (info->s->concurrent_insert)
146
 
    pthread_rwlock_rdlock(&info->s->mmap_lock);
147
 
 
148
145
  /*
149
146
    The following test may fail in the following cases:
150
147
    - We failed to remap a memory area (fragmented memory?)
155
152
  if (info->s->mmaped_length >= offset + Count)
156
153
  {
157
154
    memcpy(Buffer, info->s->file_map + offset, Count);
158
 
    if (info->s->concurrent_insert)
159
 
      pthread_rwlock_unlock(&info->s->mmap_lock);
160
155
    return 0;
161
156
  }
162
157
  else
163
158
  {
164
 
    if (info->s->concurrent_insert)
165
 
      pthread_rwlock_unlock(&info->s->mmap_lock);
166
159
    return my_pread(info->dfile, Buffer, Count, offset, MyFlags);
167
160
  }
168
161
}
196
189
size_t mi_mmap_pwrite(MI_INFO *info, const unsigned char *Buffer,
197
190
                      size_t Count, internal::my_off_t offset, myf MyFlags)
198
191
{
199
 
  if (info->s->concurrent_insert)
200
 
    pthread_rwlock_rdlock(&info->s->mmap_lock);
201
192
 
202
193
  /*
203
194
    The following test may fail in the following cases:
209
200
  if (info->s->mmaped_length >= offset + Count)
210
201
  {
211
202
    memcpy(info->s->file_map + offset, Buffer, Count);
212
 
    if (info->s->concurrent_insert)
213
 
      pthread_rwlock_unlock(&info->s->mmap_lock);
214
203
    return 0;
215
204
  }
216
205
  else
217
206
  {
218
207
    info->s->nonmmaped_inserts++;
219
 
    if (info->s->concurrent_insert)
220
 
      pthread_rwlock_unlock(&info->s->mmap_lock);
221
208
    return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags);
222
209
  }
223
210