2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 1996, 1997
5 * Sleepycat Software. All rights reserved.
10 static const char sccsid
[] = "@(#)mp_fset.c 10.10 (Sleepycat) 10/5/97";
13 #ifndef NO_SYSTEM_INCLUDES
14 #include <sys/types.h>
23 #include "common_ext.h"
27 * Mpool page set-flag routine.
30 memp_fset(dbmfp
, pgaddr
, flags
)
45 /* Validate arguments. */
47 if ((ret
= __db_fchk(dbmp
->dbenv
, "memp_fset", flags
,
48 DB_MPOOL_DIRTY
| DB_MPOOL_CLEAN
| DB_MPOOL_DISCARD
)) != 0)
50 if ((ret
= __db_fcchk(dbmp
->dbenv
, "memp_fset",
51 flags
, DB_MPOOL_CLEAN
, DB_MPOOL_DIRTY
)) != 0)
54 if (LF_ISSET(DB_MPOOL_DIRTY
) && F_ISSET(dbmfp
, MP_READONLY
)) {
56 "%s: dirty flag set for readonly file page",
62 /* Convert the page address to a buffer header. */
63 bhp
= (BH
*)((u_int8_t
*)pgaddr
- SSZA(BH
, buf
));
67 if (LF_ISSET(DB_MPOOL_CLEAN
) && F_ISSET(bhp
, BH_DIRTY
)) {
68 ++mp
->stat
.st_page_clean
;
69 --mp
->stat
.st_page_dirty
;
72 if (LF_ISSET(DB_MPOOL_DIRTY
) && !F_ISSET(bhp
, BH_DIRTY
)) {
73 --mp
->stat
.st_page_clean
;
74 ++mp
->stat
.st_page_dirty
;
77 if (LF_ISSET(DB_MPOOL_DISCARD
))
78 F_SET(bhp
, BH_DISCARD
);