示例#1
0
void
shutdown_osinet(void)
{
    AFS_STATCNT(shutdown_osinet);
#ifndef AFS_PRIVATE_OSI_ALLOCSPACES
    if (afs_cold_shutdown) {
	struct osi_packet *tp;

	while ((tp = freePacketList)) {
	    freePacketList = tp->next;
	    afs_osi_Free(tp, AFS_LRALLOCSIZ);
#ifdef  KERNEL_HAVE_PIN
	    unpin(tp, AFS_LRALLOCSIZ);
#endif
	}

	while ((tp = freeSmallList)) {
	    freeSmallList = tp->next;
	    afs_osi_Free(tp, AFS_SMALLOCSIZ);
#ifdef  KERNEL_HAVE_PIN
	    unpin(tp, AFS_SMALLOCSIZ);
#endif
	}
	LOCK_INIT(&osi_fsplock, "osi_fsplock");
	LOCK_INIT(&osi_flplock, "osi_flplock");
    }
#endif /* AFS_PRIVATE_OSI_ALLOCSPACES */
    if (afs_stats_cmperf.LargeBlocksActive ||
	afs_stats_cmperf.SmallBlocksActive)
    {
	afs_warn("WARNING: not all blocks freed: large %d small %d\n",
		 afs_stats_cmperf.LargeBlocksActive,
		 afs_stats_cmperf.SmallBlocksActive);
    }
}
示例#2
0
int append_record ( record r, schema_p s )
{
  tbl_p tbl = s->tbl;
  page_p pg = get_page_for_append ( s->name );
  if (pg == NULL)
    {
      put_msg (FATAL, "Failed to get page for appending to \"%s\".\n",
	       s->name);
      exit (EXIT_FAILURE);
    }
  if ( put_page_record (pg, r, s) == -1 )
    {
      /* not enough space in the current page */
      unpin (pg);
      pg = get_next_page ( pg );
      if (pg == NULL)
	{
	  put_msg (FATAL, "Failed to get page for \"%s\" block %d.\n",
		   s->name, page_block_nr(pg) + 1);
	  exit (EXIT_FAILURE);
	}
      if ( put_page_record (pg, r, s) == -1 )
	{
	  put_msg (FATAL, "Failed to put record to page for \"%s\" block %d.\n",
		   s->name, page_block_nr(pg) + 1);
	  exit (EXIT_FAILURE);
	}
    }
  tbl->current_pg = pg;
  tbl->num_records++;
  return 0;
}
示例#3
0
static bool_t
xdrrx_putbytes(XDR *axdrs, caddr_t addr, u_int len)
{
    afs_int32 code;
    XDR * xdrs = (XDR *)axdrs;
    struct rx_call *call = ((struct rx_call *)(xdrs)->x_private);
#if	defined(KERNEL) && defined(AFS_AIX32_ENV)
    char *saddr = (char *)&code;
    saddr -= STACK_TO_PIN;
    /*
     * Hack of hacks: Aix3.2 only guarantees that the next 2K of stack in pinned. Under
     * splnet (disables interrupts), which is set throughout rx, we can't swap in stack
     * pages if we need so we panic. Since sometimes, under splnet, we'll use more than
     * 2K stack we could try to bring the next few stack pages in here before we call the rx
     * layer. Of course this doesn't guarantee that those stack pages won't be swapped
     * out between here and calling splnet. So we now pin (and unpin) them instead to
     * guarantee that they remain there.
     */
    if (pin(saddr, STACK_TO_PIN)) {
	/* XXX There's little we can do by continue XXX */
	saddr = NULL;
	rx_pin_failed++;
    }
#endif
    code = (rx_Write(call, addr, len) == len);
#if	defined(KERNEL) && defined(AFS_AIX32_ENV)
    if (saddr)
	unpin(saddr, STACK_TO_PIN);
#endif
    return code;
}
示例#4
0
void
shutdown_daemons(void)
{
    AFS_STATCNT(shutdown_daemons);
    if (afs_cold_shutdown) {
	afs_brsDaemons = brsInit = 0;
	rxepoch_checked = afs_nbrs = 0;
	memset(afs_brs, 0, sizeof(afs_brs));
	memset(&afs_xbrs, 0, sizeof(afs_lock_t));
	afs_brsWaiters = 0;
#ifdef AFS_AIX41_ENV
	lock_free(&afs_asyncbuf_lock);
	unpin(&afs_asyncbuf, sizeof(struct buf *));
	unpin(&afs_asyncbuf_cv, sizeof(afs_int32));
	afs_initbiod = 0;
#endif
    }
}
示例#5
0
void test_page_read_with_offset (  const char *fname )
{
  put_msg (INFO, "test_page_read_with_offset() ...\n");
  pager_init ();
  /* put_pager_info (DEBUG, "After pager_init"); */
	
  page_p pg;
  int int_out;
  char str_out[14];

  int bnr;
  for (bnr = 0; bnr < NUM_BLOCKS_IN_FILE; bnr++)
    {
      pg = get_page ( fname, bnr );
      if ( pg == NULL)
	{
	  put_msg (FATAL, "get_page %d fails\n", bnr);
	  put_pager_info (FATAL, "After get_page");
	  exit (EXIT_FAILURE);
	}

      /* put_pager_info (DEBUG, "After get_page"); */

      int i = 0;
      while (!eob(pg))
	{
	  int offset = PAGE_HEADER_SIZE + i*(INT_SIZE + str_len);
	  int_out = page_get_int_at(pg, offset);
	  if ( int_out != ints_in[i] + bnr )
	    {
	      put_msg (FATAL,
		       "test_page_read fails: (read: %d, should be %d)\n",
		       int_out, ints_in[i] + bnr);
	      put_pager_info (FATAL, "After page_get_int_at");
	      exit (EXIT_FAILURE);
	    }
	  offset += INT_SIZE;
	  page_get_str_at (pg, offset, str_out, str_len);
	  if ( strcmp (str_out, strs_in[i]) != 0 )
	    {
	      put_msg (FATAL,
		       "test_page_read fails: (read: \"%s\", should be \"%s\")\n",
		       str_out, strs_in[i] + bnr);
	      put_pager_info (FATAL, "After page_get_str_at");
	      exit (EXIT_FAILURE);
	    }
	  i++;
	}
      unpin (pg);
    }

  put_pager_profiler_info (INFO);
  pager_terminate ();
  /* put_pager_info (DEBUG, "After pager_terminate"); */
  put_msg (INFO, "test_page_read_with_offset() succeeds.\n");
}
示例#6
0
/* Call for unpin 'a' (if not NULL), and pin 'b' (if not NULL).  Although
 * buffers to unpin are just pushed to the unpin fifo so that the
 * caller can defer unpin until vblank.
 *
 * Note if this fails (ie. something went very wrong!), all buffers are
 * unpinned, and the caller disables the overlay.  We could have tried
 * to revert back to the previous set of pinned buffers but if things are
 * hosed there is no guarantee that would succeed.
 */
int omap_framebuffer_replace(struct drm_framebuffer *a,
		struct drm_framebuffer *b, void *arg,
		void (*unpin)(void *arg, struct drm_gem_object *bo))
{
	int ret = 0, i, na, nb;
	struct omap_framebuffer *ofba = to_omap_framebuffer(a);
	struct omap_framebuffer *ofbb = to_omap_framebuffer(b);
	uint32_t pinned_mask = 0;

	na = a ? drm_format_num_planes(a->pixel_format) : 0;
	nb = b ? drm_format_num_planes(b->pixel_format) : 0;

	for (i = 0; i < max(na, nb); i++) {
		struct plane *pa, *pb;

		pa = (i < na) ? &ofba->planes[i] : NULL;
		pb = (i < nb) ? &ofbb->planes[i] : NULL;

		if (pa)
			unpin(arg, pa->bo);

		if (pb && !ret) {
			ret = omap_gem_get_paddr(pb->bo, &pb->paddr, true);
			if (!ret) {
				omap_gem_dma_sync(pb->bo, DMA_TO_DEVICE);
				pinned_mask |= (1 << i);
			}
		}
	}

	if (ret) {
		/* something went wrong.. unpin what has been pinned */
		for (i = 0; i < nb; i++) {
			if (pinned_mask & (1 << i)) {
				struct plane *pb = &ofba->planes[i];
				unpin(arg, pb->bo);
			}
		}
	}

	return ret;
}
示例#7
0
void test_page_write (  const char *fname )
{
  put_msg (INFO, "test_page_write() ...\n");
  pager_init ();
  /* put_pager_info (DEBUG, "After pager_init"); */
	
  page_p pg;
  int bnr;
  for (bnr = 0; bnr < NUM_BLOCKS_IN_FILE; bnr++)
    {
      pg = get_page ( fname, bnr );
      /* alternatively, append. But beware that the file grows
	 with every run of the test
	 pg = get_page_for_append ( fname );
      */
      if ( pg == NULL)
	{
	  put_msg (FATAL, "get_page %d fails\n", bnr);
	  put_pager_info (FATAL, "After get_page");
	  exit (EXIT_FAILURE);
	}

      /* put_pager_info (DEBUG, "After get_page"); */

      int i;
      for (i=0; i<NUM_RECORDS_IN_BLOCK; i++)
	{
	  page_put_int(pg, ints_in[i] + bnr);
	  page_put_str(pg, strs_in[i], str_len);
	  /* put_pager_info (DEBUG, "After writing a record"); */
	}

      /* put_pager_info (DEBUG, "Before write_page"); */
      write_page (pg);
      unpin (pg);
      /* put_pager_info (DEBUG, "After unpin"); */
    }

  put_pager_profiler_info (INFO);	
  pager_terminate ();
  /* put_pager_info (DEBUG, "After pager_terminate"); */
  put_msg (INFO, "test_page_write() done.\n");
}
示例#8
0
static page_p get_page_for_next_record ( schema_p s )
{
  page_p pg = s->tbl->current_pg;
  if (eof(pg)) return NULL;
  if (eob(pg))
    {
      unpin (pg);
      pg = get_next_page (pg);
      if ( pg == NULL)
	{
	  put_msg (FATAL, "get_page_for_next_record failed at block %d\n",
		   page_block_nr(pg) + 1);
	  exit (EXIT_FAILURE);
	}
      page_set_pos_begin (pg);
      s->tbl->current_pg = pg;
    }
  return pg;
}
示例#9
0
void test_page_write_with_offset (  const char *fname )
{
  put_msg (INFO, "test_page_write_with_offset() ...\n");
  pager_init ();
  /* put_pager_info (DEBUG, "After pager_init"); */
	
  page_p pg;
  int bnr;
  for (bnr = 0; bnr < NUM_BLOCKS_IN_FILE; bnr++)
    {
      pg = get_page ( fname, bnr );
      if ( pg == NULL)
	{
	  put_msg (FATAL, "get_page %d fails\n", bnr);
	  put_pager_info (FATAL, "After get_page");
	  exit (EXIT_FAILURE);
	}

      /* put_pager_info (DEBUG, "After get_page"); */

      int i;
      for (i=0; i<NUM_RECORDS_IN_BLOCK; i++)
	{
	  int offset = PAGE_HEADER_SIZE + i*(INT_SIZE + str_len);
	  page_put_int_at(pg, offset, ints_in[i] + bnr);
	  offset += INT_SIZE;
	  page_put_str_at(pg, offset, strs_in[i], str_len);
	  /* put_pager_info (DEBUG, "After writing a record"); */
	}

      /* put_pager_info (DEBUG, "Before write_page"); */
      write_page (pg);
      unpin (pg);
      /* put_pager_info (DEBUG, "After unpin"); */
    }

  put_pager_profiler_info (INFO);
  pager_terminate ();
  /* put_pager_info (DEBUG, "After pager_terminate"); */
  put_msg (INFO, "test_page_write_with_offset() done.\n");
}
示例#10
0
    pin &operator=(const pin &other) {
      if (&other != this) {
	unpin();
	dopin(other.ss, other.target);
      }
    }
示例#11
0
 ~pin(void) {
   unpin();
 }