MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2DropBH

Function Ext2DropBH

Ext4Fsd/ext3/generic.c:262–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262VOID
263Ext2DropBH(IN PEXT2_VCB Vcb)
264{
265 struct ext4_sb_info *sbi = &Vcb->sbi;
266
267 /* do nothing if Vcb is not initialized yet */
268 if (!IsFlagOn(Vcb->Flags, VCB_INITIALIZED))
269 return;
270
271 __try {
272
273 /* acquire bd lock to avoid bh creation */
274 ExAcquireResourceExclusiveLite(&Vcb->bd.bd_bh_lock, TRUE);
275
276 SetFlag(Vcb->Flags, VCB_BEING_DROPPED);
277 Ext2DropGroupBH(Vcb);
278
279 while (!IsListEmpty(&Vcb->bd.bd_bh_free)) {
280 struct buffer_head *bh;
281 PLIST_ENTRY l;
282 l = RemoveHeadList(&Vcb->bd.bd_bh_free);
283 bh = CONTAINING_RECORD(l, struct buffer_head, b_link);
284 InitializeListHead(&bh->b_link);
285 if (0 == atomic_read(&bh->b_count)) {
286 buffer_head_remove(&Vcb->bd, bh);
287 free_buffer_head(bh);
288 }
289 }
290
291 } __finally {
292 ExReleaseResourceLite(&Vcb->bd.bd_bh_lock);
293 }
294
295 ClearFlag(Vcb->Flags, VCB_BEING_DROPPED);
296}
297
298
299VOID

Callers 3

Ext2PurgeVolumeFunction · 0.85
Ext2DestroyVcbFunction · 0.85
Ext2FlushVcbFunction · 0.85

Calls 3

Ext2DropGroupBHFunction · 0.85
buffer_head_removeFunction · 0.85
free_buffer_headFunction · 0.85

Tested by

no test coverage detected