Doug, The HP-UX 11.11 version of vfs_vm.h is in the attachment. It will be great if you can coalesce all the HP-UX 11.* changes so that the same code compiles on any of our current releases. Thanks for taking the time to do it.
Regards, Carl > -----Original Message----- > From: Douglas E. Engert [mailto:[EMAIL PROTECTED] > Sent: Friday, February 28, 2003 2:27 PM > To: Derrick J Brashear > Cc: Srikanth Vishwanathan; [EMAIL PROTECTED]; > [EMAIL PROTECTED] > Subject: Progress with snapshot-02-28 on HP-UX 11.0, 11i and > ia64 11.22 > > > Carl, > I need the vfs_vm.h for the 11i. This was the header missing > for 11.0. It > looks like it is also missing from 11i. > > I now have three HP systems: a 11.0, a 11.11 and a 11.22 on which > I am building the openafs-snap-2003-02-28. (Derrick, thanks > for updating the CVS.) > > There are difference between the vfs_vm.h on 11.0 and 11.22 > versions, so I > am reluctant to just use the 11.0 version with 11i. > > Almost all the mods I originally made for 11.22 where > actually for features > introduced in 11.0. But the AFS 11.0 code had not been > updated to use these > new features but continued to use the depreciated routines. > The release of 11.22 > (and maybe 11i) forced the issue that these needed to be updated. > > So what I am doing now is changing many of the #if > defined(AFS_HPUX1122_ENV) > to use AFS_HPUX110_ENV or AFS_HPUX1111_ENV as needed so as to > use these same > features in 11., 11i and 11.22, thus making the code a > little cleaner, and > maybe more efficient. > > -- > > Douglas E. Engert <[EMAIL PROTECTED]> > Argonne National Laboratory > 9700 South Cass Avenue > Argonne, Illinois 60439 > (630) 252-5444 >
--- Begin Message --- Title: vfs_vm.h for 11.11/*
* BEGIN_DESC
*
* File:
* @(#) common/sys/vfs_vm.h $Revision: $
*
* Purpose:
* <<please update with a synopis of the functionality provided by this file>>
*
* Classification: Release to Release Consistency Req:
* <<please select one of the following:>>
* kernel subsystem private none
* kernel private none
* kernel 3rd party private limited source
* public binary & source
*
* BE header: no
*
* Shipped: no
*
* NOTE:
* This header file contains information specific to the internals
* of the HP-UX implementation. The contents of this header file
* are subject to change without notice. Such changes may affect
* source code, object code, or binary compatibility between
* releases of HP-UX. Code which uses the symbols contained within
* this header file is inherently non-portable (even between HP-UX
* implementations).
*
* END_DESC
*/
#ifndef _VFS_INCLUDED /* allows multiple inclusion */
#define _VFS_INCLUDED#include <sys/pregion.h>
/*
* max number of pages that vfs_pagein may bring in at a time
* max number of pages that vfs_pageout may write out at a time
*/
#define VFS_MAXPGIN 64
#define VFS_MAXPGOUT 16#define MAX_PGCNT_T MAXINT /* ?? this should live near pgcnt_t typedef */
#define BIG_OK_DBD MAX_PGCNT_Textern double idleness[];
extern double real_run[];
extern int deactive_cnt;
extern pgcnt_t max_pgrate;
extern int memory_sleepers;
extern pgcnt_t pageoutrate;
extern pgcnt_t kpageoutrate;
extern int prepage;
extern int vhandrunrate;
extern int waitio_proc_cnt;
extern int maxslp;
extern lock_t *swap_buf_list_lock;
extern pgcnt_t avefree;
extern pgcnt_t desfree;
extern pgcnt_t freemem;
extern pgcnt_t gpgslim;
extern pgcnt_t lotsfree;
extern int maxpageout;
extern pgcnt_t maxpendpageouts;
extern pgcnt_t mem_deficit;
extern pgcnt_t minsleepmem;
extern pgcnt_t minfree;
extern pgcnt_t pageoutcnt;
extern pgcnt_t kpageoutcnt;
extern pgcnt_t parolemem;
extern pgcnt_t stealvisited;
extern preg_t *stealhand;
extern b_sema_t vhandsema;
extern dev_t swapdev; /* swapping device */extern int unhash;
extern struct buf *bswalloc();
extern void pregtrunc();
extern void mtrunc();/*
* Gross stuff for NFS...
*
* NFS requires memory resources to perform a pageout. However, if
* vhand is trying to steal pages, we probably do not have memory
* available to page out NFS pages. To avoid a deadlock, we do the
* following for NFS (but only when called by vhand):
*
* . When paging out an NFS region, we conditionally reserve enough
* pages (NFS_PAGEOUT_MEM) to guarantee that the NFS will never
* have to sleep waiting for memory. This is essentially one page
* for every distinct size of memory that NFS needs (i.e. 1 page for
* 128 byte buffers, 1 page for 512 byte buffers, etc). If we
* cannot get the memory, we skip the dirty page and go on.
*
* . In pagein, we do not allow an NFS pagein to proceed until there
* is at least minumum number of free pages (2 * NFS_PAGEOUT_MEM).
* This guarantees that there will always be enough non-NFS pages
* to page out so that we can reserve enough pages to page out
* dirty NFS pages.
*/
#define NFS_PAGEOUT_MEM 7 /* empirically determined */
#define NFS_PAGEIN_MEM 14/*
* VM Pagein/Pageout Flags
*/
/* Parameters for calling VOP_PAGEOUT. */
#define PAGEOUT_HARD 0x01 /* Take all the pages you can, wait for locks */
#define PAGEOUT_FREE 0x02 /* Free the pages once the I/O is complete */
#define PAGEOUT_WAIT 0x04 /* Wait for the I/O to complete */
#define PAGEOUT_VHAND 0x08 /* Pageout request by vhand */
#define PAGEOUT_PURGE 0x20 /* purge pages from the page cache */
#define PAGEOUT_RESERVED 0x80/* Parameters for VOP_VM_COMMIT - Will be used for future V3 Patch */
#define COMMIT_NOWAIT 0x1
#define COMMIT_WAIT 0x2
#define COMMIT_NOW 0x4
#define COMMIT_INIT 0x8
#define COMMIT_DONE 0x10
#define COMMIT_FLAGS (COMMIT_NOWAIT | COMMIT_WAIT | COMMIT_NOW | \
COMMIT_INIT | COMMIT_DONE)#define VALID_COMMIT_FLAG(flag) (flag & COMMIT_FLAGS)
#define COMMIT_CLUSTER_SIZE 8 /* pages */
/*
* Pagein/Pageout Specific Flags.
*/
#define VM_NOWAIT 0x100 /* Can't sleep for resources. */
#define VM_INVALIDATE 0x200
#define VM_ERROR 0x400
#define VM_FREE_PAGE 0x800
#define VM_MLOCK 0x1000
#define VM_LARGEPAGE_IO 0x2000
#define VM_LARGEPAGE_RUN 0x4000
#define VM_IO_RUN 0x8000
#define PAGEOUT_NO_PHYSICAL 0x10000
#define VM_VFS_LGPG_FLAGS (VM_INVALIDATE | VM_ERROR | VM_FREE_PAGE | \
VM_MLOCK | VM_LARGEPAGE_IO | VM_LARGEPAGE_RUN)
#define VM_DEVSWAP_LGPG_FLAGS (VM_LARGEPAGE_RUN | VM_MLOCK | VM_ERROR | \
PAGEOUT_NO_PHYSICAL)typedef enum vm_freepage_ret {
PAGE_DIRTY,
PAGE_CLEAN
} vm_freepage_ret_t;typedef enum vm_fscheck_rets {
VM_SUCCESS,
VM_TERMINATE_RUN,
VM_NOT_INCLUDED,
VM_FS_ERROR
} vm_fscheck_rets_t;typedef enum vm_devswap_examine_ret {
FREE_PAGE,
DONT_TOUCH,
WRITE_PAGE
} vm_devswap_examine_ret_t;/*
* DETECT_HOLES is set by those file systems who can determine sparse access.
*/
#define DETECT_HOLES 0x1
#define DONT_BPURGE 0x2/*
* Set by NFS to inform upper layer a truncation on the object is necessary.
*/
#define PAGEOUT_TRUNCATE 0x2/*
* Defines used for read-ahead. ADJUST_SIZE causes the pagein size to adjust,
* while ADJUST_STRENGTH adjusts the pregion strength indicator.
*/
#define ADJUST_SIZE 0x1
#define ADJUST_STRENGTH 0x2/*
* The following defines are used for read-ahead I/O's.
*
* MULTI_CONVERT_THRESHOLD is the "p_strength" value when single to multi-page
* conversion takes place.
*
* PURELY_RANDOM and PURELY_SEQUENTIAL are "p_strength" indicators used by
* madvise() when the user specifies MADV_RANDOM or MADV_SEQUENTIAL. They
* also bound p_strength to that range.
*
*/
#define MULTI_CONVERT_THRESHOLD 15
#define PURELY_RANDOM -100
#define PURELY_SEQUENTIAL 100
#define DEFAULT_PAGEIN_SIZE 8/*
* Passed to read ahead process pages (ra_process_pages)
*/
#define DO_READ_AHEAD 0x1
#define DONT_DO_READ_AHEAD 0x2
#define HOLD_PAGE_LOCK 0x4/*
* Passed to VM truncation.
*/
#define VP_TRUNCATE 0x1
#define VP_INVALIDATE 0x2#define DBD_TYPE(vm_info) ((vm_info)->dbd->dbd_type)
#define DBD_DATA(vm_info) ((vm_info)->dbd->dbd_data)#define RESET_BUFCACHE_STEALSCAN(bufcache_preg) (bufcache_preg->p_stealscan = 1)
/*
* Returns "1" if the pageout routine should stop.
*/
#define VM_STOP_PAGING(vm_info) \
((((vm_info)->vm_flags & PAGEOUT_VHAND) && \
!((vm_info)->vm_flags & PAGEOUT_HARD) && \
parolemem >= maxpendpageouts) ? 1 : 0) \/*
*
* #define's for large pages.
*
*//*
* LGPG_ENABLE flag is passed to vm_pagein_init() by VOP_PAGEIN routines
* such as ufs_pagein() to indicate that they have been adapted for paging
* in a large page.
*/#define LGPG_ENABLE 0x01
#define LGPG_RETRY_MAX 8
/*
* Status of an instance of a large page during VOP_PAGEIN. These flags
* are set by various "vm_" routines in vfs_vm.c file. Also used by
* devswap_pagein(), a VOP_PAGEIN routine.
*/typedef enum lgpg_stat_flags {
LGPG_CLR_FLAGS = 0x00,
LGPG_TRY = 0x10,
LGPG_EXPAND_FAILED = 0x20,
LGPG_ALLOCATED = 0x40,
LGPG_ALLOC_FAILED = 0x80,
LGPG_CACHE_ERROR = 0x100
} lgpg_stat_flags_t;/*
* Reasons for terminating fault expansion. Returned by
* expand_faultin_up() and expand_faultin_down().
*/typedef enum expnd_flags {
CLR_FLAGS = 0x00,
PAGELIMIT = 0x01,
NONCONTIGUOUS_BLOCK = 0x02,
VM_REASONS = 0x04
} expnd_flags_t;
typedef enum vmpgin_return_values {
VM_NONE = 0,
VM_DONE = 1,
VM_PAGE_PRESENT = 2,
VM_RETRY = 3
} retval_t;/*
* Flags passed to vm_expand_ok().
*/#define MIN_PAGE 0x100
#define MAX_PAGE 0x200/*
* The following macros VM_SET_FS_MAX_PAGES and VM_SET_FS_MIN_PAGES are
* called by VOP_PAGEIN routines to specify the maximum-pages (for each
* IO) allowed and the minimum_pages desired (for each IO) respectively.
*/#define VM_SET_FS_MAX_PAGES(vm_info, max) { \
vm_info->fs_maxpages = max; \
}#define VM_SET_FS_MIN_PAGES(vm_info, min) { \
vm_info->fs_minpages = min; \
}/*
* Called by VOP_PAGEIN routines to determine if multiple IO ranges need
* to be setup. Multiple IO may be needed for paging in a large page.
*/#define VM_GET_IO_INFO(vm_info, maxpagein, max_io){ \
maxpagein = vm_info->maxpagein; \
if (vm_info->vm_pgin_flags & LGPG_TRY) { \
max_io = vm_info->max_num_io; \
} else { \
max_io = 1; \
} \
}/*
* Called by VOP_PAGEIN routines to communicate that multiple IO
* cannot be set up.
*/#define VM_MULT_IO_FAILURE(vm_info) { \
vm_info->vm_pgin_flags &= ~LGPG_TRY; \
vm_info->vm_pgin_flags |= LGPG_EXPAND_FAILED; \
vm_info->num_io = 1; \
}/*
* Disallow read-ahead for large pages.
* In the future, we may want to allow read-aheads for low-end large
* pages such as 8K (tahoe) and 16K.
*/#define VM_READ_AHEAD_ALLOWED(vm_info) \
(((vm_info->vm_pgin_flags & LGPG_TRY) || \
(vm_info->vm_pgin_flags & LGPG_ALLOCATED) || \
(vm_info->vm_pgin_flags & LGPG_CACHE_ERROR)) ? 0 : 1)/*
* Called by VOP_PAGEIN routines to refresh the vfd and dbd, when
* there is a chance they might have changed, for instance, when region
* lock was released and re-acquired.
*/#define VM_REINIT_FAULT_DBDVFD(vm_info) \
FINDENTRY(vm_info->prp->p_reg, vm_info->fault_index, \
&(vm_info->vfd), &(vm_info->dbd));/*
* Structure to hold page-io information for page-in involving multiple
* IO. Added for paging-in a large page. Maximum number of IO allowed
* by default is LGPG_FSTORE_MAX_IO (= 512) as defined below. In the current
* implementation, a global "short lgpg_fstore_max_io" is being set to
* LGPG_FSTORE_MAX_IO and this variable serves as a hook through which
* it is possible to change the maximum number of I/O's allowed. An array
* of this page-io structure is MALLOC'ed and a pointer to this array is
* placed in "struct vfspage" (vm_info).
*/typedef struct {
daddr_t start_blk;
pgcnt_t count;
pgcnt_t startindex;
struct buf *bp;
int error;
} pagein_info_t;#define LGPG_FSTORE_MAX_IO 512
/*
* Pageout data structure used when "multiple" I/O's are required to write out
* a single large page. Note, "io_cnt" is different from vminfo->piocnt in
* that piocnt tracks the number distinct pageouts over a range and io_cnt is
* the number of I/O's to complete one distinct pageout.
*/
struct b_lgpg_io {
int io_cnt; /* Count of I/O's for a "single" large page.
When == 0, finished. */
int io_flags; /* Flags(see below) */
caddr_t io_addr; /* Starting address of I/O */
pgcnt_t io_pages; /* Length of I/O */
};/*
* Flags for io_flags
*/
#define LGPG_IO_SLEEP 0x1/*
* Pageout data structure used to hold the block/length information when
* multiple I/O's are required for a large page.
*/
typedef struct pageout_info {
pgcnt_t start; /* start of an i/o in a largepage */
daddr_t blkno; /* block number of the i/o */
int cnt_bytes; /* Count of number of 4k i/o's in a largepage */
} pageout_info_t;/*
* Artifical maximum on the number of I/O's we are willing to do for a large
* page pageout.
*/
#define PAGEOUT_IO_MAX 1/*
* The following macros are used by Pagein/Pageout routines to inform, query or
* modify information in the VM system. The purpose of the macros is to remove
* all references to VM data structures from file system dependent pagein
* routines.
*/
#define VM_CLEAR_PAGEOUT_RUN(vm_info) ((vm_info)->run = 0)
#define VM_BASE_OFFSET(vm_info) ((vm_info)->prp->p_off)
#define VM_START_PAGEOUT_INDX(vm_info) ((vm_info)->start)
#define VM_END_PAGEOUT_INDX(vm_info) ((vm_info)->end)
#define VM_START_PAGEOUT_BLK(vm_info) ((vm_info)->dbd_start.dbd_data)
#define VM_END_PAGEOUT_BLK(vm_info) ((vm_info)->dbd_end.dbd_data)
#define VM_NO_PAGEOUT_RUN(vm_info) ((vm_info)->run ? 0 : 1 )
#define VM_MEM_RESERVED(vm_info) ((vm_info)->vm_mem_reserved)
#define VM_SHARED_OBJECT(vm_info) ((vm_info)->shared)
#define VM_MAPPED_SPACE(vm_info) ((vm_info)->space)
#define VM_MAPPED_ADDR(vm_info) ((vm_info)->mapped_vaddr)
#define VM_MEMORY_RESERVED(vm_info) ((vm_info)->memreserved)
#define VM_IS_ZOMBIE(vm_info) ((vm_info)->prp->p_reg->r_zomb)
#define VM_PAGE_VALID(vm_info) ((vm_info)->vfd->pgm.pg_v)
#define VM_FILE_OFFSET(vm_info) ((vm_info)->prp->p_reg->r_off)
#define VM_SETFS_FLAGS(vm_info, flag) ((vm_info)->fs_flags |= flag)
#define VM_UNSETFS_FLAGS(vm_info, flag) ((vm_info)->fs_flags &= ~flag)
#define VM_FS_FLAGS(vm_info) ((vm_info)->fs_flags)
#define VM_ZOMBIE_OBJECT(vm_info) ((vm_info)->prp->p_reg->r_zomb = 1)
#define VM_SET_CACHE_LIMIT(vm_info,limit) ((vm_info)->dbd_limit = limit)
#define VM_SET_STARTINDX(vm_info,start) ((vm_info)->startindex = start)
#define VM_GET_STARTINDX(vm_info) ((vm_info)->startindex)/*
* The following macros are used to set and get values of the fields in
* page-io information structure [see pagein_info_t].
* VM_SET_IO_STARTINDX VM_GET_IO_STARTINDX
* VM_SET_IO_COUNT VM_GET_IO_COUNT
* VM_SET_IO_STARTBLK VM_GET_IO_STARTBLK
* VM_SET_IO_BP VM_GET_IO_BP
* VM_SET_IO_ERROR VM_GET_IO_ERROR
*/#define VM_SET_IO_STARTINDX(vm_info, indx, start) \
((vm_info)->io[indx].startindex = start)
#define VM_GET_IO_STARTINDX(vm_info, indx) \
((vm_info)->io[indx].startindex)#define VM_SET_IO_COUNT(vm_info, indx, cnt) \
((vm_info)->io[indx].count = cnt)
#define VM_GET_IO_COUNT(vm_info, indx) \
((vm_info)->io[indx].count)#define VM_SET_IO_STARTBLK(vm_info, indx, block) \
((vm_info)->io[indx].start_blk = block)
#define VM_GET_IO_STARTBLK(vm_info, indx) \
((vm_info)->io[indx].start_blk)#define VM_SET_IO_BP(vm_info, indx, bswp) \
((vm_info)->io[indx].bp = bswp)
#define VM_GET_IO_BP(vm_info, indx) \
((vm_info)->io[indx].bp)#define VM_SET_IO_ERROR(vm_info, indx, ioerr) \
((vm_info)->io[indx].error = ioerr)
#define VM_GET_IO_ERROR(vm_info, indx) \
((vm_info)->io[indx].error)#define VM_REGION(vm_info) ((vm_info)->prp->p_reg)
#define VM_REGION_SIZE(vm_info) ((vm_info)->prp->p_reg->r_pgsz)
#define VM_IS_MMAP(vm_info) ((vm_info)->prp->p_type == PT_MMAP)
#define VM_PAGEOUT_NOWAIT(vm_info) ((vm_info)->vm_flags & PAGEOUT_VHAND)
#define VM_SET_ERROR(vm_info, error) ((vm_info)->error = error)
#define VM_CLEAR_ERROR(vm_info) ((vm_info)->error = 0)
#define VM_GET_PAGEIN_VNODE(vm_info) ((vm_info)->vp)
#define VM_GET_PAGEOUT_VNODE(vm_info) ((vm_info)->vp)
#define VM_CACHE_LIMIT(vm_info) ((vm_info)->dbd_limit)
#define VM_PAGEIN_INFO(vm_info) ((vm_info)->io)
#define VM_PRP(vm_info) ((vm_info)->prp)
#define VM_ADDR(vm_info) ((vm_info)->vaddr)
#define VM_WRT(vm_info) ((vm_info)->wrt)
#define VM_SPACE(vm_info) ((vm_info)->space)
#define VM_GET_NUM_IO(vm_info) ((vm_info)->num_io)
#define VM_SET_NUM_IO(vm_info, count) ((vm_info)->num_io = count)
#define VM_PAGEOUT_INFO(vm_info, num_io, io_start, io_blkno, io_bytes) \
(io_start) = (vm_info)->io_array[num_io].start; \
(io_blkno) = (vm_info)->io_array[num_io].blkno; \
(io_bytes) = (vm_info)->io_array[num_io].cnt_bytes;/*
* Used by NFS to transmit information from VM back to the FS layer.
*/
typedef struct {
k_off_t isize; /* file size */
u_int bsize; /* file system block size */
int remote; /* the file is remote (DUX, NFS) */
int remote_down; /* is the remote system down now? */
} fsdata_t;/*
* The global VM pagein/pageout structure. It houses everything for the sparse
* walker as well as information needed to communicate with the VM services
* found in vfs_vm.c
*/
typedef struct vfspage {
preg_t *prp; /* The pregion for the pagein/pageout. */
struct vnode *vp; /* file vnode pointer for the pagein/pageout. */
struct vnode *cache_vp;/* file vnode pointer for the pagein/pageout. */
pgcnt_t maxpgs; /* maximum length a run(pageout) can be */
dbd_t dbd_start; /* dbd for start of a pageout. */
dbd_t dbd_end; /* dbd for end of a pageout. */
dbd_t cur_dbd; /* The current dbd for the "current"(pageout) index. */
pgcnt_t start; /* start of a run(pageout) */
pgcnt_t end; /* end of a run(pageout) */
int run; /* a run has been detected(pageout) */
caddr_t fs_data; /* A pointer used for any specific fs data needed. */
space_t space; /* The faulting space for a pagein. */
caddr_t vaddr; /* The starting addr for a pagein. */
caddr_t mapped_vaddr; /* The faulting addr for a pagein/out. */
pgcnt_t dbd_limit; /* one past the last dbd that we can trust */
int *piocnt; /* An integer pointer used with PAGEOUT_WAIT. */
dbd_t *dbd; /* The dbd for a pagein fault. */
vfd_t *vfd; /* The vfd for a pagein fault. */
pgcnt_t fault_index; /* The index where the pagein fault occurred. */
pgcnt_t startindex; /* The starting page index for a faulting range. */
int steal_flag; /* Set to 1 if the PAGEOUT_STEAL is set. */
int vm_flags; /* The vm flags passed to pageout. */
int fs_flags; /* The FS flags used for a pagein. */
int wrt; /* Set to one if the page fault(pagein) was a write. */
pgcnt_t memreserved; /* Amount of memory reserved for pagein/pageout. */
int shared; /* Are the region fstore and bstore equal? */
int error; /* Error value set by lower routine. */
physpfn_t *pfn; /* Page frame array for pagein's only. */
pagein_info_t *io; /* information on each IO for page-in */
lgpg_stat_flags_t vm_pgin_flags; /* large page status flags */
short num_io; /* number of IO's for paging-in/out a large page */
short max_num_io; /* max number of I/O for paging-in/out a large page*/
pgcnt_t maxpagein; /* maximum number 4K pages to be paged-in */
pgcnt_t fs_minpages;/* min number of pagein pages specified by filesys */
pgcnt_t fs_maxpages;/* max number of pagein pages allowed by filesys */
pgcnt_t lgpg_minpage;/* lower region index of a large page */
pgcnt_t lgpg_maxpage;/* upper region index of a large page */
struct b_lgpg_io *lgpg_io; /* If not NULL, points to pageout multi-I/O
data structure. */
pageout_info_t io_array[PAGEOUT_IO_MAX]; /* pageout array. Size is 1
until MMF's supported. */
pgcnt_t pgout_start;/* Where the initial pageout started. */
pgcnt_t pgout_end; /* Where the initial pageout ended. */
int pgbits; /* ref/mod bits for the current pageout. */
} vfspage_t;
#define _VFSPAGE_T#endif /* _VFS_INCLUDED */
--- End Message ---
