bufq(9) [netbsd man page]
BUFQ(9) BSD Kernel Developer's Manual BUFQ(9) NAME
bufq, bufq_state, bufq_alloc, bufq_drain, bufq_free, bufq_getstrategyname, bufq_move, bufq_put, bufq_get, bufq_peek, bufq_cancel -- device buffer queues SYNOPSIS
#include <sys/bufq.h> int bufq_alloc(struct bufq_state **bufq, const char *strategy, int flags); void bufq_drain(struct bufq_state *bufq); void bufq_free(struct bufq_state *bufq); const char * bufq_getstrategyname(struct bufq_state *bufq); void bufq_move(struct bufq_state *dst, struct bufq_state *src); void bufq_put(struct bufq_state *bufq, struct buf *bp); struct buf * bufq_get(struct bufq_state *bufq); struct buf * bufq_peek(struct bufq_state *bufq); struct buf * bufq_cancel(struct bufq_state *bufq, struct buf *bp); DESCRIPTION
The bufq subsystem is a set of operations for the management of device buffer queues. The primary data type for using the operations is the bufq_state structure, which is opaque for users. FUNCTIONS
bufq_alloc(bufq, strategy, flags) Allocate and initialize a bufq_state descriptor. The argument strategy specifies a buffer queue strategy to be used for this buffer queue. The following special values can be used: BUFQ_STRAT_ANY Let bufq_alloc() select a strategy. BUFQ_DISK_DEFAULT_STRAT Let bufq_alloc() select a strategy, assuming it will be used for a normal disk device. Valid bits for the flags are: BUFQ_SORT_RAWBLOCK sort by b_rawblkno BUFQ_SORT_CYLINDER sort by b_cylinder and then by b_rawblkno BUFQ_EXACT Fail if a strategy specified by strategy is not available. In that case, bufq_alloc returns ENOENT. If this flag is not specified, bufq_alloc() will silently use one of available strategies. bufq_drain(bufq) Drain a bufq_state descriptor. bufq_free(bufq) Destroy a bufq_state descriptor. bufq_getstrategyname(bufq) Get a strategy identifier of a buffer queue, the string returned will be NUL-terminated and it always will be a valid strategy name. bufq_move(dst, src) Move all requests from the buffer queue src to the buffer queue dst. bufq_put(bufq, bp) Put the buf bp in the queue. bufq_get(bufq) Get the next buf from the queue and remove it from the queue. Returns NULL if the queue is empty. bufq_peek(bufq) Get the next buf from the queue without removal. The next buf will remain the same until bufq_get(), bufq_put(), or bufq_drain() is called. Returns NULL if the queue is empty. bufq_cancel(bufq, bp) Cancel the buf bp issued earlier on the queue. Returns NULL if the element can not be found on the queue or bp if it has been found and removed. This operation can be computationally expensive if there are a lot of buffers queued. CODE REFERENCES
The actual code implementing the device buffer queues can be found in the file sys/kern/subr_bufq.c. HISTORY
The bufq subsystem appeared in NetBSD 2.0. AUTHORS
The bufq subsystem was written by Jurgen Hannken-Illjes <hannken@NetBSD.org>. BSD
January 24, 2009 BSD
Check Out this Related Man Page
DKCTL(8) BSD System Manager's Manual DKCTL(8) NAME
dkctl -- program to manipulate disks SYNOPSIS
dkctl device dkctl device command [arg [...]] DESCRIPTION
dkctl allows a user or system administrator to manipulate and configure disks in various ways. It is used by specifying a disk to manipu- late, the command to perform, and any arguments the command may require. device is the disk (wdN, sdN, ...) containing the wedges unless noted otherwise. If dkctl is called without any command, it displays strategy, cache, and all of the wedges of the specified device. COMMANDS
The following commands are supported: getcache Get and display the cache enables for the specified device. setcache none | r | w | rw [save] Set the cache enables for the specified device. The enables are as follows: none Disable all caches on the disk. r Enable the read cache, and disable all other caches on the disk. w Enable the write cache, and disable all other caches on the disk. rw Enable both the read and write caches on the disk. save If specified, and the cache enables are savable, saves the cache enables in the disk's non-volatile parame- ter storage. synccache [force] Causes the cache on the disk to be synchronized, flushing all dirty write cache blocks to the media. If force is speci- fied, the cache synchronization command will be issued even if the kernel does not believe that there are any dirty cache blocks in the disk's cache. keeplabel [yes | no] Specify to keep or drop the in-core disklabel on the last close of the disk device. (Keep if yes is specified, drop if no is specified.) badsector flush | list | retry Used for managing the kernel's bad sector list for wd(4) devices. The software bad sector list is only maintained if the option ``WD_SOFTBADSECT'' was specified on kernel configuration. flush Clears the in kernel list of bad sectors. list Prints out the list of bad sector ranges recorded by the kernel. retry Flushes the in kernel list and then retries all of the previously recorded bad sectors, causing the list to self update. This option can only be used with character devices. addwedge name startblk blkcnt ptype Define a ``wedge'' on the specified disk starting at block number startblk and spanning blkcnt blocks. You need to cre- ate the partition first with fdisk(8) or gpt(8), dkctl will just name it. The wedge will have the volume name name and the partition type ptype. Valid choices for ptype would be unused, swap, ffs, lfs, ext2fs, cd9660, ados, hfs, msdos, filecore, raidframe, ccd, appleufs, ntfs, and cgd. The device name of the virtual block device assigned to the wedge will be displayed after the wedge has been successfully created. See dk(4) for more information about disk wedges. delwedge dk Delete the wedge specified by its device name dk from the specified disk. getwedgeinfo Display information about the specified disk wedge. device in this case is the wedge name. listwedges List all of the wedges configured on the specified disk. strategy [name] Get and set the disk I/O scheduler (buffer queue strategy) on the drive. If you do not provide a name argument, the cur- rently selected strategy will be shown. To set the bufq strategy, the name argument must be specified. name must be the name of one of the built-in kernel disk I/O schedulers. To get the list of supported schedulers, use the following com- mand: $ sysctl kern.bufq.strategies Note: The addwedge and delwedge commands only modify the in-kernel representation of disks; for modifying information on the disks them- selves, refer to fdisk(8) or gpt(8). SEE ALSO
ioctl(2), dk(4), sd(4), wd(4), disklabel(5), atactl(8), fdisk(8), gpt(8), scsictl(8) HISTORY
The dkctl command first appeared in NetBSD 1.6. AUTHORS
The dkctl command was written by Jason R. Thorpe of Wasabi Systems, Inc. BSD
January 5, 2011 BSD