Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | drivers/block/rnbd/rnbd-clt.c | static void rnbd_destroy_sessions(void) {
struct rnbd_clt_session *sess, *sn;
struct rnbd_clt_dev *dev, *tn;
rnbd_clt_destroy_sysfs_files();
/*
* Here at this point there is no any concurrent access to sessions
* list and devices list:
* 1. New session or device can't be created - session sysfs fil... | [
0,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-proto.h |
static inline bool rnbd_flags_supported(u32 flags) {
u32 op;
op = rnbd_op(flags);
flags = rnbd_flags(flags);
if (op >= RNBD_OP_LAST)
return false;
if (flags & ~RNBD_F_ALL)
return false;
return true;
} | [
0,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-srv-sysfs.c |
void rnbd_srv_destroy_dev_sysfs(struct rnbd_srv_dev *dev) {
sysfs_remove_link(&dev->dev_kobj, "block_dev");
kobject_del(dev->dev_sessions_kobj);
kobject_put(dev->dev_sessions_kobj);
kobject_del(&dev->dev_kobj);
kobject_put(&dev->dev_kobj);
} | [
0,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-srv-sysfs.c |
static ssize_t
rnbd_srv_dev_session_force_close_show(struct kobject *kobj,
struct kobj_attribute *attr, char *page) {
return sysfs_emit(page, "Usage: echo 1 > %s\n", attr->attr.name);
} | [
0,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-srv-sysfs.c |
int rnbd_srv_create_dev_session_sysfs(struct rnbd_srv_sess_dev *sess_dev) {
int ret;
ret = kobject_init_and_add(&sess_dev->kobj, &rnbd_srv_sess_dev_ktype,
sess_dev->dev->dev_sessions_kobj, "%s",
sess_dev->sess->sessname);
if (ret) {
kobject_put(&sess... | [
1,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-srv.c |
static void rnbd_sess_dev_release(struct kref *kref) {
struct rnbd_srv_sess_dev *sess_dev;
sess_dev = container_of(kref, struct rnbd_srv_sess_dev, kref);
complete(sess_dev->destroy_comp);
} | [
0,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-srv.c |
static inline void rnbd_put_sess_dev(struct rnbd_srv_sess_dev *sess_dev) {
kref_put(&sess_dev->kref, rnbd_sess_dev_release);
} | [
0,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-srv.c | static void destroy_device(struct kref *kref) {
struct rnbd_srv_dev *dev = container_of(kref, struct rnbd_srv_dev, kref);
WARN_ONCE(!list_empty(&dev->sess_dev_list),
"Device %s is being destroyed but still in use!\n", dev->id);
spin_lock(&dev_lock);
list_del(&dev->list);
spin_unlock(&dev_lock);
... | [
0,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-srv.c | void rnbd_destroy_sess_dev(struct rnbd_srv_sess_dev *sess_dev, bool keep_id) {
DECLARE_COMPLETION_ONSTACK(dc);
if (keep_id)
/* allow to re-use the id itself because it */
/* is still used by the client */
xa_cmpxchg(&sess_dev->sess->index_idr, sess_dev->device_id, sess_dev, NULL,
... | [
1,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-srv.c | void rnbd_srv_sess_dev_force_close(struct rnbd_srv_sess_dev *sess_dev,
struct kobj_attribute *attr) {
struct rnbd_srv_session *sess = sess_dev->sess;
if (!mutex_trylock(&sess->lock))
return;
sess_dev->keep_id = true;
/* first remove sysfs itself to avoid deadlock */
sy... | [
0,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-srv.c | static int rnbd_srv_rdma_ev(void *priv, struct rtrs_srv_op *id, void *data,
size_t datalen, const void *usr, size_t usrlen) {
struct rnbd_srv_session *srv_sess = priv;
const struct rnbd_msg_hdr *hdr = usr;
int ret = 0;
u16 type;
if (WARN_ON_ONCE(!srv_sess))
return -ENODEV;
... | [
0,
0
] |
Linux Kernel | drivers/block/rnbd/rnbd-srv.c | static struct rnbd_srv_dev *
rnbd_srv_find_or_add_srv_dev(struct rnbd_srv_dev *new_dev) {
struct rnbd_srv_dev *dev;
spin_lock(&dev_lock);
list_for_each_entry(dev, &dev_list, list) {
if (!strncmp(dev->id, new_dev->id, sizeof(dev->id))) {
if (!kref_get_unless_zero(&dev->kref))
continue;
sp... | [
1,
0
] |
Linux Kernel | drivers/block/sunvdc.c | static void vdc_blk_queue_start(struct vdc_port *port) {
struct vio_dring_state *dr = &port->vio.drings[VIO_DRIVER_TX_RING];
if (port->disk && vdc_tx_dring_avail(dr) * 100 / VDC_TX_RING_SIZE >= 50)
blk_mq_start_stopped_hw_queues(port->disk->queue, true);
} | [
0,
0
] |
Linux Kernel | drivers/block/sunvdc.c |
static int vdc_send_attr(struct vio_driver_state *vio) {
struct vdc_port *port = to_vdc_port(vio);
struct vio_disk_attr_info pkt;
memset(&pkt, 0, sizeof(pkt));
pkt.tag.type = VIO_TYPE_CTRL;
pkt.tag.stype = VIO_SUBTYPE_INFO;
pkt.tag.stype_env = VIO_ATTR_INFO;
pkt.tag.sid = vio_send_sid(vio);
pkt.xfer... | [
1,
0
] |
Linux Kernel | drivers/block/sunvdc.c | static blk_status_t vdc_queue_rq(struct blk_mq_hw_ctx *hctx,
const struct blk_mq_queue_data *bd) {
struct vdc_port *port = hctx->queue->queuedata;
struct vio_dring_state *dr;
unsigned long flags;
dr = &port->vio.drings[VIO_DRIVER_TX_RING];
blk_mq_start_request(bd->rq);
sp... | [
1,
0
] |
Linux Kernel | drivers/block/sunvdc.c |
static void vdc_ldc_reset_timer_work(struct work_struct *work) {
struct vdc_port *port;
struct vio_driver_state *vio;
port = container_of(work, struct vdc_port, ldc_reset_timer_work.work);
vio = &port->vio;
spin_lock_irq(&vio->lock);
if (!(port->vio.hs_state & VIO_HS_COMPLETE)) {
pr_warn(PFX "%s ldc ... | [
0,
0
] |
Linux Kernel | drivers/block/sunvdc.c |
static void vdc_ldc_reset_work(struct work_struct *work) {
struct vdc_port *port;
struct vio_driver_state *vio;
unsigned long flags;
port = container_of(work, struct vdc_port, ldc_reset_work);
vio = &port->vio;
spin_lock_irqsave(&vio->lock, flags);
vdc_ldc_reset(port);
spin_unlock_irqrestore(&vio->lo... | [
0,
0
] |
Linux Kernel | drivers/block/swim.c |
static inline void swim_select(struct swim __iomem *base, int sel) {
swim_write(base, phase, RELAX);
via1_set_head(sel & 0x100);
swim_write(base, phase, sel & CA_MASK);
} | [
0,
0
] |
Linux Kernel | drivers/block/swim.c |
static inline void swim_action(struct swim __iomem *base, int action) {
unsigned long flags;
local_irq_save(flags);
swim_select(base, action);
udelay(1);
swim_write(base, phase, (LSTRB << 4) | LSTRB);
udelay(1);
swim_write(base, phase, (LSTRB << 4) | ((~LSTRB) & 0x0F));
udelay(1);
local_irq_restor... | [
0,
0
] |
Linux Kernel | drivers/block/swim.c |
static inline int swim_track(struct floppy_state *fs, int track) {
struct swim __iomem *base = fs->swd->base;
int ret;
ret = swim_seek(base, track - fs->track);
if (ret == 0)
fs->track = track;
else {
swim_track00(base);
fs->track = 0;
}
return ret;
} | [
1,
0
] |
Linux Kernel | drivers/block/swim.c |
static int floppy_eject(struct floppy_state *fs) {
struct swim __iomem *base = fs->swd->base;
swim_drive(base, fs->location);
swim_motor(base, OFF);
swim_eject(base);
fs->disk_in = 0;
fs->ejected = 1;
return 0;
} | [
1,
0
] |
Linux Kernel | drivers/block/swim.c | static inline int swim_read_sector(struct floppy_state *fs, int side, int track,
int sector, unsigned char *buffer) {
struct swim __iomem *base = fs->swd->base;
unsigned long flags;
struct sector_header header;
int ret = -1;
short i;
swim_track(fs, track);
swim_write(b... | [
1,
0
] |
Linux Kernel | drivers/block/swim.c |
static blk_status_t floppy_read_sectors(struct floppy_state *fs, int req_sector,
int sectors_nb, unsigned char *buffer) {
struct swim __iomem *base = fs->swd->base;
int ret;
int side, track, sector;
int i, try;
swim_drive(base, fs->location);
for (i = req_sector; i ... | [
1,
0
] |
Linux Kernel | drivers/block/swim.c | static int get_floppy_geometry(struct floppy_state *fs, int type,
struct floppy_struct **g) {
if (type >= ARRAY_SIZE(floppy_type))
return -EINVAL;
if (type)
*g = &floppy_type[type];
else if (fs->type == HD_MEDIA)
*g = &floppy_type[3];
else if (fs->head_number == 2) /*... | [
0,
0
] |
Linux Kernel | drivers/block/swim.c |
static void floppy_release(struct gendisk *disk, fmode_t mode) {
struct floppy_state *fs = disk->private_data;
struct swim __iomem *base = fs->swd->base;
mutex_lock(&swim_mutex);
if (fs->ref_count < 0)
fs->ref_count = 0;
else if (fs->ref_count > 0)
--fs->ref_count;
if (fs->ref_count == 0)
swi... | [
1,
0
] |
Linux Kernel | drivers/block/swim.c |
static int floppy_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long param) {
struct floppy_state *fs = bdev->bd_disk->private_data;
int err;
if ((cmd & 0x80) && !capable(CAP_SYS_ADMIN))
return -EPERM;
switch (cmd) {
case FDEJECT:
if (fs->ref_coun... | [
1,
0
] |
Linux Kernel | drivers/block/swim.c |
static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) {
struct floppy_state *fs = bdev->bd_disk->private_data;
struct floppy_struct *g;
int ret;
ret = get_floppy_geometry(fs, 0, &g);
if (ret)
return ret;
geo->heads = g->head;
geo->sectors = g->sect;
geo->cylinders = g->trac... | [
1,
0
] |
Linux Kernel | drivers/block/swim.c |
static int swim_add_floppy(struct swim_priv *swd,
enum drive_location location) {
struct floppy_state *fs = &swd->unit[swd->floppy_count];
struct swim __iomem *base = swd->base;
fs->location = location;
swim_drive(base, location);
swim_motor(base, OFF);
fs->type = HD_MEDIA;
... | [
0,
0
] |
Linux Kernel | drivers/block/swim3.c |
static void swim3_select(struct floppy_state *fs, int sel) {
struct swim3 __iomem *sw = fs->swim3;
out_8(&sw->select, RELAX);
if (sel & 8)
out_8(&sw->control_bis, SELECT);
else
out_8(&sw->control_bic, SELECT);
out_8(&sw->select, sel & CA_MASK);
} | [
0,
0
] |
Linux Kernel | drivers/block/swim3.c | static blk_status_t swim3_queue_rq(struct blk_mq_hw_ctx *hctx,
const struct blk_mq_queue_data *bd) {
struct floppy_state *fs = hctx->queue->queuedata;
struct request *req = bd->rq;
unsigned long x;
spin_lock_irq(&swim3_lock);
if (fs->cur_req || fs->state != idle) {
spin... | [
1,
0
] |
Linux Kernel | drivers/block/swim3.c | static inline void seek_track(struct floppy_state *fs, int n) {
struct swim3 __iomem *sw = fs->swim3;
if (n >= 0) {
swim3_action(fs, SEEK_POSITIVE);
sw->nseek = n;
} else {
swim3_action(fs, SEEK_NEGATIVE);
sw->nseek = -n;
}
fs->expect_cyl = (fs->cur_cyl >= 0) ? fs->cur_cyl + n : -1;
swim3_s... | [
1,
0
] |
Linux Kernel | drivers/block/swim3.c |
static phys_addr_t swim3_bio_phys(struct bio *bio) {
return page_to_phys(bio_page(bio)) + bio_offset(bio);
} | [
0,
0
] |
Linux Kernel | drivers/block/swim3.c |
static inline void init_dma(struct dbdma_cmd *cp, int cmd, phys_addr_t paddr,
int count) {
cp->req_count = cpu_to_le16(count);
cp->command = cpu_to_le16(cmd);
cp->phy_addr = cpu_to_le32(swim3_phys_to_bus(paddr));
cp->xfer_status = 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/swim3.c |
static void scan_timeout(struct timer_list *t) {
struct floppy_state *fs = from_timer(fs, t, timeout);
struct swim3 __iomem *sw = fs->swim3;
unsigned long flags;
swim3_dbg("* scan timeout, state=%d\n", fs->state);
spin_lock_irqsave(&swim3_lock, flags);
fs->timeout_pending = 0;
out_8(&sw->control_bic, D... | [
0,
0
] |
Linux Kernel | drivers/block/swim3.c |
static void seek_timeout(struct timer_list *t) {
struct floppy_state *fs = from_timer(fs, t, timeout);
struct swim3 __iomem *sw = fs->swim3;
unsigned long flags;
swim3_dbg("* seek timeout, state=%d\n", fs->state);
spin_lock_irqsave(&swim3_lock, flags);
fs->timeout_pending = 0;
out_8(&sw->control_bic, D... | [
0,
0
] |
Linux Kernel | drivers/block/swim3.c |
int swim3_init(void) {
macio_register_driver(&swim3_driver);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c | static int ublk_validate_params(const struct ublk_device *ub) {
if (ub->params.types & UBLK_PARAM_TYPE_BASIC) {
const struct ublk_param_basic *p = &ub->params.basic;
if (p->logical_bs_shift > PAGE_SHIFT)
return -EINVAL;
if (p->logical_bs_shift > p->physical_bs_shift)
return -EINVAL;
if... | [
1,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static int ublk_apply_params(struct ublk_device *ub) {
if (!(ub->params.types & UBLK_PARAM_TYPE_BASIC))
return -EINVAL;
ublk_dev_param_basic_apply(ub);
if (ub->params.types & UBLK_PARAM_TYPE_DISCARD)
ublk_dev_param_discard_apply(ub);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static inline bool ublk_can_use_recovery(struct ublk_device *ub) {
if (ub->dev_info.flags & UBLK_F_USER_RECOVERY)
return true;
return false;
} | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static inline bool ubq_daemon_is_dying(struct ublk_queue *ubq) {
return ubq->ubq_daemon->flags & PF_EXITING;
} | [
1,
0
] |
Linux Kernel | drivers/block/ublk_drv.c | static void ublk_complete_rq(struct request *req) {
struct ublk_queue *ubq = req->mq_hctx->driver_data;
struct ublk_io *io = &ubq->ios[req->tag];
unsigned int unmapped_bytes;
if (!io->res && req_op(req) == REQ_OP_READ)
io->res = -EIO;
if (io->res < 0) {
blk_mq_end_request(req, errno_to_blk_status(io... | [
1,
1
] |
Linux Kernel | drivers/block/ublk_drv.c |
static inline bool ublk_queue_ready(struct ublk_queue *ubq) {
return ubq->nr_io_ready == ubq->q_depth;
} | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c | static void ublk_cancel_queue(struct ublk_queue *ubq) {
int i;
if (!ublk_queue_ready(ubq))
return;
for (i = 0; i < ubq->q_depth; i++) {
struct ublk_io *io = &ubq->ios[i];
if (io->flags & UBLK_IO_FLAG_ACTIVE)
io_uring_cmd_done(io->cmd, UBLK_IO_RES_ABORT, 0);
}
ubq->nr_io_ready = 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static void ublk_wait_tagset_rqs_idle(struct ublk_device *ub) {
bool idle;
WARN_ON_ONCE(!blk_queue_quiesced(ub->ub_disk->queue));
while (true) {
idle = true;
blk_mq_tagset_busy_iter(&ub->tag_set, ublk_check_inflight_rq, &idle);
if (idle)
break;
msleep(UBLK_REQUEUE_DELAY_MS);
}
} | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static void ublk_quiesce_work_fn(struct work_struct *work) {
struct ublk_device *ub = container_of(work, struct ublk_device, quiesce_work);
mutex_lock(&ub->mutex);
if (ub->dev_info.state != UBLK_S_DEV_LIVE)
goto unlock;
__ublk_quiesce_dev(ub);
unlock:
mutex_unlock(&ub->mutex);
} | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static int ublk_init_queue(struct ublk_device *ub, int q_id) {
struct ublk_queue *ubq = ublk_get_queue(ub, q_id);
gfp_t gfp_flags = GFP_KERNEL | __GFP_ZERO;
void *ptr;
int size;
ubq->flags = ub->dev_info.flags;
ubq->q_id = q_id;
ubq->q_depth = ub->dev_info.queue_depth;
size = ublk_queue_cmd_buf_size(u... | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c | static void ublk_align_max_io_size(struct ublk_device *ub) {
unsigned int max_io_bytes = ub->dev_info.max_io_buf_bytes;
ub->dev_info.max_io_buf_bytes = round_down(max_io_bytes, PAGE_SIZE);
} | [
1,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static int ublk_add_tag_set(struct ublk_device *ub) {
ub->tag_set.ops = &ublk_mq_ops;
ub->tag_set.nr_hw_queues = ub->dev_info.nr_hw_queues;
ub->tag_set.queue_depth = ub->dev_info.queue_depth;
ub->tag_set.numa_node = NUMA_NO_NODE;
ub->tag_set.cmd_size = sizeof(struct ublk_rq_data);
ub->tag_set.flags = BLK_M... | [
1,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static int ublk_ctrl_get_queue_affinity(struct io_uring_cmd *cmd) {
struct ublksrv_ctrl_cmd *header = (struct ublksrv_ctrl_cmd *)cmd->cmd;
void __user *argp = (void __user *)(unsigned long)header->addr;
struct ublk_device *ub;
cpumask_var_t cpumask;
unsigned long queue;
unsigned int retlen;
unsigned int ... | [
1,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static inline bool ublk_idr_freed(int id) {
void *ptr;
spin_lock(&ublk_idr_lock);
ptr = idr_find(&ublk_index_idr, id);
spin_unlock(&ublk_idr_lock);
return ptr == NULL;
} | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static int ublk_ctrl_stop_dev(struct io_uring_cmd *cmd) {
struct ublksrv_ctrl_cmd *header = (struct ublksrv_ctrl_cmd *)cmd->cmd;
struct ublk_device *ub;
ub = ublk_get_device_from_id(header->dev_id);
if (!ub)
return -EINVAL;
ublk_stop_dev(ub);
cancel_work_sync(&ub->stop_work);
cancel_work_sync(&ub->... | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static int ublk_ctrl_get_params(struct io_uring_cmd *cmd) {
struct ublksrv_ctrl_cmd *header = (struct ublksrv_ctrl_cmd *)cmd->cmd;
void __user *argp = (void __user *)(unsigned long)header->addr;
struct ublk_params_header ph;
struct ublk_device *ub;
int ret;
if (header->len <= sizeof(ph) || !header->addr)
... | [
1,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static int __init ublk_init(void) {
int ret;
init_waitqueue_head(&ublk_idr_wq);
ret = misc_register(&ublk_misc);
if (ret)
return ret;
ret = alloc_chrdev_region(&ublk_chr_devt, 0, UBLK_MINORS, "ublk-char");
if (ret)
goto unregister_mis;
ublk_chr_class = class_create(THIS_MODULE, "ublk-char");
... | [
0,
0
] |
Linux Kernel | drivers/block/ublk_drv.c |
static void __exit ublk_exit(void) {
struct ublk_device *ub;
int id;
class_destroy(ublk_chr_class);
misc_deregister(&ublk_misc);
idr_for_each_entry(&ublk_index_idr, ub, id) ublk_remove(ub);
idr_destroy(&ublk_index_idr);
unregister_chrdev_region(ublk_chr_devt, UBLK_MINORS);
} | [
0,
0
] |
Linux Kernel | drivers/block/virtio_blk.c |
static void virtblk_unmap_data(struct request *req, struct virtblk_req *vbr) {
if (blk_rq_nr_phys_segments(req))
sg_free_table_chained(&vbr->sg_table, VIRTIO_BLK_INLINE_SG_CNT);
} | [
0,
0
] |
Linux Kernel | drivers/block/virtio_blk.c |
static inline void virtblk_request_done(struct request *req) {
struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
virtblk_unmap_data(req, vbr);
virtblk_cleanup_cmd(req);
blk_mq_end_request(req, virtblk_result(vbr));
} | [
0,
0
] |
Linux Kernel | drivers/block/virtio_blk.c | static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx,
const struct blk_mq_queue_data *bd) {
struct virtio_blk *vblk = hctx->queue->queuedata;
struct request *req = bd->rq;
struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
unsigned long flags;
int qid = hctx->queue_... | [
1,
0
] |
Linux Kernel | drivers/block/virtio_blk.c |
static void virtblk_config_changed_work(struct work_struct *work) {
struct virtio_blk *vblk = container_of(work, struct virtio_blk, config_work);
virtblk_update_capacity(vblk, true);
} | [
0,
0
] |
Linux Kernel | drivers/block/virtio_blk.c | static int virtblk_get_cache_mode(struct virtio_device *vdev) {
u8 writeback;
int err;
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE,
struct virtio_blk_config, wce, &writeback);
if (err)
writeback = virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH);
return writeback;
... | [
0,
0
] |
Linux Kernel | drivers/block/virtio_blk.c |
static void virtblk_update_cache_mode(struct virtio_device *vdev) {
u8 writeback = virtblk_get_cache_mode(vdev);
struct virtio_blk *vblk = vdev->priv;
blk_queue_write_cache(vblk->disk->queue, writeback, false);
} | [
0,
0
] |
Linux Kernel | drivers/block/virtio_blk.c |
static int virtblk_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob) {
struct virtio_blk *vblk = hctx->queue->queuedata;
struct virtio_blk_vq *vq = get_virtio_blk_vq(hctx);
struct virtblk_req *vbr;
unsigned long flags;
unsigned int len;
int found = 0;
spin_lock_irqsave(&vq->lock, flags);
wh... | [
1,
0
] |
Linux Kernel | drivers/block/virtio_blk.c | static void virtblk_remove(struct virtio_device *vdev) {
struct virtio_blk *vblk = vdev->priv;
flush_work(&vblk->config_work);
del_gendisk(vblk->disk);
blk_mq_free_tag_set(&vblk->tag_set);
mutex_lock(&vblk->vdev_mutex);
/* Stop all the virtqueues. */
virtio_reset_device(vdev);
/* Virtqueues are sto... | [
0,
0
] |
Linux Kernel | drivers/block/virtio_blk.c |
static int __init virtio_blk_init(void) {
int error;
virtblk_wq = alloc_workqueue("virtio-blk", 0, 0);
if (!virtblk_wq)
return -ENOMEM;
major = register_blkdev(0, "virtblk");
if (major < 0) {
error = major;
goto out_destroy_workqueue;
}
error = register_virtio_driver(&virtio_blk);
if (er... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkback/blkback.c | static int xen_vbd_translate(struct phys_req *req, struct xen_blkif *blkif,
enum req_op operation) {
struct xen_vbd *vbd = &blkif->vbd;
int rc = -EACCES;
if ((operation != REQ_OP_READ) && vbd->readonly)
goto out;
if (likely(req->nr_sects)) {
blkif_sector_t end = req->secto... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkback/blkback.c | void xen_blkbk_free_caches(struct xen_blkif_ring *ring) {
if (!RB_EMPTY_ROOT(&ring->persistent_gnts))
free_persistent_gnts(ring, &ring->persistent_gnts, ring->persistent_gnt_c);
BUG_ON(!RB_EMPTY_ROOT(&ring->persistent_gnts));
ring->persistent_gnt_c = 0;
/* Since we are shutting down remove all pages from... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkback/blkback.c |
static unsigned int xen_blkbk_unmap_prepare(
struct xen_blkif_ring *ring, struct grant_page **pages, unsigned int num,
struct gnttab_unmap_grant_ref *unmap_ops, struct page **unmap_pages) {
unsigned int i, invcount = 0;
for (i = 0; i < num; i++) {
if (pages[i]->persistent_gnt != NULL) {
put_pers... | [
1,
0
] |
Linux Kernel | drivers/block/xen-blkback/blkback.c |
static void xen_blkbk_unmap_and_respond(struct pending_req *req) {
struct gntab_unmap_queue_data *work = &req->gnttab_unmap_data;
struct xen_blkif_ring *ring = req->ring;
struct grant_page **pages = req->segments;
unsigned int invcount;
invcount = xen_blkbk_unmap_prepare(ring, pages, req->nr_segs, req->unma... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkback/blkback.c |
static int dispatch_discard_io(struct xen_blkif_ring *ring,
struct blkif_request *req) {
int err = 0;
int status = BLKIF_RSP_OKAY;
struct xen_blkif *blkif = ring->blkif;
struct block_device *bdev = blkif->vbd.bdev;
struct phys_req preq;
xen_blkif_get(blkif);
preq.sector_n... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkback/blkback.c |
static int __init xen_blkif_init(void) {
int rc = 0;
if (!xen_domain())
return -ENODEV;
if (xen_blkif_max_ring_order > XENBUS_MAX_RING_GRANT_ORDER) {
pr_info("Invalid max_ring_order (%d), will use default max: %d.\n",
xen_blkif_max_ring_order, XENBUS_MAX_RING_GRANT_ORDER);
xen_blkif_max... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkback/common.h | static inline void blkif_get_x86_32_req(struct blkif_request *dst,
struct blkif_x86_32_request *src) {
int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST, j;
dst->operation = READ_ONCE(src->operation);
switch (dst->operation) {
case BLKIF_OP_READ:
case BLKIF_OP_WRITE:
case BLK... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkback/xenbus.c |
static int xen_blkif_alloc_rings(struct xen_blkif *blkif) {
unsigned int r;
blkif->rings =
kcalloc(blkif->nr_rings, sizeof(struct xen_blkif_ring), GFP_KERNEL);
if (!blkif->rings)
return -ENOMEM;
for (r = 0; r < blkif->nr_rings; r++) {
struct xen_blkif_ring *ring = &blkif->rings[r];
spin_lo... | [
1,
0
] |
Linux Kernel | drivers/block/xen-blkback/xenbus.c |
int __init xen_blkif_interface_init(void) {
xen_blkif_cachep =
kmem_cache_create("blkif_cache", sizeof(struct xen_blkif), 0, 0, NULL);
if (!xen_blkif_cachep)
return -ENOMEM;
return 0;
} | [
1,
0
] |
Linux Kernel | drivers/block/xen-blkback/xenbus.c |
int xen_blkbk_barrier(struct xenbus_transaction xbt, struct backend_info *be,
int state) {
struct xenbus_device *dev = be->dev;
int err;
err = xenbus_printf(xbt, dev->nodename, "feature-barrier", "%d", state);
if (err)
dev_warn(&dev->dev, "writing feature-barrier (%d)", err);
retu... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkback/xenbus.c | static int xen_blkbk_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id) {
int err;
struct backend_info *be = kzalloc(sizeof(struct backend_info), GFP_KERNEL);
pr_debug("%s %p %d\n", __func__, dev, dev->otherend_id);
if (!be) {
xenbus_dev_fatal(dev, -ENOMEM, "all... | [
1,
0
] |
Linux Kernel | drivers/block/xen-blkback/xenbus.c |
void xen_blkif_xenbus_fini(void) {
xenbus_unregister_driver(&xen_blkbk_driver);
} | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c |
static inline struct blkif_req *blkif_req(struct request *rq) {
return blk_mq_rq_to_pdu(rq);
} | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c | static int get_id_from_freelist(struct blkfront_ring_info *rinfo) {
unsigned long free = rinfo->shadow_free;
BUG_ON(free >= BLK_RING_SIZE(rinfo->dev_info));
rinfo->shadow_free = rinfo->shadow[free].req.u.rw.id;
rinfo->shadow[free].req.u.rw.id = 0x0fffffee;
return free;
} | [
1,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c |
static inline void grant_foreign_access(const struct grant *gnt_list_entry,
const struct blkfront_info *info) {
gnttab_page_grant_foreign_access_ref_one(
gnt_list_entry->gref, info->xbdev->otherend_id, gnt_list_entry->page, 0);
} | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c | static struct grant *get_grant(grant_ref_t *gref_head, unsigned long gfn,
struct blkfront_ring_info *rinfo) {
struct grant *gnt_list_entry = get_free_grant(rinfo);
struct blkfront_info *info = rinfo->dev_info;
if (gnt_list_entry->gref != INVALID_GRANT_REF)
return gnt_list_entry... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c |
static const char *op_name(int op) {
static const char *const names[] = {[BLKIF_OP_READ] = "read",
[BLKIF_OP_WRITE] = "write",
[BLKIF_OP_WRITE_BARRIER] = "barrier",
[BLKIF_OP_FLUSH_DISKCACHE] = "flush",
... | [
1,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c | static int blkif_queue_discard_req(struct request *req,
struct blkfront_ring_info *rinfo) {
struct blkfront_info *info = rinfo->dev_info;
struct blkif_request *ring_req, *final_ring_req;
unsigned long id;
id = blkif_ring_get_request(rinfo, req, &final_ring_req);
ring_req = ... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c |
static void xlvbd_flush(struct blkfront_info *info) {
blk_queue_write_cache(info->rq, info->feature_flush ? true : false,
info->feature_fua ? true : false);
pr_info("blkfront: %s: %s %s %s %s %s %s %s\n", info->gd->disk_name,
flush_info(info), "persistent grants:",
info-... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c |
static int setup_blkring(struct xenbus_device *dev,
struct blkfront_ring_info *rinfo) {
struct blkif_sring *sring;
int err;
struct blkfront_info *info = rinfo->dev_info;
unsigned long ring_size = info->nr_ring_pages * XEN_PAGE_SIZE;
err = xenbus_setup_ring(dev, GFP_NOIO, (void **)&... | [
1,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c | static int write_per_ring_nodes(struct xenbus_transaction xbt,
struct blkfront_ring_info *rinfo,
const char *dir) {
int err;
unsigned int i;
const char *message = NULL;
struct blkfront_info *info = rinfo->dev_info;
if (info->nr_ring_pages == 1) ... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c | static int negotiate_mq(struct blkfront_info *info) {
unsigned int backend_max_queues;
unsigned int i;
struct blkfront_ring_info *rinfo;
BUG_ON(info->nr_rings);
backend_max_queues =
xenbus_read_unsigned(info->xbdev->otherend, "multi-queue-max-queues", 1);
info->nr_rings = min(backend_max_queues, xen... | [
0,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c | static void blkfront_gather_backend_features(struct blkfront_info *info) {
unsigned int indirect_segments;
info->feature_flush = 0;
info->feature_fua = 0;
if (xenbus_read_unsigned(info->xbdev->otherend, "feature-barrier", 0)) {
info->feature_flush = 1;
info->feature_fua = 1;
}
/*
* And if ther... | [
1,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c |
static int blkfront_is_ready(struct xenbus_device *dev) {
struct blkfront_info *info = dev_get_drvdata(&dev->dev);
return info->is_ready && info->xbdev;
} | [
1,
0
] |
Linux Kernel | drivers/block/xen-blkfront.c |
static int __init xlblk_init(void) {
int ret;
int nr_cpus = num_online_cpus();
if (!xen_domain())
return -ENODEV;
if (!xen_has_pv_disk_devices())
return -ENODEV;
if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) {
pr_warn("xen_blk: can't get major %d with name %s\n", XENVBD_MAJOR,
DEV_N... | [
0,
0
] |
Linux Kernel | drivers/block/z2ram.c |
static int z2ram_register_disk(int minor) {
struct gendisk *disk;
int err;
disk = blk_mq_alloc_disk(&tag_set, NULL);
if (IS_ERR(disk))
return PTR_ERR(disk);
disk->major = Z2RAM_MAJOR;
disk->first_minor = minor;
disk->minors = 1;
disk->flags |= GENHD_FL_NO_PART;
disk->fops = &z2_fops;
if (mino... | [
1,
0
] |
Linux Kernel | drivers/block/zram/zcomp.c | static int zcomp_strm_init(struct zcomp_strm *zstrm, struct zcomp *comp) {
zstrm->tfm = crypto_alloc_comp(comp->name, 0, 0);
zstrm->buffer = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);
if (IS_ERR_OR_NULL(zstrm->tfm) || !zstrm->buffer) {
zcomp_strm_free(zstrm);
return -ENOMEM;
}
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/zram/zcomp.c |
int zcomp_decompress(struct zcomp_strm *zstrm, const void *src,
unsigned int src_len, void *dst) {
unsigned int dst_len = PAGE_SIZE;
return crypto_comp_decompress(zstrm->tfm, src, src_len, dst, &dst_len);
} | [
1,
0
] |
Linux Kernel | drivers/block/zram/zcomp.c |
int zcomp_cpu_up_prepare(unsigned int cpu, struct hlist_node *node) {
struct zcomp *comp = hlist_entry(node, struct zcomp, node);
struct zcomp_strm *zstrm;
int ret;
zstrm = per_cpu_ptr(comp->stream, cpu);
local_lock_init(&zstrm->lock);
ret = zcomp_strm_init(zstrm, comp);
if (ret)
pr_err("Can't allo... | [
0,
0
] |
Linux Kernel | drivers/block/zram/zram_drv.c | static bool zram_test_flag(struct zram *zram, u32 index,
enum zram_pageflags flag) {
return zram->table[index].flags & BIT(flag);
} | [
0,
0
] |
Linux Kernel | drivers/block/zram/zram_drv.c |
static size_t zram_get_obj_size(struct zram *zram, u32 index) {
return zram->table[index].flags & (BIT(ZRAM_FLAG_SHIFT) - 1);
} | [
0,
0
] |
Linux Kernel | drivers/block/zram/zram_drv.c | static inline bool is_partial_io(struct bio_vec *bvec) {
return bvec->bv_len != PAGE_SIZE;
}
#else | [
0,
0
] |
Linux Kernel | drivers/block/zram/zram_drv.c |
static inline u32 zram_get_priority(struct zram *zram, u32 index) {
u32 prio = zram->table[index].flags >> ZRAM_COMP_PRIORITY_BIT1;
return prio & ZRAM_COMP_PRIORITY_MASK;
} | [
0,
0
] |
Linux Kernel | drivers/block/zram/zram_drv.c |
static void update_position(u32 *index, int *offset, struct bio_vec *bvec) {
*index += (*offset + bvec->bv_len) / PAGE_SIZE;
*offset = (*offset + bvec->bv_len) % PAGE_SIZE;
} | [
0,
0
] |
Linux Kernel | drivers/block/zram/zram_drv.c |
static bool page_same_filled(void *ptr, unsigned long *element) {
unsigned long *page;
unsigned long val;
unsigned int pos, last_pos = PAGE_SIZE / sizeof(*page) - 1;
page = (unsigned long *)ptr;
val = page[0];
if (val != page[last_pos])
return false;
for (pos = 1; pos < last_pos; pos++) {
if (... | [
1,
0
] |
Linux Kernel | drivers/block/zram/zram_drv.c |
static ssize_t disksize_show(struct device *dev, struct device_attribute *attr,
char *buf) {
struct zram *zram = dev_to_zram(dev);
return scnprintf(buf, PAGE_SIZE, "%llu\n", zram->disksize);
} | [
0,
0
] |
Linux Kernel | drivers/block/zram/zram_drv.c | static ssize_t mem_limit_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t len) {
u64 limit;
char *tmp;
struct zram *zram = dev_to_zram(dev);
limit = memparse(buf, &tmp);
if (buf == tmp)
return -EINVAL;
down_w... | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.