| 2810 | } |
| 2811 | |
| 2812 | NTSTATUS |
| 2813 | Ext2PurgeFile ( IN PEXT2_FCB Fcb, |
| 2814 | IN BOOLEAN FlushBeforePurge ) |
| 2815 | { |
| 2816 | IO_STATUS_BLOCK IoStatus; |
| 2817 | |
| 2818 | ASSERT(Fcb != NULL); |
| 2819 | |
| 2820 | ASSERT((Fcb->Identifier.Type == EXT2FCB) && |
| 2821 | (Fcb->Identifier.Size == sizeof(EXT2_FCB))); |
| 2822 | |
| 2823 | |
| 2824 | if (!IsVcbReadOnly(Fcb->Vcb) && FlushBeforePurge) { |
| 2825 | DEBUG(DL_INF, ( "Ext2PurgeFile: CcFlushCache on %wZ.\n", |
| 2826 | &Fcb->Mcb->FullName)); |
| 2827 | ExAcquireSharedStarveExclusive(&Fcb->PagingIoResource, TRUE); |
| 2828 | ExReleaseResourceLite(&Fcb->PagingIoResource); |
| 2829 | CcFlushCache(&Fcb->SectionObject, NULL, 0, &IoStatus); |
| 2830 | ClearFlag(Fcb->Flags, FCB_FILE_MODIFIED); |
| 2831 | } |
| 2832 | |
| 2833 | if (Fcb->SectionObject.ImageSectionObject) { |
| 2834 | DEBUG(DL_INF, ( "Ext2PurgeFile: MmFlushImageSection on %wZ.\n", |
| 2835 | &Fcb->Mcb->FullName)); |
| 2836 | MmFlushImageSection(&Fcb->SectionObject, MmFlushForWrite); |
| 2837 | } |
| 2838 | |
| 2839 | if (Fcb->SectionObject.DataSectionObject) { |
| 2840 | DEBUG(DL_INF, ( "Ext2PurgeFile: CcPurgeCacheSection on %wZ.\n", |
| 2841 | &Fcb->Mcb->FullName)); |
| 2842 | CcPurgeCacheSection(&Fcb->SectionObject, NULL, 0, FALSE); |
| 2843 | } |
| 2844 | |
| 2845 | return STATUS_SUCCESS; |
| 2846 | } |
| 2847 | |
| 2848 | |
| 2849 | NTSTATUS |