| 260 | } |
| 261 | |
| 262 | VOID |
| 263 | Ext2DropBH(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 | |
| 299 | VOID |
no test coverage detected