ReactOS  0.4.15-dev-494-g1d8c567
cache.c File Reference
#include "btrfs_drv.h"
Include dependency graph for cache.c:

Go to the source code of this file.

Functions

static BOOLEAN __stdcall acquire_for_lazy_write (PVOID Context, BOOLEAN Wait)
 
static void __stdcall release_from_lazy_write (PVOID Context)
 
static BOOLEAN __stdcall acquire_for_read_ahead (PVOID Context, BOOLEAN Wait)
 
static void __stdcall release_from_read_ahead (PVOID Context)
 
void init_cache ()
 

Variables

CACHE_MANAGER_CALLBACKS cache_callbacks
 

Function Documentation

◆ acquire_for_lazy_write()

static BOOLEAN __stdcall acquire_for_lazy_write ( PVOID  Context,
BOOLEAN  Wait 
)
static

Definition at line 22 of file cache.c.

22  {
24  fcb* fcb = FileObject->FsContext;
25 
26  TRACE("(%p, %u)\n", Context, Wait);
27 
28  if (!ExAcquireResourceSharedLite(&fcb->Vcb->tree_lock, Wait))
29  return false;
30 
31  if (!ExAcquireResourceExclusiveLite(fcb->Header.Resource, Wait)) {
32  ExReleaseResourceLite(&fcb->Vcb->tree_lock);
33  return false;
34  }
35 
37 
39 
40  return true;
41 }
PKTHREAD lazy_writer_thread
Definition: btrfs_drv.h:307
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
FSRTL_ADVANCED_FCB_HEADER Header
Definition: btrfs_drv.h:294
#define TRACE(s)
Definition: solgame.cpp:4
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
* PFILE_OBJECT
Definition: iotypes.h:1957
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
struct tagContext Context
Definition: acpixf.h:1034
#define KeGetCurrentThread
Definition: hal.h:44
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
struct _device_extension * Vcb
Definition: btrfs_drv.h:298
IN BOOLEAN Wait
Definition: fatprocs.h:1538

Referenced by init_cache().

◆ acquire_for_read_ahead()

static BOOLEAN __stdcall acquire_for_read_ahead ( PVOID  Context,
BOOLEAN  Wait 
)
static

Definition at line 59 of file cache.c.

59  {
61  fcb* fcb = FileObject->FsContext;
62 
63  TRACE("(%p, %u)\n", Context, Wait);
64 
65  if (!ExAcquireResourceSharedLite(fcb->Header.Resource, Wait))
66  return false;
67 
69 
70  return true;
71 }
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
FSRTL_ADVANCED_FCB_HEADER Header
Definition: btrfs_drv.h:294
#define TRACE(s)
Definition: solgame.cpp:4
* PFILE_OBJECT
Definition: iotypes.h:1957
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
struct tagContext Context
Definition: acpixf.h:1034
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
IN BOOLEAN Wait
Definition: fatprocs.h:1538

Referenced by init_cache().

◆ init_cache()

void init_cache ( )

Definition at line 85 of file cache.c.

85  {
90 }
static void __stdcall release_from_lazy_write(PVOID Context)
Definition: cache.c:43
static BOOLEAN __stdcall acquire_for_lazy_write(PVOID Context, BOOLEAN Wait)
Definition: cache.c:22
CACHE_MANAGER_CALLBACKS cache_callbacks
Definition: cache.c:20
static BOOLEAN __stdcall acquire_for_read_ahead(PVOID Context, BOOLEAN Wait)
Definition: cache.c:59
PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite
Definition: cctypes.h:39
PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead
Definition: cctypes.h:41
static void __stdcall release_from_read_ahead(PVOID Context)
Definition: cache.c:73
PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead
Definition: cctypes.h:42
PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite
Definition: cctypes.h:40

Referenced by _Function_class_().

◆ release_from_lazy_write()

static void __stdcall release_from_lazy_write ( PVOID  Context)
static

Definition at line 43 of file cache.c.

43  {
45  fcb* fcb = FileObject->FsContext;
46 
47  TRACE("(%p)\n", Context);
48 
50 
51  ExReleaseResourceLite(fcb->Header.Resource);
52 
53  ExReleaseResourceLite(&fcb->Vcb->tree_lock);
54 
57 }
PKTHREAD lazy_writer_thread
Definition: btrfs_drv.h:307
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
FSRTL_ADVANCED_FCB_HEADER Header
Definition: btrfs_drv.h:294
#define TRACE(s)
Definition: solgame.cpp:4
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
* PFILE_OBJECT
Definition: iotypes.h:1957
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
struct tagContext Context
Definition: acpixf.h:1034
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
struct _device_extension * Vcb
Definition: btrfs_drv.h:298

Referenced by init_cache().

◆ release_from_read_ahead()

static void __stdcall release_from_read_ahead ( PVOID  Context)
static

Definition at line 73 of file cache.c.

73  {
75  fcb* fcb = FileObject->FsContext;
76 
77  TRACE("(%p)\n", Context);
78 
79  ExReleaseResourceLite(fcb->Header.Resource);
80 
83 }
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
FSRTL_ADVANCED_FCB_HEADER Header
Definition: btrfs_drv.h:294
#define TRACE(s)
Definition: solgame.cpp:4
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
* PFILE_OBJECT
Definition: iotypes.h:1957
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
struct tagContext Context
Definition: acpixf.h:1034
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60

Referenced by init_cache().

Variable Documentation

◆ cache_callbacks

CACHE_MANAGER_CALLBACKS cache_callbacks

Definition at line 20 of file cache.c.

Referenced by init_cache(), init_file_cache(), and mount_vol().