2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 1996, 1997, 1998
5 * Sleepycat Software. All rights reserved.
10 static const char sccsid
[] = "@(#)mp_fset.c 10.15 (Sleepycat) 4/26/98";
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
)
43 /* Validate arguments. */
45 return (__db_ferr(dbmp
->dbenv
, "memp_fset", 1));
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",
61 /* Convert the page address to a buffer header. */
62 bhp
= (BH
*)((u_int8_t
*)pgaddr
- SSZA(BH
, buf
));
66 if (LF_ISSET(DB_MPOOL_CLEAN
) && F_ISSET(bhp
, BH_DIRTY
)) {
67 ++mp
->stat
.st_page_clean
;
68 --mp
->stat
.st_page_dirty
;
71 if (LF_ISSET(DB_MPOOL_DIRTY
) && !F_ISSET(bhp
, BH_DIRTY
)) {
72 --mp
->stat
.st_page_clean
;
73 ++mp
->stat
.st_page_dirty
;
76 if (LF_ISSET(DB_MPOOL_DISCARD
))
77 F_SET(bhp
, BH_DISCARD
);