Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | drivers/block/loop.c |
static void loop_sysfs_init(struct loop_device *lo) {
lo->sysfs_inited = !sysfs_create_group(&disk_to_dev(lo->lo_disk)->kobj,
&loop_attribute_group);
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c | static inline int queue_on_root_worker(struct cgroup_subsys_state *css) {
return !css;
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c |
static void loop_set_timer(struct loop_device *lo) {
timer_reduce(&lo->timer, jiffies + LOOP_IDLE_WORKER_TIMEOUT);
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c | static void loop_update_rotational(struct loop_device *lo) {
struct file *file = lo->lo_backing_file;
struct inode *file_inode = file->f_mapping->host;
struct block_device *file_bdev = file_inode->i_sb->s_bdev;
struct request_queue *q = lo->lo_queue;
bool nonrot = true;
if (file_bdev)
nonrot = bdev_non... | [
1,
0
] |
Linux Kernel | drivers/block/loop.c |
static void loop_info64_from_old(const struct loop_info *info,
struct loop_info64 *info64) {
memset(info64, 0, sizeof(*info64));
info64->lo_number = info->lo_number;
info64->lo_device = info->lo_device;
info64->lo_inode = info->lo_inode;
info64->lo_rdevice = info->lo_rdevice;... | [
1,
0
] |
Linux Kernel | drivers/block/loop.c |
static int loop_get_status_old(struct loop_device *lo,
struct loop_info __user *arg) {
struct loop_info info;
struct loop_info64 info64;
int err;
if (!arg)
return -EINVAL;
err = loop_get_status(lo, &info64);
if (!err)
err = loop_info64_to_old(&info64, &info);
if (!... | [
1,
0
] |
Linux Kernel | drivers/block/loop.c |
static int loop_set_block_size(struct loop_device *lo, unsigned long arg) {
int err = 0;
if (lo->lo_state != Lo_bound)
return -ENXIO;
err = blk_validate_block_size(arg);
if (err)
return err;
if (lo->lo_queue->limits.logical_block_size == arg)
return 0;
sync_blockdev(lo->lo_device);
invali... | [
1,
0
] |
Linux Kernel | drivers/block/loop.c |
static int lo_simple_ioctl(struct loop_device *lo, unsigned int cmd,
unsigned long arg) {
int err;
err = mutex_lock_killable(&lo->lo_mutex);
if (err)
return err;
switch (cmd) {
case LOOP_SET_CAPACITY:
err = loop_set_capacity(lo);
break;
case LOOP_SET_DIRECT_IO:
e... | [
0,
0
] |
Linux Kernel | drivers/block/loop.c | static int lo_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
unsigned long arg) {
struct loop_device *lo = bdev->bd_disk->private_data;
void __user *argp = (void __user *)arg;
int err;
switch (cmd) {
case LOOP_SET_FD: {
struct loop_config config;
memset(&config... | [
1,
0
] |
Linux Kernel | drivers/block/loop.c | static noinline int loop_info64_to_compat(const struct loop_info64 *info64,
struct compat_loop_info __user *arg) {
struct compat_loop_info info;
memset(&info, 0, sizeof(info));
info.lo_number = info64->lo_number;
info.lo_device = info64->lo_device;
info.lo_inode = in... | [
1,
0
] |
Linux Kernel | drivers/block/loop.c |
static int loop_get_status_compat(struct loop_device *lo,
struct compat_loop_info __user *arg) {
struct loop_info64 info64;
int err;
if (!arg)
return -EINVAL;
err = loop_get_status(lo, &info64);
if (!err)
err = loop_info64_to_compat(&info64, arg);
return err;
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c |
static int lo_compat_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg) {
struct loop_device *lo = bdev->bd_disk->private_data;
int err;
switch (cmd) {
case LOOP_SET_STATUS:
err =
loop_set_status_compat(lo, (const struct compat_loop_info ... | [
1,
0
] |
Linux Kernel | drivers/block/loop.c |
static void loop_rootcg_workfn(struct work_struct *work) {
struct loop_device *lo = container_of(work, struct loop_device, rootcg_work);
loop_process_work(NULL, &lo->rootcg_cmd_list, lo);
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c | static void loop_remove(struct loop_device *lo) {
del_gendisk(lo->lo_disk);
blk_mq_free_tag_set(&lo->tag_set);
mutex_lock(&loop_ctl_mutex);
idr_remove(&loop_index_idr, lo->lo_number);
mutex_unlock(&loop_ctl_mutex);
put_disk(lo->lo_disk);
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c |
static long loop_control_ioctl(struct file *file, unsigned int cmd,
unsigned long parm) {
switch (cmd) {
case LOOP_CTL_ADD:
return loop_add(parm);
case LOOP_CTL_REMOVE:
return loop_control_remove(parm);
case LOOP_CTL_GET_FREE:
return loop_control_get_free(parm);
def... | [
0,
0
] |
Linux Kernel | drivers/block/loop.c | static void __exit loop_exit(void) {
struct loop_device *lo;
int id;
unregister_blkdev(LOOP_MAJOR, "loop");
misc_deregister(&loop_misc);
idr_for_each_entry(&loop_index_idr, lo, id) loop_remove(lo);
idr_destroy(&loop_index_idr);
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c | static int __init max_loop_setup(char *str) {
max_loop = simple_strtol(str, NULL, 0);
return 1;
} | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static inline void mtip_issue_ncq_command(struct mtip_port *port, int tag) {
int group = tag >> 5;
spin_lock(&port->cmd_issue_lock[group]);
writel((1 << MTIP_TAG_BIT(tag)), port->s_active[MTIP_TAG_INDEX(tag)]);
writel((1 << MTIP_TAG_BIT(tag)), port->cmd_issue[MTIP_TAG_INDEX(tag)]);
spin_unlock(&port->cmd_iss... | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static int mtip_enable_fis(struct mtip_port *port, int enable) {
u32 tmp;
tmp = readl(port->mmio + PORT_CMD);
if (enable)
writel(tmp | PORT_CMD_FIS_RX, port->mmio + PORT_CMD);
else
writel(tmp & ~PORT_CMD_FIS_RX, port->mmio + PORT_CMD);
/* Flush */
readl(port->mmio + PORT_CMD);
return (((tmp & P... | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static inline void mtip_deinit_port(struct mtip_port *port) {
writel(0, port->mmio + PORT_IRQ_MASK);
/* Disable the DMA engine */
mtip_enable_engine(port, 0);
/* Disable FIS reception */
mtip_enable_fis(port, 0);
} | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static void print_tags(struct driver_data *dd, char *msg,
unsigned long *tagbits, int cnt) {
unsigned char tagmap[128];
int group, tagmap_len = 0;
memset(tagmap, 0, sizeof(tagmap));
for (group = SLOTBITS_IN_LONGS; group > 0; group--)
tagmap_len += sprintf(tagmap + tagmap_len, "%016lX... | [
1,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static irqreturn_t mtip_irq_handler(int irq, void *instance) {
struct driver_data *dd = instance;
return mtip_handle_irq(dd);
} | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c |
static void mtip_issue_non_ncq_command(struct mtip_port *port, int tag) {
writel(1 << MTIP_TAG_BIT(tag), port->cmd_issue[MTIP_TAG_INDEX(tag)]);
} | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static int mtip_standby_immediate(struct mtip_port *port) {
int rv;
struct host_to_dev_fis fis;
unsigned long __maybe_unused start;
unsigned int timeout;
memset(&fis, 0, sizeof(struct host_to_dev_fis));
fis.type = 0x27;
fis.opts = 1 << 7;
fis.command = ATA_CMD_STANDBYNOW1;
mtip_set_timeout(port->dd,... | [
1,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id,
struct smart_attr *attrib) {
int rv, i;
struct smart_attr *pattr;
if (!attrib)
return -EINVAL;
if (!port->identify_valid) {
dev_warn(&port->dd->pdev->dev, "IDENTIFY DATA not valid\n");
return -EP... | [
1,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c |
static void mtip_hw_debugfs_exit(struct driver_data *dd) {
debugfs_remove_recursive(dd->dfs_node);
} | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static void mtip_detect_product(struct driver_data *dd) {
u32 hwdata;
unsigned int rev, slotgroups;
hwdata = readl(dd->mmio + HOST_HSORG);
dd->product_type = MTIP_PRODUCT_UNKNOWN;
dd->slot_groups = 1;
if (hwdata & 0x8) {
dd->product_type = MTIP_PRODUCT_ASICFPGA;
rev = (hwdata & HSORG_HWREV) >> 8;... | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static int mtip_hw_suspend(struct driver_data *dd) {
if (mtip_standby_drive(dd) != 0) {
dev_err(&dd->pdev->dev, "Failed standby-immediate command\n");
return -EFAULT;
}
/* Disable interrupts on the HBA.*/
writel(readl(dd->mmio + HOST_CTL) & ~HOST_IRQ_EN, dd->mmio + HOST_CTL);
mtip_deinit_port(dd->po... | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static int mtip_block_compat_ioctl(struct block_device *dev, fmode_t mode,
unsigned cmd, unsigned long arg) {
struct driver_data *dd = dev->bd_disk->private_data;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (!dd)
return -ENOTTY;
if (unlikely(test_bit(MTIP_DDF_RE... | [
1,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c |
static inline bool is_stopped(struct driver_data *dd, struct request *rq) {
if (likely(!(dd->dd_flag & MTIP_DDF_STOP_IO)))
return false;
if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))
return true;
if (test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag))
return true;
if (test_bit(MTIP_DDF_WRIT... | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c |
static enum blk_eh_timer_return mtip_cmd_timeout(struct request *req) {
struct driver_data *dd = req->q->queuedata;
if (blk_mq_is_reserved_rq(req)) {
struct mtip_cmd *cmd = blk_mq_rq_to_pdu(req);
cmd->status = BLK_STS_TIMEOUT;
blk_mq_complete_request(req);
return BLK_EH_DONE;
}
if (test_bit(... | [
1,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c |
static int mtip_block_suspend(struct driver_data *dd) {
dev_info(&dd->pdev->dev, "Suspending %s ...\n", dd->disk->disk_name);
mtip_hw_suspend(dd);
return 0;
} | [
1,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c |
static int get_least_used_cpu_on_node(int node) {
int cpu, least_used_cpu, least_cnt;
const struct cpumask *node_mask;
node_mask = cpumask_of_node(node);
least_used_cpu = cpumask_first(node_mask);
least_cnt = cpu_use[least_used_cpu];
cpu = least_used_cpu;
for_each_cpu(cpu, node_mask) {
if (cpu_use[... | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static void mtip_fix_ero_nosnoop(struct driver_data *dd, struct pci_dev *pdev) {
if (pdev->bus && pdev->bus->self) {
if (pdev->bus->self->vendor == PCI_VENDOR_ID_ATI &&
((pdev->bus->self->device & 0xff00) == 0x5a00)) {
mtip_disable_link_opts(dd, pdev->bus->self);
} else {
/* Check further... | [
1,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static void mtip_pci_shutdown(struct pci_dev *pdev) {
struct driver_data *dd = pci_get_drvdata(pdev);
if (dd)
mtip_block_shutdown(dd);
} | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static int __init mtip_init(void) {
int error;
pr_info(MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n");
error = register_blkdev(0, MTIP_DRV_NAME);
if (error <= 0) {
pr_err("Unable to register block device (%d)\n", error);
return -EBUSY;
}
mtip_major = error;
dfs_parent = debugfs_create_dir("rs... | [
0,
0
] |
Linux Kernel | drivers/block/mtip32xx/mtip32xx.c | static void __exit mtip_exit(void) {
unregister_blkdev(mtip_major, MTIP_DRV_NAME);
/* Unregister the PCI driver. */
pci_unregister_driver(&mtip_pci_driver);
debugfs_remove_recursive(dfs_parent);
} | [
0,
0
] |
Linux Kernel | drivers/block/n64cart.c |
static u32 n64cart_read_reg(const u8 reg) { return readl(reg_base + reg); } | [
0,
0
] |
Linux Kernel | drivers/block/n64cart.c |
static void n64cart_submit_bio(struct bio *bio) {
struct bio_vec bvec;
struct bvec_iter iter;
struct device *dev = bio->bi_bdev->bd_disk->private_data;
u32 pos = bio->bi_iter.bi_sector << SECTOR_SHIFT;
bio_for_each_segment(bvec, bio, iter) {
if (!n64cart_do_bvec(dev, &bvec, pos)) {
bio_io_error(bi... | [
1,
0
] |
Linux Kernel | drivers/block/nbd.c |
static inline unsigned int nbd_blksize(struct nbd_config *config) {
return 1u << config->blksize_bits;
} | [
1,
0
] |
Linux Kernel | drivers/block/nbd.c |
static inline struct device *nbd_to_dev(struct nbd_device *nbd) {
return disk_to_dev(nbd->disk);
} | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c |
static ssize_t pid_show(struct device *dev, struct device_attribute *attr,
char *buf) {
struct gendisk *disk = dev_to_disk(dev);
struct nbd_device *nbd = (struct nbd_device *)disk->private_data;
return sprintf(buf, "%d\n", nbd->pid);
} | [
1,
0
] |
Linux Kernel | drivers/block/nbd.c |
static ssize_t backend_show(struct device *dev, struct device_attribute *attr,
char *buf) {
struct gendisk *disk = dev_to_disk(dev);
struct nbd_device *nbd = (struct nbd_device *)disk->private_data;
return sprintf(buf, "%s\n", nbd->backend ?: "");
} | [
1,
0
] |
Linux Kernel | drivers/block/nbd.c |
static void nbd_dev_remove_work(struct work_struct *work) {
nbd_dev_remove(container_of(work, struct nbd_device, remove_work));
} | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c |
static void nbd_mark_nsock_dead(struct nbd_device *nbd, struct nbd_sock *nsock,
int notify) {
if (!nsock->dead && notify && !nbd_disconnected(nbd->config)) {
struct link_dead_args *args;
args = kmalloc(sizeof(struct link_dead_args), GFP_NOIO);
if (args) {
INIT_WORK(&... | [
1,
0
] |
Linux Kernel | drivers/block/nbd.c | static int sock_xmit(struct nbd_device *nbd, int index, int send,
struct iov_iter *iter, int msg_flags, int *sent) {
struct nbd_config *config = nbd->config;
struct socket *sock = config->socks[index]->sock;
int result;
struct msghdr msg;
unsigned int noreclaim_flag;
if (unlikely(!sock... | [
1,
0
] |
Linux Kernel | drivers/block/nbd.c |
static struct socket *nbd_get_socket(struct nbd_device *nbd, unsigned long fd,
int *err) {
struct socket *sock;
*err = 0;
sock = sockfd_lookup(fd, err);
if (!sock)
return NULL;
if (sock->ops->shutdown == sock_no_shutdown) {
dev_err(disk_to_dev(nbd->disk),
... | [
1,
0
] |
Linux Kernel | drivers/block/nbd.c |
static void nbd_bdev_reset(struct nbd_device *nbd) {
if (disk_openers(nbd->disk) > 1)
return;
set_capacity(nbd->disk, 0);
} | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c |
static void send_disconnects(struct nbd_device *nbd) {
struct nbd_config *config = nbd->config;
struct nbd_request request = {
.magic = htonl(NBD_REQUEST_MAGIC),
.type = htonl(NBD_CMD_DISC),
};
struct kvec iov = {.iov_base = &request, .iov_len = sizeof(request)};
struct iov_iter from;
int i, re... | [
1,
0
] |
Linux Kernel | drivers/block/nbd.c |
static int nbd_disconnect(struct nbd_device *nbd) {
struct nbd_config *config = nbd->config;
dev_info(disk_to_dev(nbd->disk), "NBD_DISCONNECT\n");
set_bit(NBD_RT_DISCONNECT_REQUESTED, &config->runtime_flags);
set_bit(NBD_DISCONNECT_REQUESTED, &nbd->flags);
send_disconnects(nbd);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c | static int nbd_start_device(struct nbd_device *nbd) {
struct nbd_config *config = nbd->config;
int num_connections = config->num_connections;
int error = 0, i;
if (nbd->pid)
return -EBUSY;
if (!config->socks)
return -EINVAL;
if (num_connections > 1 && !(config->flags & NBD_FLAG_CAN_MULTI_CONN)) {
... | [
1,
0
] |
Linux Kernel | drivers/block/nbd.c |
static int nbd_dbg_flags_show(struct seq_file *s, void *unused) {
struct nbd_device *nbd = s->private;
u32 flags = nbd->config->flags;
seq_printf(s, "Hex: 0x%08x\n\n", flags);
seq_puts(s, "Known flags:\n");
if (flags & NBD_FLAG_HAS_FLAGS)
seq_puts(s, "NBD_FLAG_HAS_FLAGS\n");
if (flags & NBD_FLAG_REA... | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c |
static int nbd_dbg_init(void) {
struct dentry *dbg_dir;
dbg_dir = debugfs_create_dir("nbd", NULL);
if (!dbg_dir)
return -EIO;
nbd_dbg_dir = dbg_dir;
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c | static void nbd_dbg_close(void) { debugfs_remove_recursive(nbd_dbg_dir); }
#else | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c |
static int nbd_init_request(struct blk_mq_tag_set *set, struct request *rq,
unsigned int hctx_idx, unsigned int numa_node) {
struct nbd_cmd *cmd = blk_mq_rq_to_pdu(rq);
cmd->nbd = set->driver_data;
cmd->flags = 0;
mutex_init(&cmd->lock);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c |
static int nbd_genl_size_set(struct genl_info *info, struct nbd_device *nbd) {
struct nbd_config *config = nbd->config;
u64 bsize = nbd_blksize(config);
u64 bytes = config->bytesize;
if (info->attrs[NBD_ATTR_SIZE_BYTES])
bytes = nla_get_u64(info->attrs[NBD_ATTR_SIZE_BYTES]);
if (info->attrs[NBD_ATTR_BL... | [
1,
0
] |
Linux Kernel | drivers/block/nbd.c |
static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info) {
struct nlattr *dev_list;
struct sk_buff *reply;
void *reply_head;
size_t msg_size;
int index = -1;
int ret = -ENOMEM;
if (info->attrs[NBD_ATTR_INDEX])
index = nla_get_u32(info->attrs[NBD_ATTR_INDEX]);
mutex_lock(&nbd_index_... | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c |
static void nbd_connect_reply(struct genl_info *info, int index) {
struct sk_buff *skb;
void *msg_head;
int ret;
skb = genlmsg_new(nla_total_size(sizeof(u32)), GFP_KERNEL);
if (!skb)
return;
msg_head = genlmsg_put_reply(skb, info, &nbd_genl_family, 0, NBD_CMD_CONNECT);
if (!msg_head) {
nlmsg_fre... | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c |
static void nbd_mcast_index(int index) {
struct sk_buff *skb;
void *msg_head;
int ret;
skb = genlmsg_new(nla_total_size(sizeof(u32)), GFP_KERNEL);
if (!skb)
return;
msg_head = genlmsg_put(skb, 0, 0, &nbd_genl_family, 0, NBD_CMD_LINK_DEAD);
if (!msg_head) {
nlmsg_free(skb);
return;
}
ret ... | [
0,
0
] |
Linux Kernel | drivers/block/nbd.c | static int __init nbd_init(void) {
int i;
BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
if (max_part < 0) {
pr_err("max_part must be >= 0\n");
return -EINVAL;
}
part_shift = 0;
if (max_part > 0) {
part_shift = fls(max_part);
max_part = (1UL << part_shift) - 1;
}
if ((1UL << part_s... | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static inline u64 mb_per_tick(int mbps) {
return (1 << 20) / TICKS_PER_SEC * ((u64)mbps);
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static int null_param_store_val(const char *str, int *val, int min, int max) {
int ret, new_val;
ret = kstrtoint(str, 10, &new_val);
if (ret)
return -EINVAL;
if (new_val < min || new_val > max)
return -EINVAL;
*val = new_val;
return 0;
} | [
1,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static ssize_t nullb_device_uint_attr_store(unsigned int *val, const char *page,
size_t count) {
unsigned int tmp;
int result;
result = kstrtouint(page, 0, &tmp);
if (result < 0)
return result;
*val = tmp;
return count;
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static ssize_t nullb_device_badblocks_show(struct config_item *item,
char *page) {
struct nullb_device *t_dev = to_nullb_device(item);
return badblocks_show(&t_dev->badblocks, page, 0);
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static ssize_t nullb_device_zone_readonly_store(struct config_item *item,
const char *page,
size_t count) {
struct nullb_device *dev = to_nullb_device(item);
return zone_cond_store(dev, page, count, BLK_ZONE_COND_READO... | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static ssize_t nullb_device_zone_offline_store(struct config_item *item,
const char *page, size_t count) {
struct nullb_device *dev = to_nullb_device(item);
return zone_cond_store(dev, page, count, BLK_ZONE_COND_OFFLINE);
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static struct nullb_device *null_alloc_dev(void) {
struct nullb_device *dev;
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev)
return NULL;
INIT_RADIX_TREE(&dev->data, GFP_ATOMIC);
INIT_RADIX_TREE(&dev->cache, GFP_ATOMIC);
if (badblocks_init(&dev->badblocks, 0)) {
kfree(dev);
return NULL;
}... | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static void free_cmd(struct nullb_cmd *cmd) { put_tag(cmd->nq, cmd->tag); } | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static void end_cmd(struct nullb_cmd *cmd) {
int queue_mode = cmd->nq->dev->queue_mode;
switch (queue_mode) {
case NULL_Q_MQ:
blk_mq_end_request(cmd->rq, cmd->error);
return;
case NULL_Q_BIO:
cmd->bio->bi_status = cmd->error;
bio_endio(cmd->bio);
break;
}
free_cmd(cmd);
} | [
1,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static void null_cmd_end_timer(struct nullb_cmd *cmd) {
ktime_t kt = cmd->nq->dev->completion_nsec;
hrtimer_start(&cmd->timer, kt, HRTIMER_MODE_REL);
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static struct nullb_page *null_lookup_page(struct nullb *nullb, sector_t sector,
bool for_write, bool ignore_cache) {
struct nullb_page *page = NULL;
if (!ignore_cache)
page = __null_lookup_page(nullb, sector, for_write, true);
if (page)
return page;
return _... | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static struct nullb_page *null_insert_page(struct nullb *nullb, sector_t sector,
bool ignore_cache)
__releases(&nullb->lock) | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static int copy_to_nullb(struct nullb *nullb, struct page *source,
unsigned int off, sector_t sector, size_t n,
bool is_fua) {
size_t temp, count = 0;
unsigned int offset;
struct nullb_page *t_page;
void *dst, *src;
while (count < n) {
temp = min_t(size_... | [
1,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static int null_handle_bio(struct nullb_cmd *cmd) {
struct bio *bio = cmd->bio;
struct nullb *nullb = cmd->nq->dev->nullb;
int err;
unsigned int len;
sector_t sector = bio->bi_iter.bi_sector;
struct bio_vec bvec;
struct bvec_iter iter;
spin_lock_irq(&nullb->lock);
bio_for_each_segment(bvec, bio, ite... | [
1,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
blk_status_t null_process_cmd(struct nullb_cmd *cmd, enum req_op op,
sector_t sector, unsigned int nr_sectors) {
struct nullb_device *dev = cmd->nq->dev;
blk_status_t ret;
if (dev->badblocks.shift != -1) {
ret = null_handle_badblocks(cmd, sector, nr_sectors);
if (ret != BLK... | [
1,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static struct nullb_queue *nullb_to_queue(struct nullb *nullb) {
int index = 0;
if (nullb->nr_queues != 1)
index = raw_smp_processor_id() /
((nr_cpu_ids + nullb->nr_queues - 1) / nullb->nr_queues);
return &nullb->queues[index];
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static int null_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob) {
struct nullb_queue *nq = hctx->driver_data;
LIST_HEAD(list);
int nr = 0;
spin_lock(&nq->poll_lock);
list_splice_init(&nq->poll_list, &list);
spin_unlock(&nq->poll_lock);
while (!list_empty(&list)) {
struct nullb_cmd *cmd;... | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static int setup_queues(struct nullb *nullb) {
int nqueues = nr_cpu_ids;
if (g_poll_queues)
nqueues += g_poll_queues;
nullb->queues = kcalloc(nqueues, sizeof(struct nullb_queue), GFP_KERNEL);
if (!nullb->queues)
return -ENOMEM;
nullb->queue_depth = nullb->dev->hw_queue_depth;
return 0;
} | [
1,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static int init_driver_queues(struct nullb *nullb) {
struct nullb_queue *nq;
int i, ret = 0;
for (i = 0; i < nullb->dev->submit_queues; i++) {
nq = &nullb->queues[i];
null_init_queue(nullb, nq);
ret = setup_commands(nq);
if (ret)
return ret;
nullb->nr_queues++;
}
return 0;
} | [
1,
0
] |
Linux Kernel | drivers/block/null_blk/main.c |
static int null_init_tag_set(struct nullb *nullb, struct blk_mq_tag_set *set) {
unsigned int flags = BLK_MQ_F_SHOULD_MERGE;
int hw_queues, numa_node;
unsigned int queue_depth;
int poll_queues;
if (nullb) {
hw_queues = nullb->dev->submit_queues;
poll_queues = nullb->dev->poll_queues;
queue_depth ... | [
1,
0
] |
Linux Kernel | drivers/block/null_blk/main.c | static bool __null_setup_fault(struct fault_attr *attr, char *str) {
if (!str[0])
return true;
if (!setup_fault_attr(attr, str))
return false;
attr->verbose = 0;
return true;
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/null_blk.h | static inline blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd,
enum req_op op,
sector_t sector,
sector_t nr_sectors) {
return BLK_STS_NOTSUPP;
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/null_blk.h | static inline ssize_t zone_cond_store(struct nullb_device *dev,
const char *page, size_t count,
enum blk_zone_cond cond) {
return -EOPNOTSUPP;
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/trace.c | const char *nullb_trace_disk_name(struct trace_seq *p, char *name) {
const char *ret = trace_seq_buffer_ptr(p);
if (name && *name)
trace_seq_printf(p, "disk=%s, ", name);
trace_seq_putc(p, 0);
return ret;
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/zoned.c |
static inline void null_init_zone_lock(struct nullb_device *dev,
struct nullb_zone *zone) {
if (!dev->memory_backed)
spin_lock_init(&zone->spinlock);
else
mutex_init(&zone->mutex);
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/zoned.c |
static inline void null_unlock_zone(struct nullb_device *dev,
struct nullb_zone *zone) {
if (!dev->memory_backed)
spin_unlock_irq(&zone->spinlock);
else
mutex_unlock(&zone->mutex);
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/zoned.c |
void null_free_zoned_dev(struct nullb_device *dev) {
kvfree(dev->zones);
dev->zones = NULL;
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/zoned.c |
static void null_close_imp_open_zone(struct nullb_device *dev) {
struct nullb_zone *zone;
unsigned int zno, i;
zno = dev->imp_close_zone_no;
if (zno >= dev->nr_zones)
zno = dev->zone_nr_conv;
for (i = dev->zone_nr_conv; i < dev->nr_zones; i++) {
zone = &dev->zones[zno];
zno++;
if (zno >= de... | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/zoned.c |
static blk_status_t null_check_active(struct nullb_device *dev) {
if (!dev->zone_max_active)
return BLK_STS_OK;
if (dev->nr_zones_exp_open + dev->nr_zones_imp_open + dev->nr_zones_closed <
dev->zone_max_active)
return BLK_STS_OK;
return BLK_STS_ZONE_ACTIVE_RESOURCE;
} | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/zoned.c |
static blk_status_t null_check_open(struct nullb_device *dev) {
if (!dev->zone_max_open)
return BLK_STS_OK;
if (dev->nr_zones_exp_open + dev->nr_zones_imp_open < dev->zone_max_open)
return BLK_STS_OK;
if (dev->nr_zones_imp_open) {
if (null_check_active(dev) == BLK_STS_OK) {
null_close_imp_ope... | [
0,
0
] |
Linux Kernel | drivers/block/null_blk/zoned.c | static blk_status_t null_reset_zone(struct nullb_device *dev,
struct nullb_zone *zone) {
if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
return BLK_STS_IOERR;
null_lock_zone_res(dev);
switch (zone->cond) {
case BLK_ZONE_COND_EMPTY:
null_unlock_zone_res(dev);
retu... | [
0,
0
] |
Linux Kernel | drivers/block/paride/aten.c |
static void __exit aten_exit(void) { paride_unregister(&aten); } | [
0,
0
] |
Linux Kernel | drivers/block/paride/bpck.c |
static void bpck_read_block(PIA *pi, char *buf, int count)
{
int i, l, h;
switch (pi->mode) {
case 0:
WR(4, 0x40);
w0(0x40);
t2(2);
for (i = 0; i < count; i++) {
t2(4);
l = r1();
t2(4);
h = r1();
buf[i] = j44(l, h);
}
WR(4, 0);
break;
case 1:
WR... | [
1,
0
] |
Linux Kernel | drivers/block/paride/bpck.c | static void bpck_connect(PIA *pi)
{
pi->saved_r0 = r0();
w0(0xff - pi->unit);
w2(4);
w0(pi->unit);
t2(8);
t2(8);
t2(8);
t2(2);
t2(2);
switch (pi->mode) {
case 0:
t2(8);
WR(4, 0);
break;
case 1:
t2(8);
WR(4, 0x10);
break;
case 2:
case 3:
case 4:
w2(0);
W... | [
1,
0
] |
Linux Kernel | drivers/block/paride/bpck.c |
static void bpck_read_eeprom(PIA *pi, char *buf)
{
int i, j, k, p, v, f, om, od;
bpck_force_spp(pi);
om = pi->mode;
od = pi->delay;
pi->mode = 0;
pi->delay = 6;
bpck_connect(pi);
WR(4, 0);
for (i = 0; i < 64; i++) {
WR(6, 8);
WR(6, 0xc);
p = 0x100;
for (k = 0; k < 9; k++) {
... | [
1,
0
] |
Linux Kernel | drivers/block/paride/bpck.c | static int bpck_test_port(PIA *pi)
{
int i, r, m;
w2(0x2c);
i = r0();
w0(255 - i);
r = r0();
w0(i);
m = -1;
if (r == i)
m = 2;
if (r == (255 - i))
m = 0;
w2(0xc);
i = r0();
w0(255 - i);
r = r0();
w0(i);
if (r != (255 - i))
m = -1;
if (m == 0) {
w2(6);
w2(0xc);
... | [
1,
0
] |
Linux Kernel | drivers/block/paride/bpck6.c | static void bpck6_write_regr(PIA *pi, int cont, int reg, int val) {
if (reg >= 0 && reg <= 7 && cont >= 0 && cont <= 1) {
ppc6_wr_port(PPCSTRUCT(pi), cont ? reg | 8 : reg, (u8)val);
}
} | [
0,
0
] |
Linux Kernel | drivers/block/paride/bpck6.c |
static void bpck6_read_block(PIA *pi, char *buf, int len) {
ppc6_rd_port16_blk(PPCSTRUCT(pi), ATAPI_DATA, buf, (u32)len >> 1);
} | [
0,
0
] |
Linux Kernel | drivers/block/paride/comm.c |
static void comm_write_regr(PIA *pi, int cont, int regr, int val)
{
int r;
r = regr + cont_map[cont];
switch (pi->mode) {
case 0:
case 1:
w0(r);
P1;
w0(val);
P2;
break;
case 2:
case 3:
case 4:
w3(r);
(void)r1();
w4(val);
break;
}
} | [
1,
0
] |
Linux Kernel | drivers/block/paride/comm.c |
static void comm_read_block(PIA *pi, char *buf, int count)
{
int i, l, h;
switch (pi->mode) {
case 0:
w0(0x48);
P1;
for (i = 0; i < count; i++) {
w0(0);
w2(6);
l = r1();
w0(0x80);
h = r1();
w2(4);
buf[i] = j44(l, h);
}
break;
case 1:
w0(0x68... | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.