ANU News Patch Patch ID: 930302_newsfiles.c!saul@hnrc.tufts.edu Date: 2-Mar-1993 Author: Saul Tannenbaum saul@hnrc.tufts.edu News Version: 6.1beta6 News Files: NewsFiles.C, NewsDelete.C Description: RMS optimizations to improve performance when accessing item and group files. *** newsfiles.c --- newsfiles_new.c ************** *** 25,27 **-- */ --- 25,29 ----- + ** V6.1 2-Mar-1993 saul@hnrc.tufts.edu + ** - RMS optimizations **-- */ ************** *** 69,74 i->r = cc$rms_rab; i->r.rab$l_fab = &(i->f); if (sys$open(&(i->f)) & 1) { if (sys$connect(&(i->r)) & 1) return(i); --- 71,80 ----- i->r = cc$rms_rab; i->r.rab$l_fab = &(i->f); + /* ST 2/2/93 - turn on multibuffering and read ahead */ + i -> r.rab$l_rop |= RAB$M_RAH; + i -> r.rab$b_mbf = 2; + if (sys$open(&(i->f)) & 1) { if (sys$connect(&(i->r)) & 1) return(i); ************** *** 123,128 i->r = cc$rms_rab; i->r.rab$l_fab = &(i->f); sysprv(); if (sys$create(&(i->f)) & 1) { if (sys$connect(&(i->r)) & 1) { --- 129,138 ----- i->r = cc$rms_rab; i->r.rab$l_fab = &(i->f); + /* ST 2/2/93 - turn on multibuffering and write behind */ + i -> r.rab$l_rop |= RAB$M_WBH; + i -> r.rab$b_mbf = 2; + sysprv(); if (sys$create(&(i->f)) & 1) { if (sys$connect(&(i->r)) & 1) { ************** *** 310,315 } } else { kid_valid = 0; if (init_lock()) exit(1); kid_valid = 1; --- 320,335 ----- } } else { + /* ST 2/2/93 RMS Performance Patch */ + int buff_count=0; + char *buff_count_ptr; + int item_performance = FALSE; + buff_count_ptr = getenv("ANU_NEWS_ITEMFILE_BUFFERCOUNT"); + if (buff_count_ptr != NULL) + { + sscanf(buff_count_ptr,"%d",&buff_count); + item_performance = TRUE; + } kid_valid = 0; if (init_lock()) exit(1); kid_valid = 1; ************** *** 319,324 itmfab.fab$l_fna = ITM_FILENAME; itmfab.fab$b_fns = strlen(itmfab.fab$l_fna); itmfab.fab$l_fop = FAB$M_CIF; itmfab.fab$w_mrs = sizeof newsitm; itmfab.fab$b_org = FAB$C_IDX; itmfab.fab$b_rat = FAB$M_CR; --- 339,352 ----- itmfab.fab$l_fna = ITM_FILENAME; itmfab.fab$b_fns = strlen(itmfab.fab$l_fna); itmfab.fab$l_fop = FAB$M_CIF; + + /* ST 2/2/93 if the buffer count logical was defined, turn on + a number of RMS performance features */ + if (item_performance) + { + itmfab.fab$l_fop |= FAB$M_DFW; /* deferred write */ + itmfab.fab$b_rtv = 255; /* map the entire file */ + } itmfab.fab$w_mrs = sizeof newsitm; itmfab.fab$b_org = FAB$C_IDX; itmfab.fab$b_rat = FAB$M_CR; ************** *** 356,361 itmrab.rab$l_rbf = (char *) &newsitm; itmrab.rab$w_rsz = sizeof newsitm; sysprv(); if (!((status = sys$open(&itmfab)) & 1)) { #ifndef V58_UPGRADE_MANUAL --- 384,393 ----- itmrab.rab$l_rbf = (char *) &newsitm; itmrab.rab$w_rsz = sizeof newsitm; + /* ST 3/2/93 - use up to 127 buffers for the item file */ + if (item_performance) + itmrab.rab$b_mbf = (buff_count <= 127) ? buff_count : 127; + sysprv(); if (!((status = sys$open(&itmfab)) & 1)) { #ifndef V58_UPGRADE_MANUAL ************** *** 390,395 nosysprv(); /* open the index newsgroup descriptor file for full access */ grpfab = cc$rms_fab; grpfab.fab$b_bks = 3; grpfab.fab$b_fac = FAB$M_GET | FAB$M_PUT | FAB$M_UPD | FAB$M_DEL ; --- 422,439 ----- nosysprv(); /* open the index newsgroup descriptor file for full access */ + /* ST 3/2/93 - RMS Performance Patches */ + { + int buff_count=0; + char *buff_count_ptr; + int group_performance = FALSE; + buff_count_ptr = getenv("ANU_NEWS_GROUPFILE_BUFFERCOUNT"); + if (buff_count_ptr != NULL) + { + sscanf(buff_count_ptr,"%d",&buff_count); + group_performance = TRUE; + } + grpfab = cc$rms_fab; grpfab.fab$b_bks = 3; grpfab.fab$b_fac = FAB$M_GET | FAB$M_PUT | FAB$M_UPD | FAB$M_DEL ; ************** *** 396,398 grpfab.fab$l_fna = GRP_FILENAME; grpfab.fab$b_fns = strlen(grpfab.fab$l_fna); grpfab.fab$l_fop = FAB$M_CIF; --- 440,450 ----- grpfab.fab$l_fna = GRP_FILENAME; grpfab.fab$b_fns = strlen(grpfab.fab$l_fna); grpfab.fab$l_fop = FAB$M_CIF; + + /* ST 3/2/93 if the buffer count logical was defined, turn on + a number of RMS performance features */ + if (group_performance) + { + grpfab.fab$l_fop |= FAB$M_DFW; /* deferred write */ + grpfab.fab$b_rtv = 255; /* map the entire file */ + } ************** *** 431,433 sysprv(); if (no_priv()) status = sys$open(&grpfab); --- 483,490 ----- + + /* ST 3/2/93 RMS Performance */ + if (group_performance) + grprab.rab$b_mbf = (buff_count <= 127) ? buff_count : 127; + } sysprv(); if (no_priv()) status = sys$open(&grpfab); *** newsdelete.c --- newsdelete_new.c ************** *** 16,18 **-- **/ --- 16,22 ----- + ** + ** Modification History: + ** V6.1 2-Mar-1993 saul@hnrc.tufts.edu + ** - RMS optimizations **-- **/ ************** *** 138,143 open_hist_file() { FILE *fpw; if (nntp_client) return(0); if (hist_off) return(0); --- 142,151 ----- open_hist_file() { FILE *fpw; + /* ST 3/2/93 - RMS Performance Options for History file access */ + int buff_count=0; + char *buff_count_ptr; + int hist_performance = FALSE; if (nntp_client) return(0); ************** *** 139,144 { FILE *fpw; if (nntp_client) return(0); if (hist_off) return(0); sysprv(); --- 147,153 ----- char *buff_count_ptr; int hist_performance = FALSE; + if (nntp_client) return(0); if (hist_off) return(0); sysprv(); ************** *** 158,163 histfab.fab$b_fns = strlen(histfab.fab$l_fna); histfab.fab$b_shr = FAB$M_SHRDEL | FAB$M_SHRGET | FAB$M_SHRPUT | FAB$M_SHRUPD; if (!(sys$open(&histfab) & 1)) { histfab.fab$b_bks = 4; histfab.fab$l_fop = FAB$M_CIF; --- 167,182 ----- histfab.fab$b_fns = strlen(histfab.fab$l_fna); histfab.fab$b_shr = FAB$M_SHRDEL | FAB$M_SHRGET | FAB$M_SHRPUT | FAB$M_SHRUPD; + /* ST 3/2/93 RMS Performance Patches */ + buff_count_ptr = getenv("ANU_NEWS_HISTORYFILE_BUFFERCOUNT"); + if (buff_count_ptr != NULL) + { + sscanf(buff_count_ptr,"%d",&buff_count); + hist_performance = TRUE; + histfab.fab$l_fop |= FAB$M_DFW; /* deferred write */ + histfab.fab$b_rtv = 255; /* map the entire file */ + } + if (!(sys$open(&histfab) & 1)) { histfab.fab$b_bks = 4; histfab.fab$l_fop = FAB$M_CIF; ************** *** 195,200 histrab.rab$w_usz = sizeof newshist; histrab.rab$l_rbf = (char *) &newshist; histrab.rab$w_rsz = sizeof newshist; if (!((status = sys$connect(&histrab)) & 1)) { sys$close(&histfab); --- 214,223 ----- histrab.rab$w_usz = sizeof newshist; histrab.rab$l_rbf = (char *) &newshist; histrab.rab$w_rsz = sizeof newshist; + + /* ST 3/2/93 RMS Performance Patches */ + if (hist_performance) + itmrab.rab$b_mbf = (buff_count <= 127) ? buff_count : 127; if (!((status = sys$connect(&histrab)) & 1)) { sys$close(&histfab); *** patchlist.h;-1 --- patchlist.h ************** *** 1,1 =+=+= End =+=+= --- 1,2 ----- + 930302_newsfiles.c!saul@hnrc.tufts.edu =+=+= End =+=+=