cregit-Linux how code gets into the kernel

Release 4.12 include/linux/blkdev.h

Directory: include/linux
#ifndef _LINUX_BLKDEV_H

#define _LINUX_BLKDEV_H

#include <linux/sched.h>
#include <linux/sched/clock.h>

#ifdef CONFIG_BLOCK

#include <linux/major.h>
#include <linux/genhd.h>
#include <linux/list.h>
#include <linux/llist.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/pagemap.h>
#include <linux/backing-dev-defs.h>
#include <linux/wait.h>
#include <linux/mempool.h>
#include <linux/pfn.h>
#include <linux/bio.h>
#include <linux/stringify.h>
#include <linux/gfp.h>
#include <linux/bsg.h>
#include <linux/smp.h>
#include <linux/rcupdate.h>
#include <linux/percpu-refcount.h>
#include <linux/scatterlist.h>
#include <linux/blkzoned.h>

struct module;
struct scsi_ioctl_command;

struct request_queue;
struct elevator_queue;
struct blk_trace;
struct request;
struct sg_io_hdr;
struct bsg_job;
struct blkcg_gq;
struct blk_flush_queue;
struct pr_ops;
struct rq_wb;
struct blk_queue_stats;
struct blk_stat_callback;


#define BLKDEV_MIN_RQ	4

#define BLKDEV_MAX_RQ	128	
/* Default maximum */

/* Must be consisitent with blk_mq_poll_stats_bkt() */

#define BLK_MQ_POLL_STATS_BKTS 16

/*
 * Maximum number of blkcg policies allowed to be registered concurrently.
 * Defined here to simplify include dependency.
 */

#define BLKCG_MAX_POLS		3


typedef void (rq_end_io_fn)(struct request *, int);


#define BLK_RL_SYNCFULL		(1U << 0)

#define BLK_RL_ASYNCFULL	(1U << 1)


struct request_list {
	
struct request_queue	*q;	/* the queue this rl belongs to */
#ifdef CONFIG_BLK_CGROUP
	
struct blkcg_gq		*blkg;	/* blkg this request pool belongs to */
#endif
	/*
         * count[], starved[], and wait[] are indexed by
         * BLK_RW_SYNC/BLK_RW_ASYNC
         */
	
int			count[2];
	
int			starved[2];
	
mempool_t		*rq_pool;
	
wait_queue_head_t	wait[2];
	
unsigned int		flags;
};

/*
 * request flags */

typedef __u32 __bitwise req_flags_t;

/* elevator knows about this request */

#define RQF_SORTED		((__force req_flags_t)(1 << 0))
/* drive already may have started this one */

#define RQF_STARTED		((__force req_flags_t)(1 << 1))
/* uses tagged queueing */

#define RQF_QUEUED		((__force req_flags_t)(1 << 2))
/* may not be passed by ioscheduler */

#define RQF_SOFTBARRIER		((__force req_flags_t)(1 << 3))
/* request for flush sequence */

#define RQF_FLUSH_SEQ		((__force req_flags_t)(1 << 4))
/* merge of different types, fail separately */

#define RQF_MIXED_MERGE		((__force req_flags_t)(1 << 5))
/* track inflight for MQ */

#define RQF_MQ_INFLIGHT		((__force req_flags_t)(1 << 6))
/* don't call prep for this one */

#define RQF_DONTPREP		((__force req_flags_t)(1 << 7))
/* set for "ide_preempt" requests and also for requests for which the SCSI
   "quiesce" state must be ignored. */

#define RQF_PREEMPT		((__force req_flags_t)(1 << 8))
/* contains copies of user pages */

#define RQF_COPY_USER		((__force req_flags_t)(1 << 9))
/* vaguely specified driver internal error.  Ignored by the block layer */

#define RQF_FAILED		((__force req_flags_t)(1 << 10))
/* don't warn about errors */

#define RQF_QUIET		((__force req_flags_t)(1 << 11))
/* elevator private data attached */

#define RQF_ELVPRIV		((__force req_flags_t)(1 << 12))
/* account I/O stat */

#define RQF_IO_STAT		((__force req_flags_t)(1 << 13))
/* request came from our alloc pool */

#define RQF_ALLOCED		((__force req_flags_t)(1 << 14))
/* runtime pm request */

#define RQF_PM			((__force req_flags_t)(1 << 15))
/* on IO scheduler merge hash */

#define RQF_HASHED		((__force req_flags_t)(1 << 16))
/* IO stats tracking on */

#define RQF_STATS		((__force req_flags_t)(1 << 17))
/* Look at ->special_vec for the actual data payload instead of the
   bio chain. */

#define RQF_SPECIAL_PAYLOAD	((__force req_flags_t)(1 << 18))

/* flags that prevent us from merging requests: */

#define RQF_NOMERGE_FLAGS \
	(RQF_STARTED | RQF_SOFTBARRIER | RQF_FLUSH_SEQ | RQF_SPECIAL_PAYLOAD)

/*
 * Try to put the fields that are referenced together in the same cacheline.
 *
 * If you modify this structure, make sure to update blk_rq_init() and
 * especially blk_mq_rq_ctx_init() to take care of the added fields.
 */

struct request {
	
struct list_head queuelist;
	union {
		
struct call_single_data csd;
		
u64 fifo_time;
	};

	
struct request_queue *q;
	
struct blk_mq_ctx *mq_ctx;

	
int cpu;
	
unsigned int cmd_flags;		/* op and common flags */
	
req_flags_t rq_flags;

	
int internal_tag;

	
unsigned long atomic_flags;

	/* the following two fields are internal, NEVER access directly */
	
unsigned int __data_len;	/* total data len */
	
int tag;
	
sector_t __sector;		/* sector cursor */

	
struct bio *bio;
	
struct bio *biotail;

	/*
         * The hash is used inside the scheduler, and killed once the
         * request reaches the dispatch list. The ipi_list is only used
         * to queue the request for softirq completion, which is long
         * after the request has been unhashed (and even removed from
         * the dispatch list).
         */
	union {
		
struct hlist_node hash;	/* merge hash */
		
struct list_head ipi_list;
	};

	/*
         * The rb_node is only used inside the io scheduler, requests
         * are pruned when moved to the dispatch queue. So let the
         * completion_data share space with the rb_node.
         */
	union {
		
struct rb_node rb_node;	/* sort/lookup */
		
struct bio_vec special_vec;
		
void *completion_data;
		
int error_count; /* for legacy drivers, don't use */
	};

	/*
         * Three pointers are available for the IO schedulers, if they need
         * more they have to dynamically allocate it.  Flush requests are
         * never put on the IO scheduler. So let the flush fields share
         * space with the elevator data.
         */
	union {
		struct {
			
struct io_cq		*icq;
			
void			*priv[2];
		
} elv;

		struct {
			
unsigned int		seq;
			
struct list_head	list;
			
rq_end_io_fn		*saved_end_io;
		
} flush;
	};

	
struct gendisk *rq_disk;
	
struct hd_struct *part;
	
unsigned long start_time;
	
struct blk_issue_stat issue_stat;
#ifdef CONFIG_BLK_CGROUP
	
struct request_list *rl;		/* rl this rq is alloced from */
	
unsigned long long start_time_ns;
	
unsigned long long io_start_time_ns;    /* when passed to hardware */
#endif
	/* Number of scatter-gather DMA addr+len pairs after
         * physical address coalescing is performed.
         */
	
unsigned short nr_phys_segments;
#if defined(CONFIG_BLK_DEV_INTEGRITY)
	
unsigned short nr_integrity_segments;
#endif

	
unsigned short ioprio;

	
unsigned int timeout;

	
void *special;		/* opaque pointer available for LLD use */

	
unsigned int extra_len;	/* length of alignment and padding */

	
unsigned long deadline;
	
struct list_head timeout_list;

	/*
         * completion callback.
         */
	
rq_end_io_fn *end_io;
	
void *end_io_data;

	/* for bidi */
	
struct request *next_rq;
};


static inline bool blk_rq_is_scsi(struct request *rq) { return req_op(rq) == REQ_OP_SCSI_IN || req_op(rq) == REQ_OP_SCSI_OUT; }

Contributors

PersonTokensPropCommitsCommitProp
Christoph Hellwig27100.00%1100.00%
Total27100.00%1100.00%


static inline bool blk_rq_is_private(struct request *rq) { return req_op(rq) == REQ_OP_DRV_IN || req_op(rq) == REQ_OP_DRV_OUT; }

Contributors

PersonTokensPropCommitsCommitProp
Christoph Hellwig27100.00%1100.00%
Total27100.00%1100.00%


static inline bool blk_rq_is_passthrough(struct request *rq) { return blk_rq_is_scsi(rq) || blk_rq_is_private(rq); }

Contributors

PersonTokensPropCommitsCommitProp
Christoph Hellwig23100.00%2100.00%
Total23100.00%2100.00%


static inline unsigned short req_get_ioprio(struct request *req) { return req->ioprio; }

Contributors

PersonTokensPropCommitsCommitProp
Fernando Luis Vázquez Cao18100.00%1100.00%
Total18100.00%1100.00%

#include <linux/elevator.h> struct blk_queue_ctx; typedef void (request_fn_proc) (struct request_queue *q); typedef blk_qc_t (make_request_fn) (struct request_queue *q, struct bio *bio); typedef int (prep_rq_fn) (struct request_queue *, struct request *); typedef void (unprep_rq_fn) (struct request_queue *, struct request *); struct bio_vec; typedef void (softirq_done_fn)(struct request *); typedef int (dma_drain_needed_fn)(struct request *); typedef int (lld_busy_fn) (struct request_queue *q); typedef int (bsg_job_fn) (struct bsg_job *); typedef int (init_rq_fn)(struct request_queue *, struct request *, gfp_t); typedef void (exit_rq_fn)(struct request_queue *, struct request *); enum blk_eh_timer_return { BLK_EH_NOT_HANDLED, BLK_EH_HANDLED, BLK_EH_RESET_TIMER, }; typedef enum blk_eh_timer_return (rq_timed_out_fn)(struct request *); enum blk_queue_state { Queue_down, Queue_up, }; struct blk_queue_tag { struct request **tag_index; /* map of busy tags */ unsigned long *tag_map; /* bit map of free/busy tags */ int max_depth; /* what we will send to device */ int real_max_depth; /* what the array can hold */ atomic_t refcnt; /* map can be shared */ int alloc_policy; /* tag allocation policy */ int next_tag; /* next tag */ }; #define BLK_TAG_ALLOC_FIFO 0 /* allocate starting from 0 */ #define BLK_TAG_ALLOC_RR 1 /* allocate starting from last allocated tag */ #define BLK_SCSI_MAX_CMDS (256) #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) /* * Zoned block device models (zoned limit). */ enum blk_zoned_model { BLK_ZONED_NONE, /* Regular block device */ BLK_ZONED_HA, /* Host-aware zoned block device */ BLK_ZONED_HM, /* Host-managed zoned block device */ }; struct queue_limits { unsigned long bounce_pfn; unsigned long seg_boundary_mask; unsigned long virt_boundary_mask; unsigned int max_hw_sectors; unsigned int max_dev_sectors; unsigned int chunk_sectors; unsigned int max_sectors; unsigned int max_segment_size; unsigned int physical_block_size; unsigned int alignment_offset; unsigned int io_min; unsigned int io_opt; unsigned int max_discard_sectors; unsigned int max_hw_discard_sectors; unsigned int max_write_same_sectors; unsigned int max_write_zeroes_sectors; unsigned int discard_granularity; unsigned int discard_alignment; unsigned short logical_block_size; unsigned short max_segments; unsigned short max_integrity_segments; unsigned short max_discard_segments; unsigned char misaligned; unsigned char discard_misaligned; unsigned char cluster; unsigned char raid_partial_stripes_expensive; enum blk_zoned_model zoned; }; #ifdef CONFIG_BLK_DEV_ZONED struct blk_zone_report_hdr { unsigned int nr_zones; u8 padding[60]; }; extern int blkdev_report_zones(struct block_device *bdev, sector_t sector, struct blk_zone *zones, unsigned int *nr_zones, gfp_t gfp_mask); extern int blkdev_reset_zones(struct block_device *bdev, sector_t sectors, sector_t nr_sectors, gfp_t gfp_mask); extern int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg); extern int blkdev_reset_zones_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg); #else /* CONFIG_BLK_DEV_ZONED */
static inline int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { return -ENOTTY; }

Contributors

PersonTokensPropCommitsCommitProp
Shaun Tancheff27100.00%1100.00%
Total27100.00%1100.00%


static inline int blkdev_reset_zones_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { return -ENOTTY; }

Contributors

PersonTokensPropCommitsCommitProp
Shaun Tancheff27100.00%1100.00%
Total27100.00%1100.00%

#endif /* CONFIG_BLK_DEV_ZONED */ struct request_queue { /* * Together with queue_head for cacheline sharing */ struct list_head queue_head; struct request *last_merge; struct elevator_queue *elevator; int nr_rqs[2]; /* # allocated [a]sync rqs */ int nr_rqs_elvpriv; /* # allocated rqs w/ elvpriv */ atomic_t shared_hctx_restart; struct blk_queue_stats *stats; struct rq_wb *rq_wb; /* * If blkcg is not used, @q->root_rl serves all requests. If blkcg * is used, root blkg allocates from @q->root_rl and all other * blkgs from their own blkg->rl. Which one to use should be * determined using bio_request_list(). */ struct request_list root_rl; request_fn_proc *request_fn; make_request_fn *make_request_fn; prep_rq_fn *prep_rq_fn; unprep_rq_fn *unprep_rq_fn; softirq_done_fn *softirq_done_fn; rq_timed_out_fn *rq_timed_out_fn; dma_drain_needed_fn *dma_drain_needed; lld_busy_fn *lld_busy_fn; init_rq_fn *init_rq_fn; exit_rq_fn *exit_rq_fn; const struct blk_mq_ops *mq_ops; unsigned int *mq_map; /* sw queues */ struct blk_mq_ctx __percpu *queue_ctx; unsigned int nr_queues; unsigned int queue_depth; /* hw dispatch queues */ struct blk_mq_hw_ctx **queue_hw_ctx; unsigned int nr_hw_queues; /* * Dispatch queue sorting */ sector_t end_sector; struct request *boundary_rq; /* * Delayed queue handling */ struct delayed_work delay_work; struct backing_dev_info *backing_dev_info; /* * The queue owner gets to use this for whatever they like. * ll_rw_blk doesn't touch it. */ void *queuedata; /* * various queue flags, see QUEUE_* below */ unsigned long queue_flags; /* * ida allocated id for this queue. Used to index queues from * ioctx. */ int id; /* * queue needs bounce pages for pages above this limit */ gfp_t bounce_gfp; /* * protects queue structures from reentrancy. ->__queue_lock should * _never_ be used directly, it is queue private. always use * ->queue_lock. */ spinlock_t __queue_lock; spinlock_t *queue_lock; /* * queue kobject */ struct kobject kobj; /* * mq queue kobject */ struct kobject mq_kobj; #ifdef CONFIG_BLK_DEV_INTEGRITY struct blk_integrity integrity; #endif /* CONFIG_BLK_DEV_INTEGRITY */ #ifdef CONFIG_PM struct device *dev; int rpm_status; unsigned int nr_pending; #endif /* * queue settings */ unsigned long nr_requests; /* Max # of requests */ unsigned int nr_congestion_on; unsigned int nr_congestion_off; unsigned int nr_batching; unsigned int dma_drain_size; void *dma_drain_buffer; unsigned int dma_pad_mask; unsigned int dma_alignment; struct blk_queue_tag *queue_tags; struct list_head tag_busy_list; unsigned int nr_sorted; unsigned int in_flight[2]; /* * Number of active block driver functions for which blk_drain_queue() * must wait. Must be incremented around functions that unlock the * queue_lock internally, e.g. scsi_request_fn(). */ unsigned int request_fn_active; unsigned int rq_timeout; int poll_nsec; struct blk_stat_callback *poll_cb; struct blk_rq_stat poll_stat[BLK_MQ_POLL_STATS_BKTS]; struct timer_list timeout; struct work_struct timeout_work; struct list_head timeout_list; struct list_head icq_list; #ifdef CONFIG_BLK_CGROUP DECLARE_BITMAP (blkcg_pols, BLKCG_MAX_POLS); struct blkcg_gq *root_blkg; struct list_head blkg_list; #endif struct queue_limits limits; /* * sg stuff */ unsigned int sg_timeout; unsigned int sg_reserved_size; int node; #ifdef CONFIG_BLK_DEV_IO_TRACE struct blk_trace *blk_trace; #endif /* * for flush operations */ struct blk_flush_queue *fq; struct list_head requeue_list; spinlock_t requeue_lock; struct delayed_work requeue_work; struct mutex sysfs_lock; int bypass_depth; atomic_t mq_freeze_depth; #if defined(CONFIG_BLK_DEV_BSG) bsg_job_fn *bsg_job_fn; int bsg_job_size; struct bsg_class_device bsg_dev; #endif #ifdef CONFIG_BLK_DEV_THROTTLING /* Throttle data */ struct throtl_data *td; #endif struct rcu_head rcu_head; wait_queue_head_t mq_freeze_wq; struct percpu_ref q_usage_counter; struct list_head all_q_node; struct blk_mq_tag_set *tag_set; struct list_head tag_set_list; struct bio_set *bio_split; #ifdef CONFIG_BLK_DEBUG_FS struct dentry *debugfs_dir; struct dentry *sched_debugfs_dir; #endif bool mq_sysfs_init_done; size_t cmd_size; void *rq_alloc_data; struct work_struct release_work; }; #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ #define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ #define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ #define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ #define QUEUE_FLAG_DYING 5 /* queue being torn down */ #define QUEUE_FLAG_BYPASS 6 /* act as dumb FIFO queue */ #define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */ #define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */ #define QUEUE_FLAG_SAME_COMP 9 /* complete on same CPU-group */ #define QUEUE_FLAG_FAIL_IO 10 /* fake timeout */ #define QUEUE_FLAG_STACKABLE 11 /* supports request stacking */ #define QUEUE_FLAG_NONROT 12 /* non-rotational device (SSD) */ #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ #define QUEUE_FLAG_IO_STAT 13 /* do IO stats */ #define QUEUE_FLAG_DISCARD 14 /* supports DISCARD */ #define QUEUE_FLAG_NOXMERGES 15 /* No extended merges */ #define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */ #define QUEUE_FLAG_SECERASE 17 /* supports secure erase */ #define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ #define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/ #define QUEUE_FLAG_POLL 22 /* IO polling enabled if set */ #define QUEUE_FLAG_WC 23 /* Write back caching */ #define QUEUE_FLAG_FUA 24 /* device supports FUA writes */ #define QUEUE_FLAG_FLUSH_NQ 25 /* flush not queueuable */ #define QUEUE_FLAG_DAX 26 /* device supports DAX */ #define QUEUE_FLAG_STATS 27 /* track rq completion times */ #define QUEUE_FLAG_POLL_STATS 28 /* collecting stats for hybrid polling */ #define QUEUE_FLAG_REGISTERED 29 /* queue has been registered to a disk */ #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ (1 << QUEUE_FLAG_STACKABLE) | \ (1 << QUEUE_FLAG_SAME_COMP) | \ (1 << QUEUE_FLAG_ADD_RANDOM)) #define QUEUE_FLAG_MQ_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ (1 << QUEUE_FLAG_STACKABLE) | \ (1 << QUEUE_FLAG_SAME_COMP) | \ (1 << QUEUE_FLAG_POLL))
static inline void queue_lockdep_assert_held(struct request_queue *q) { if (q->queue_lock) lockdep_assert_held(q->queue_lock); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds1560.00%150.00%
Andi Kleen1040.00%150.00%
Total25100.00%2100.00%


static inline void queue_flag_set_unlocked(unsigned int flag, struct request_queue *q) { __set_bit(flag, &q->queue_flags); }

Contributors

PersonTokensPropCommitsCommitProp
Nicholas Piggin26100.00%1100.00%
Total26100.00%1100.00%


static inline int queue_flag_test_and_clear(unsigned int flag, struct request_queue *q) { queue_lockdep_assert_held(q); if (test_bit(flag, &q->queue_flags)) { __clear_bit(flag, &q->queue_flags); return 1; } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Jens Axboe5098.04%150.00%
Andi Kleen11.96%150.00%
Total51100.00%2100.00%


static inline int queue_flag_test_and_set(unsigned int flag, struct request_queue *q) { queue_lockdep_assert_held(q); if (!test_bit(flag, &q->queue_flags)) { __set_bit(flag, &q->queue_flags); return 0; } return 1; }

Contributors

PersonTokensPropCommitsCommitProp
Jens Axboe5198.08%150.00%
Andi Kleen11.92%150.00%
Total52100.00%2100.00%


static inline void queue_flag_set(unsigned int flag, struct request_queue *q) { queue_lockdep_assert_held(q); __set_bit(flag, &q->queue_flags); }

Contributors

PersonTokensPropCommitsCommitProp
Nicholas Piggin3096.77%150.00%
Andi Kleen13.23%150.00%
Total31100.00%2100.00%


static inline void queue_flag_clear_unlocked(unsigned int flag, struct request_queue *q) { __clear_bit(flag, &q->queue_flags); }

Contributors

PersonTokensPropCommitsCommitProp
Nicholas Piggin26100.00%1100.00%
Total26100.00%1100.00%


static inline int queue_in_flight(struct request_queue *q) { return q->in_flight[0] + q->in_flight[1]; }

Contributors

PersonTokensPropCommitsCommitProp
Jens Axboe27100.00%1100.00%
Total27100.00%1100.00%


static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) { queue_lockdep_assert_held(q); __clear_bit(flag, &q->queue_flags); }

Contributors

PersonTokensPropCommitsCommitProp
Nicholas Piggin3096.77%150.00%
Andi Kleen13.23%150.00%
Total31100.00%2100.00%

#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) #define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags) #define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags) #define blk_queue_bypass(q) test_bit(QUEUE_FLAG_BYPASS, &(q)->queue_flags) #define blk_queue_init_done(q) test_bit(QUEUE_FLAG_INIT_DONE, &(q)->queue_flags) #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) #define blk_queue_noxmerges(q) \ test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) #define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) #define blk_queue_add_random(q) test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags) #define blk_queue_stackable(q) \ test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) #define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) #define blk_queue_secure_erase(q) \ (test_bit(QUEUE_FLAG_SECERASE, &(q)->queue_flags)) #define blk_queue_dax(q) test_bit(QUEUE_FLAG_DAX, &(q)->queue_flags) #define blk_noretry_request(rq) \ ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \ REQ_FAILFAST_DRIVER))
static inline bool blk_account_rq(struct request *rq) { return (rq->rq_flags & RQF_STARTED) && !blk_rq_is_passthrough(rq); }

Contributors

PersonTokensPropCommitsCommitProp
Christoph Hellwig2385.19%150.00%
Andrew Morton414.81%150.00%
Total27100.00%2100.00%

#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) #define blk_bidi_rq(rq) ((rq)->next_rq != NULL) /* rq->queuelist of dequeued request must be list_empty() */ #define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) #define rq_data_dir(rq) (op_is_write(req_op(rq)) ? WRITE : READ) /* * Driver can handle struct request, if it either has an old style * request_fn defined, or is blk-mq based. */
static inline bool queue_is_rq_based(struct request_queue *q) { return q->request_fn || q->mq_ops; }

Contributors

PersonTokensPropCommitsCommitProp
Jens Axboe21100.00%1100.00%
Total21100.00%1100.00%


static inline unsigned int blk_queue_cluster(struct request_queue *q) { return q->limits.cluster; }

Contributors

PersonTokensPropCommitsCommitProp
Martin K. Petersen20100.00%1100.00%
Total20100.00%1100.00%


static inline enum blk_zoned_model blk_queue_zoned_model(struct request_queue *q) { return q->limits.zoned; }

Contributors

PersonTokensPropCommitsCommitProp
Damien Le Moal20100.00%1100.00%
Total20100.00%1100.00%


static inline bool blk_queue_is_zoned(struct request_queue *q) { switch (blk_queue_zoned_model(q)) { case BLK_ZONED_HA: case BLK_ZONED_HM: return true; default: return false; } }

Contributors

PersonTokensPropCommitsCommitProp
Damien Le Moal34100.00%1100.00%
Total34100.00%1100.00%


static inline unsigned int blk_queue_zone_sectors(struct request_queue *q) { return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0; }

Contributors

PersonTokensPropCommitsCommitProp
Hannes Reinecke2696.30%150.00%
Damien Le Moal13.70%150.00%
Total27100.00%2100.00%


static inline bool rq_is_sync(struct request *rq) { return op_is_sync(rq->cmd_flags); }

Contributors

PersonTokensPropCommitsCommitProp
Jens Axboe1785.00%250.00%
Michael Christie210.00%125.00%
Christoph Hellwig15.00%125.00%
Total20100.00%4100.00%


static inline bool blk_rl_full(struct request_list *rl, bool sync) { unsigned int flag = sync ? BLK_RL_SYNCFULL : BLK_RL_ASYNCFULL; return rl->flags & flag; }

Contributors

PersonTokensPropCommitsCommitProp
Tejun Heo1753.12%133.33%
Andrew Morton1340.62%133.33%
Jens Axboe26.25%133.33%
Total32100.00%3100.00%


static inline void blk_set_rl_full(struct request_list *rl, bool sync) { unsigned int flag = sync ? BLK_RL_SYNCFULL : BLK_RL_ASYNCFULL; rl->flags |= flag; }

Contributors

PersonTokensPropCommitsCommitProp
Tejun Heo1858.06%133.33%
Andrew Morton1135.48%133.33%
Jens Axboe26.45%133.33%
Total31100.00%3100.00%


static inline void blk_clear_rl_full(struct request_list *rl, bool sync) { unsigned int flag = sync ? BLK_RL_SYNCFULL : BLK_RL_ASYNCFULL; rl->flags &= ~flag; }

Contributors

PersonTokensPropCommitsCommitProp
Tejun Heo1959.38%133.33%
Andrew Morton1134.38%133.33%
Jens Axboe26.25%133.33%
Total32100.00%3100.00%


static inline bool rq_mergeable(struct request *rq) { if (blk_rq_is_passthrough(rq)) return false; if (req_op(rq) == REQ_OP_FLUSH) return false; if (req_op(rq) == REQ_OP_WRITE_ZEROES) return false; if (rq->cmd_flags & REQ_NOMERGE_FLAGS) return false; if (rq->rq_flags & RQF_NOMERGE_FLAGS