Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | drivers/block/amiflop.c |
static int fd_calibrate(int drive) {
unsigned char prb;
int n;
drive &= 3;
get_fdc(drive);
if (!fd_motor_on(drive))
return 0;
fd_select(drive);
prb = ciab.prb;
prb |= DSKSIDE;
prb &= ~DSKDIREC;
ciab.prb = prb;
for (n = unit[drive].type->tracks / 2; n != 0; --n) {
if (ciaa.pra & DSKTRACK0... | [
1,
0
] |
Linux Kernel | drivers/block/amiflop.c | static unsigned long fd_get_drive_id(int drive) {
int i;
ulong id = 0;
drive &= 3;
get_fdc(drive);
MOTOR_ON;
udelay(2);
SELECT(SELMASK(drive));
udelay(2);
DESELECT(SELMASK(drive));
udelay(2);
MOTOR_OFF;
udelay(2);
SELECT(SELMASK(drive));
udelay(2);
DESELECT(SELMASK(drive));
udelay(2);
... | [
1,
0
] |
Linux Kernel | drivers/block/amiflop.c | static irqreturn_t fd_block_done(int irq, void *dummy) {
if (block_flag)
custom.dsklen = 0x4000;
if (block_flag == 2) {
writepending = 2;
post_write_timer.expires = jiffies + 1; /* at least 2 ms */
post_write_timer_drive = selected;
add_timer(&post_write_timer);
} else { /* reading */
blo... | [
1,
0
] |
Linux Kernel | drivers/block/amiflop.c | static unsigned long decode(unsigned long *data, unsigned long *raw, int len) {
ulong *odd, *even;
len >>= 2;
odd = raw;
even = odd + len;
/* prepare return pointer */
raw += len * 2;
do {
*data++ = ((*odd++ & 0x55555555) << 1) | (*even++ & 0x55555555);
} while (--len != 0);
return (ulong)raw;... | [
1,
0
] |
Linux Kernel | drivers/block/amiflop.c | static inline ushort dos_hdr_crc(struct dos_header *hdr) {
return dos_crc(&(hdr->track), 0xb2, 0x30, 3);
} | [
0,
0
] |
Linux Kernel | drivers/block/amiflop.c | static inline ushort dos_data_crc(unsigned char *data) {
return dos_crc(data, 0xe2, 0x95, 511);
} | [
0,
0
] |
Linux Kernel | drivers/block/amiflop.c | static void flush_track_callback(struct timer_list *timer) {
unsigned long nr =
((unsigned long)timer - (unsigned long)&flush_track_timer[0]) /
sizeof(flush_track_timer[0]);
nr &= 3;
writefromint = 1;
if (!try_fdc(nr)) {
flush_track_timer[nr].expires = jiffies + 1;
add_timer(flush_track_ti... | [
1,
1
] |
Linux Kernel | drivers/block/amiflop.c | static blk_status_t amiflop_rw_cur_segment(struct amiga_floppy_struct *floppy,
struct request *rq) {
int drive = floppy - unit;
unsigned int cnt, block, track, sector;
char *data;
for (cnt = 0; cnt < blk_rq_cur_sectors(rq); cnt++) {
#ifdef DEBUG
printk("fd: sector... | [
1,
0
] |
Linux Kernel | drivers/block/amiflop.c |
static blk_status_t amiflop_queue_rq(struct blk_mq_hw_ctx *hctx,
const struct blk_mq_queue_data *bd) {
struct request *rq = bd->rq;
struct amiga_floppy_struct *floppy = rq->q->disk->private_data;
blk_status_t err;
if (!spin_trylock_irq(&amiflop_lock))
return BLK_STS_DE... | [
1,
0
] |
Linux Kernel | drivers/block/amiflop.c |
static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
unsigned long param) {
int ret;
mutex_lock(&amiflop_mutex);
ret = fd_locked_ioctl(bdev, mode, cmd, param);
mutex_unlock(&amiflop_mutex);
return ret;
} | [
0,
0
] |
Linux Kernel | drivers/block/amiflop.c |
static int __init amiga_floppy_init(void) {
return platform_driver_probe(&amiga_floppy_driver, amiga_floppy_probe);
} | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoeblk.c | static ssize_t aoedisk_show_mac(struct device *dev,
struct device_attribute *attr, char *page) {
struct gendisk *disk = dev_to_disk(dev);
struct aoedev *d = disk->private_data;
struct aoetgt *t = d->targets[0];
if (t == NULL)
return sysfs_emit(page, "none\n");
return sysfs... | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoeblk.c | static ssize_t aoedisk_show_netif(struct device *dev,
struct device_attribute *attr, char *page) {
struct gendisk *disk = dev_to_disk(dev);
struct aoedev *d = disk->private_data;
struct net_device *nds[8], **nd, **nnd, **ne;
struct aoetgt **t, **te;
struct aoeif *ifp, *e;
c... | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoeblk.c |
int __init aoeblk_init(void) {
buf_pool_cache =
kmem_cache_create("aoe_bufs", sizeof(struct buf), 0, 0, NULL);
if (buf_pool_cache == NULL)
return -ENOMEM;
aoe_debugfs_dir = debugfs_create_dir("aoe", NULL);
return 0;
} | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoechr.c | static int revalidate(const char __user *str, size_t size) {
int major, minor, n;
ulong flags;
struct aoedev *d;
struct sk_buff *skb;
char buf[16];
if (size >= sizeof buf)
return -EINVAL;
buf[sizeof buf - 1] = '\0';
if (copy_from_user(buf, str, size))
return -EFAULT;
n = sscanf(buf, "e%d.%d"... | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoechr.c |
void aoechr_error(char *msg) {
struct ErrMsg *em;
char *mp;
ulong flags, n;
n = strlen(msg);
spin_lock_irqsave(&emsgs_lock, flags);
em = emsgs + emsgs_tail_idx;
if ((em->flags & EMFL_VALID)) {
bail:
spin_unlock_irqrestore(&emsgs_lock, flags);
return;
}
mp = kmemdup(msg, n, GFP_ATOMIC);
... | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoechr.c |
static ssize_t aoechr_write(struct file *filp, const char __user *buf,
size_t cnt, loff_t *offp) {
int ret = -EINVAL;
switch ((unsigned long)filp->private_data) {
default:
printk(KERN_INFO "aoe: can't write to that file.\n");
break;
case MINOR_DISCOVER:
ret = discover()... | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoechr.c |
int __init aoechr_init(void) {
int n, i;
n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
if (n < 0) {
printk(KERN_ERR "aoe: can't register char device\n");
return n;
}
init_completion(&emsgs_comp);
spin_lock_init(&emsgs_lock);
aoe_class = class_create(THIS_MODULE, "aoe");
if (IS_ERR(aoe_c... | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static struct sk_buff *new_skb(ulong len) {
struct sk_buff *skb;
skb = alloc_skb(len + MAX_HEADER, GFP_ATOMIC);
if (skb) {
skb_reserve(skb, MAX_HEADER);
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb->protocol = __constant_htons(ETH_P_AOE);
skb_checksum_none_assert(skb);
}
... | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static struct frame *getframe(struct aoedev *d, u32 tag) {
struct frame *f;
struct list_head *head, *pos, *nx;
u32 n;
n = tag % NFACTIVE;
head = &d->factive[n];
list_for_each_safe(pos, nx, head) {
f = list_entry(pos, struct frame, head);
if (f->tag == tag) {
list_del(pos);
return f;
... | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c | static int newtag(struct aoedev *d) {
register ulong n;
n = jiffies & 0xffff;
return n | (++d->lasttag & 0x7fff) << 16;
} | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static u32 aoehdr_atainit(struct aoedev *d, struct aoetgt *t,
struct aoe_hdr *h) {
u32 host_tag = newtag(d);
memcpy(h->src, t->ifp->nd->dev_addr, sizeof h->src);
memcpy(h->dst, t->addr, sizeof h->dst);
h->type = __constant_cpu_to_be16(ETH_P_AOE);
h->verfl = AOE_HVER;
h->major = c... | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static void skb_pool_put(struct aoedev *d, struct sk_buff *skb) {
__skb_queue_tail(&d->skbpool, skb);
} | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static void fhash(struct frame *f) {
struct aoedev *d = f->t->d;
u32 n;
n = f->tag % NFACTIVE;
list_add_tail(&f->head, &d->factive[n]);
} | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static void ejectif(struct aoetgt *t, struct aoeif *ifp) {
struct aoeif *e;
struct net_device *nd;
ulong n;
nd = ifp->nd;
e = t->ifs + NAOEIFS - 1;
n = (e - ifp) * sizeof *ifp;
memmove(ifp, ifp + 1, n);
e->nd = NULL;
dev_put(nd);
} | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static void probe(struct aoetgt *t) {
struct aoedev *d;
struct frame *f;
struct sk_buff *skb;
struct sk_buff_head queue;
size_t n, m;
int frag;
d = t->d;
f = newtframe(d, t);
if (!f) {
pr_err("%s %pm for e%ld.%d: %s\n", "aoe: cannot probe remote address",
t->addr, (long)d->aoemajor, d... | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static long rto(struct aoedev *d) {
long t;
t = 2 * d->rttavg >> RTTSCALE;
t += 8 * d->rttdev >> RTTDSCALE;
if (t == 0)
t = 1;
return t;
} | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c | void aoecmd_sleepwork(struct work_struct *work) {
struct aoedev *d = container_of(work, struct aoedev, work);
if (d->flags & DEVFL_GDALLOC)
aoeblk_gdalloc(d);
if (d->flags & DEVFL_NEWSIZE) {
set_capacity_and_notify(d->gd, d->ssize);
spin_lock_irq(&d->lock);
d->flags |= DEVFL_UP;
d->flags &=... | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static void ata_ident_fixstring(u16 *id, int ns) {
u16 s;
while (ns-- > 0) {
s = *id;
*id++ = s >> 8 | s << 8;
}
} | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static void aoe_end_buf(struct aoedev *d, struct buf *buf) {
struct request *rq = buf->rq;
struct aoe_req *req = blk_mq_rq_to_pdu(rq);
if (buf == d->ip.buf)
d->ip.buf = NULL;
mempool_free(buf, d->bufpool);
if (--req->nr_bios == 0)
aoe_end_request(d, rq, 0);
} | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
void aoecmd_cfg(ushort aoemajor, unsigned char aoeminor) {
struct sk_buff_head queue;
__skb_queue_head_init(&queue);
aoecmd_cfg_pkts(aoemajor, aoeminor, &queue);
aoenet_xmit(&queue);
} | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
static struct aoetgt *addtgt(struct aoedev *d, char *addr, ulong nframes) {
struct aoetgt *t, **tt, **te;
tt = d->targets;
te = tt + d->ntargets;
for (; tt < te && *tt; tt++)
;
if (tt == te) {
tt = grow_targets(d);
if (!tt)
goto nomem;
}
t = kzalloc(sizeof(*t), GFP_ATOMIC);
if (!t)
... | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c | static void setifbcnt(struct aoetgt *t, struct net_device *nd, int bcnt) {
struct aoedev *d;
struct aoeif *p, *e;
int minbcnt;
d = t->d;
minbcnt = bcnt;
p = t->ifs;
e = p + NAOEIFS;
for (; p < e; p++) {
if (p->nd == NULL)
break;
if (p->nd == nd) {
p->bcnt = bcnt; /* we're updating *... | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoecmd.c |
void aoe_flush_iocq(void) {
int i;
for (i = 0; i < ncpus; i++) {
if (kts[i].active)
aoe_flush_iocq_by_index(i);
}
} | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoedev.c |
static void aoe_failip(struct aoedev *d) {
struct request *rq;
struct aoe_req *req;
struct bio *bio;
aoe_failbuf(d, d->ip.buf);
rq = d->ip.rq;
if (rq == NULL)
return;
req = blk_mq_rq_to_pdu(rq);
while ((bio = d->ip.nxbio)) {
bio->bi_status = BLK_STS_IOERR;
d->ip.nxbio = bio->bi_next;
... | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoedev.c | static int user_req(char *s, size_t slen, struct aoedev *d) {
const char *p;
size_t lim;
if (!d->gd)
return 0;
p = kbasename(d->gd->disk_name);
lim = sizeof(d->gd->disk_name);
lim -= p - d->gd->disk_name;
if (slen < lim)
lim = slen;
return !strncmp(s, p, lim);
} | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoedev.c |
static void freedev(struct aoedev *d) {
struct aoetgt **t, **e;
int freeing = 0;
unsigned long flags;
spin_lock_irqsave(&d->lock, flags);
if (d->flags & DEVFL_TKILL && !(d->flags & DEVFL_FREEING)) {
d->flags |= DEVFL_FREEING;
freeing = 1;
}
spin_unlock_irqrestore(&d->lock, flags);
if (!freeing... | [
1,
0
] |
Linux Kernel | drivers/block/aoe/aoedev.c |
int aoedev_flush(const char __user *str, size_t cnt) {
return flush(str, cnt, NOT_EXITING);
} | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoedev.c |
void aoedev_exit(void) {
flush_workqueue(aoe_wq);
flush(NULL, 0, EXITING);
} | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoemain.c | static void discover_timer(struct timer_list *t) {
mod_timer(t, jiffies + HZ * 60);
aoecmd_cfg(0xffff, 0xff);
} | [
0,
0
] |
Linux Kernel | drivers/block/aoe/aoenet.c |
int set_aoe_iflist(const char __user *user_str, size_t size) {
if (size >= IFLISTSZ)
return -EINVAL;
if (copy_from_user(aoe_iflist, user_str, size)) {
printk(KERN_INFO "aoe: copy from user failed\n");
return -EFAULT;
}
aoe_iflist[size] = 0x00;
return 0;
} | [
1,
0
] |
Linux Kernel | drivers/block/ataflop.c |
static inline void start_motor_off_timer(void) {
mod_timer(&motor_off_timer, jiffies + FD_MOTOR_OFF_DELAY);
MotorOffTrys = 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/ataflop.c |
static inline void stop_timeout(void) { del_timer(&timeout_timer); } | [
0,
0
] |
Linux Kernel | drivers/block/ataflop.c | static void fd_motor_off_timer(struct timer_list *unused) {
unsigned char status;
if (SelectedDrive < 0)
return;
if (stdma_islocked())
goto retry;
status = FDC_READ(FDCREG_STATUS);
if (!(status & 0x80)) {
/* motor already turned off by FDC -> deselect drives */
MotorOn = 0;
fd_deselec... | [
1,
0
] |
Linux Kernel | drivers/block/ataflop.c | static void check_change(struct timer_list *unused) {
static int drive = 0;
unsigned long flags;
unsigned char old_porta;
int stat;
if (++drive > 1 || !UD.connected)
drive = 0;
local_irq_save(flags);
if (!stdma_islocked()) {
sound_ym.rd_data_reg_sel = 14;
old_porta = sound_ym.rd_data_reg_s... | [
1,
0
] |
Linux Kernel | drivers/block/ataflop.c | static void do_fd_action(int drive) {
DPRINT(("do_fd_action\n"));
if (UseTrackbuffer && !IsFormatting) {
repeat:
if (IS_BUFFERED(drive, ReqSide, ReqTrack)) {
if (ReqCmd == READ) {
copy_buffer(SECTOR_BUFFER(ReqSector), ReqData);
if (++ReqCnt < blk_rq_cur_sectors(fd_request)) {
... | [
1,
0
] |
Linux Kernel | drivers/block/ataflop.c | static void fd_seek_done(int status) {
DPRINT(("fd_seek_done()\n"));
stop_timeout();
if (ATARIHW_PRESENT(FDCSPEED))
dma_wd.fdc_speed = SUDT->fdc_speed;
if (status & FDCSTAT_RECNF) {
printk(KERN_ERR "fd%d: seek error (to track %d)\n", SelectedDrive,
ReqTrack);
/* we don't know exactly whi... | [
1,
0
] |
Linux Kernel | drivers/block/ataflop.c | static void fd_readtrack_check(struct timer_list *unused) {
unsigned long flags, addr, addr2;
local_irq_save(flags);
if (!MultReadInProgress) {
local_irq_restore(flags);
return;
}
/* get the current DMA address */
/* ++ f.a. read twice to avoid being fooled by switcher */
addr = 0;
do {
... | [
1,
0
] |
Linux Kernel | drivers/block/ataflop.c | static void finish_fdc(void) {
if (!NeedSeek || !stdma_is_locked_by(floppy_irq)) {
finish_fdc_done(0);
} else {
DPRINT(("finish_fdc: dummy seek started\n"));
FDC_WRITE(FDCREG_DATA, SUD.track);
SET_IRQ_HANDLER(finish_fdc_done);
FDC_WRITE(FDCREG_CMD, FDCCMD_SEEK);
MotorOn = 1;
start_timeou... | [
0,
0
] |
Linux Kernel | drivers/block/ataflop.c | static void finish_fdc_done(int dummy) {
unsigned long flags;
DPRINT(("finish_fdc_done entered\n"));
stop_timeout();
NeedSeek = 0;
if (timer_pending(&fd_timer) && time_before(fd_timer.expires, jiffies + 5))
mod_timer(&fd_timer, jiffies + 5);
else
start_check_change_timer();
start_motor_off_time... | [
0,
0
] |
Linux Kernel | drivers/block/ataflop.c | static int floppy_open(struct block_device *bdev, fmode_t mode) {
struct atari_floppy_struct *p = bdev->bd_disk->private_data;
int type = MINOR(bdev->bd_dev) >> 2;
DPRINT(("fd_open: type=%d\n", type));
if (p->ref && p->type != type)
return -EBUSY;
if (p->ref == -1 || (p->ref && mode & FMODE_EXCL))
r... | [
1,
0
] |
Linux Kernel | drivers/block/ataflop.c |
static int ataflop_alloc_disk(unsigned int drive, unsigned int type) {
struct gendisk *disk;
disk = blk_mq_alloc_disk(&unit[drive].tag_set, NULL);
if (IS_ERR(disk))
return PTR_ERR(disk);
disk->major = FLOPPY_MAJOR;
disk->first_minor = drive + (type << 2);
disk->minors = 1;
sprintf(disk->disk_name, ... | [
1,
0
] |
Linux Kernel | drivers/block/ataflop.c |
static void atari_floppy_cleanup(void) {
int i;
int type;
for (i = 0; i < FD_MAX_UNITS; i++) {
for (type = 0; type < NUM_DISK_MINORS; type++) {
if (!unit[i].disk[type])
continue;
del_gendisk(unit[i].disk[type]);
put_disk(unit[i].disk[type]);
}
blk_mq_free_tag_set(&unit[i].t... | [
0,
0
] |
Linux Kernel | drivers/block/ataflop.c | static int __init atari_floppy_setup(char *str) {
int ints[3 + FD_MAX_UNITS];
int i;
if (!MACH_IS_ATARI)
return 0;
str = get_options(str, 3 + FD_MAX_UNITS, ints);
if (ints[0] < 1) {
printk(KERN_ERR "ataflop_setup: no arguments!\n");
return 0;
} else if (ints[0] > 2 + FD_MAX_UNITS) {
print... | [
1,
0
] |
Linux Kernel | drivers/block/ataflop.c |
static void __exit atari_floppy_exit(void) {
unregister_blkdev(FLOPPY_MAJOR, "fd");
atari_floppy_cleanup();
} | [
0,
0
] |
Linux Kernel | drivers/block/brd.c | static struct page *brd_lookup_page(struct brd_device *brd, sector_t sector) {
pgoff_t idx;
struct page *page;
rcu_read_lock();
idx = sector >> PAGE_SECTORS_SHIFT; /* sector to page index */
page = radix_tree_lookup(&brd->brd_pages, idx);
rcu_read_unlock();
BUG_ON(page && page->index != idx);
return ... | [
1,
0
] |
Linux Kernel | drivers/block/brd.c | static int brd_do_bvec(struct brd_device *brd, struct page *page,
unsigned int len, unsigned int off, enum req_op op,
sector_t sector) {
void *mem;
int err = 0;
if (op_is_write(op)) {
err = copy_to_brd_setup(brd, sector, len);
if (err)
goto out;
}
... | [
0,
0
] |
Linux Kernel | drivers/block/brd.c | static int __init ramdisk_size(char *str) {
rd_size = simple_strtol(str, NULL, 0);
return 1;
} | [
0,
0
] |
Linux Kernel | drivers/block/brd.c | static int brd_alloc(int i) {
struct brd_device *brd;
struct gendisk *disk;
char buf[DISK_NAME_LEN];
int err = -ENOMEM;
list_for_each_entry(brd, &brd_devices,
brd_list) if (brd->brd_number == i) return -EEXIST;
brd = kzalloc(sizeof(*brd), GFP_KERNEL);
if (!brd)
return -ENOMEM;
... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_actlog.c | static unsigned int al_extent_to_bm_page(unsigned int al_enr) {
return al_enr >>
((PAGE_SHIFT + 3) -
/* al extent number to bit */
(AL_EXTENT_SHIFT - BM_BLOCK_SHIFT));
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_actlog.c | void drbd_al_begin_io_commit(struct drbd_device *device) {
bool locked = false;
wait_event(device->al_wait,
device->act_log->pending_changes == 0 ||
(locked = lc_try_lock_for_transaction(device->act_log)));
if (locked) {
/* Double check: it may have been committed by someone el... | [
1,
1
] |
Linux Kernel | drivers/block/drbd/drbd_actlog.c | void drbd_al_begin_io(struct drbd_device *device, struct drbd_interval *i) {
if (drbd_al_begin_io_prepare(device, i))
drbd_al_begin_io_commit(device);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_actlog.c | void drbd_al_shrink(struct drbd_device *device) {
struct lc_element *al_ext;
int i;
D_ASSERT(device, test_bit(__LC_LOCKED, &device->act_log->flags));
for (i = 0; i < device->act_log->nr_elements; i++) {
al_ext = lc_element_by_index(device->act_log, i);
if (al_ext->lc_number == LC_FREE)
continue;... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_actlog.c | static bool lazy_bitmap_update_due(struct drbd_device *device) {
return time_after(jiffies, device->rs_last_bcast + 2 * HZ);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_actlog.c | static void maybe_schedule_on_disk_bitmap_update(struct drbd_device *device,
bool rs_done) {
if (rs_done) {
struct drbd_connection *connection = first_peer_device(device)->connection;
if (connection->agreed_pro_version <= 95 ||
is_sync_target_state(devi... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_actlog.c | static int update_sync_bits(struct drbd_device *device, unsigned long sbnr,
unsigned long ebnr,
enum update_sync_bits_mode mode) {
unsigned long flags;
unsigned long count = 0;
unsigned int cleared = 0;
while (sbnr <= ebnr) {
/* set temporary boundary... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_actlog.c |
static struct bm_extent *_bme_get(struct drbd_device *device,
unsigned int enr) {
struct lc_element *e;
struct bm_extent *bm_ext;
int wakeup = 0;
unsigned long rs_flags;
spin_lock_irq(&device->al_lock);
if (device->resync_locked > device->resync->nr_elements / 2) {
sp... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_actlog.c | int drbd_rs_begin_io(struct drbd_device *device, sector_t sector) {
unsigned int enr = BM_SECT_TO_EXT(sector);
struct bm_extent *bm_ext;
int i, sig;
bool sa;
retry:
sig = wait_event_interruptible(device->al_wait,
(bm_ext = _bme_get(device, enr)));
if (sig)
return -EINTR... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_actlog.c | void drbd_rs_complete_io(struct drbd_device *device, sector_t sector) {
unsigned int enr = BM_SECT_TO_EXT(sector);
struct lc_element *e;
struct bm_extent *bm_ext;
unsigned long flags;
spin_lock_irqsave(&device->al_lock, flags);
e = lc_find(device->resync, enr);
bm_ext = e ? lc_entry(e, struct bm_extent, ... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | static void bm_store_page_idx(struct page *page, unsigned long idx) {
BUG_ON(0 != (idx & ~BM_PAGE_IDX_MASK));
set_page_private(page, idx);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | static void bm_set_page_unchanged(struct page *page) {
clear_bit(BM_PAGE_NEED_WRITEOUT, &page_private(page));
clear_bit(BM_PAGE_LAZY_WRITEOUT, &page_private(page));
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c |
static void bm_set_page_need_writeout(struct page *page) {
set_bit(BM_PAGE_NEED_WRITEOUT, &page_private(page));
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c |
void drbd_bm_reset_al_hints(struct drbd_device *device) {
device->bitmap->n_bitmap_hints = 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | void drbd_bm_mark_for_writeout(struct drbd_device *device, int page_nr) {
struct drbd_bitmap *b = device->bitmap;
struct page *page;
if (page_nr >= device->bitmap->bm_number_of_pages) {
drbd_warn(device, "BAD: page_nr: %u, number_of_pages: %u\n", page_nr,
(int)device->bitmap->bm_number_of_pages)... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c |
static int bm_test_page_lazy_writeout(struct page *page) {
return test_bit(BM_PAGE_LAZY_WRITEOUT, &page_private(page));
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | static unsigned int bm_word_to_page_idx(struct drbd_bitmap *b,
unsigned long long_nr) {
unsigned int page_nr = long_nr >> (PAGE_SHIFT - LN2_BPL + 3);
BUG_ON(page_nr >= b->bm_number_of_pages);
return page_nr;
} | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c |
static unsigned long *__bm_map_pidx(struct drbd_bitmap *b, unsigned int idx) {
struct page *page = b->bm_pages[idx];
return (unsigned long *)kmap_atomic(page);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c |
static unsigned long *bm_map_pidx(struct drbd_bitmap *b, unsigned int idx) {
return __bm_map_pidx(b, idx);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | static void bm_unmap(unsigned long *p_addr) { return __bm_unmap(p_addr); }
#define S2W(s) ((s) << (BM_EXT_SHIFT - BM_BLOCK_SHIFT - LN2_BPL))
/* word offset from start of bitmap to word number _in_page_
* modulo longs per page
#define MLPP(X) ((X) % (PAGE_SIZE/sizeof(long))
hm, well, Philipp thinks gcc might not opti... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | void drbd_bm_cleanup(struct drbd_device *device) {
if (!expect(device, device->bitmap))
return;
bm_free_pages(device->bitmap->bm_pages, device->bitmap->bm_number_of_pages);
bm_vk_free(device->bitmap->bm_pages);
kfree(device->bitmap);
device->bitmap = NULL;
}
#ifndef BITS_PER_PAGE
#define BITS_PER_PAGE (1... | [
1,
1
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | static void bm_set_surplus(struct drbd_bitmap *b) {
unsigned long mask;
unsigned long *p_addr, *bm;
int tmp;
tmp = (b->bm_bits & BITS_PER_PAGE_MASK);
/* mask the used bits of the word containing the last bit */
mask = (1UL << (tmp & BITS_PER_LONG_MASK)) - 1;
/* bitmap is always stored little endian,
*... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | static unsigned long bm_count_bits(struct drbd_bitmap *b) {
unsigned long *p_addr;
unsigned long bits = 0;
unsigned long mask = (1UL << (b->bm_bits & BITS_PER_LONG_MASK)) - 1;
int idx, last_word;
for (idx = 0; idx < b->bm_number_of_pages - 1; idx++) {
p_addr = __bm_map_pidx(b, idx);
bits += bitmap_we... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | static void bm_memset(struct drbd_bitmap *b, size_t offset, int c, size_t len) {
unsigned long *p_addr, *bm;
unsigned int idx;
size_t do_now, end;
end = offset + len;
if (end > b->bm_words) {
pr_alert("bm_memset end > bm_words\n");
return;
}
while (offset < end) {
do_now = min_t(size_t, ALI... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | unsigned long _drbd_bm_total_weight(struct drbd_device *device) {
struct drbd_bitmap *b = device->bitmap;
unsigned long s;
unsigned long flags;
if (!expect(device, b))
return 0;
if (!expect(device, b->bm_pages))
return 0;
spin_lock_irqsave(&b->bm_lock, flags);
s = b->bm_set;
spin_unlock_irqres... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | void drbd_bm_get_lel(struct drbd_device *device, size_t offset, size_t number,
unsigned long *buffer) {
struct drbd_bitmap *b = device->bitmap;
unsigned long *p_addr, *bm;
size_t end, do_now;
end = offset + number;
if (!expect(device, b))
return;
if (!expect(device, b->bm_pages))
... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c |
static void drbd_bm_aio_ctx_destroy(struct kref *kref) {
struct drbd_bm_aio_ctx *ctx =
container_of(kref, struct drbd_bm_aio_ctx, kref);
unsigned long flags;
spin_lock_irqsave(&ctx->device->resource->req_lock, flags);
list_del(&ctx->list);
spin_unlock_irqrestore(&ctx->device->resource->req_lock, flags... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | int drbd_bm_write(struct drbd_device *device) __must_hold(local) {
return bm_rw(device, 0, 0);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c |
static unsigned long bm_find_next(struct drbd_device *device,
unsigned long bm_fo,
const int find_zero_bit) {
struct drbd_bitmap *b = device->bitmap;
unsigned long i = DRBD_END_OF_BITMAP;
if (!expect(device, b))
return i;
if (!expect(devi... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | unsigned long _drbd_bm_find_next(struct drbd_device *device,
unsigned long bm_fo) {
return __bm_find_next(device, bm_fo, 0);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | int drbd_bm_test_bit(struct drbd_device *device, const unsigned long bitnr) {
unsigned long flags;
struct drbd_bitmap *b = device->bitmap;
unsigned long *p_addr;
int i;
if (!expect(device, b))
return 0;
if (!expect(device, b->bm_pages))
return 0;
spin_lock_irqsave(&b->bm_lock, flags);
if (BM_D... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_bitmap.c | int drbd_bm_e_weight(struct drbd_device *device, unsigned long enr) {
struct drbd_bitmap *b = device->bitmap;
int count, s, e;
unsigned long flags;
unsigned long *p_addr, *bm;
if (!expect(device, b))
return 0;
if (!expect(device, b->bm_pages))
return 0;
spin_lock_irqsave(&b->bm_lock, flags);
i... | [
0,
1
] |
Linux Kernel | drivers/block/drbd/drbd_debugfs.c |
static void seq_print_peer_request(struct seq_file *m,
struct drbd_device *device,
struct list_head *lh, unsigned long now) {
bool reported_preparing = false;
struct drbd_peer_request *peer_req;
list_for_each_entry(peer_req, lh, w.list) {
... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_debugfs.c |
static void seq_print_device_peer_requests(struct seq_file *m,
struct drbd_device *device,
unsigned long now) {
seq_puts(m, "minor\tvnr\tsector\tsize\trw\tage\tflags\n");
spin_lock_irq(&device->resource->req_lock);
seq_print_pe... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_debugfs.c |
static void seq_print_resource_pending_peer_requests(
struct seq_file *m, struct drbd_resource *resource, unsigned long now) {
struct drbd_device *device;
unsigned int i;
rcu_read_lock();
idr_for_each_entry(&resource->devices, device, i) {
seq_print_device_peer_requests(m, device, now);
}
rcu_read... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_debugfs.c |
static void drbd_debugfs_remove(struct dentry **dp) {
debugfs_remove(*dp);
*dp = NULL;
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_debugfs.c | static int callback_history_show(struct seq_file *m, void *ignored) {
struct drbd_connection *connection = m->private;
unsigned long jif = jiffies;
seq_printf(m, "v: %u\n\n", 0);
seq_puts(m, "n\tage\tcallsite\tfn\n");
seq_print_timing_details(m, "worker", connection->w_cb_nr,
conn... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_debugfs.c |
static void resync_dump_detail(struct seq_file *m, struct lc_element *e) {
struct bm_extent *bme = lc_entry(e, struct bm_extent, lce);
seq_printf(m, "%5d %s %s %s", bme->rs_left,
test_bit(BME_NO_WRITES, &bme->flags) ? "NO_WRITES" : "---------",
test_bit(BME_LOCKED, &bme->flags) ? "LOCKED... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_debugfs.c | static int device_oldest_requests_show(struct seq_file *m, void *ignored) {
struct drbd_device *device = m->private;
struct drbd_resource *resource = device->resource;
unsigned long now = jiffies;
struct drbd_request *r1, *r2;
int i;
seq_printf(m, "v: %u\n\n", 0);
seq_puts(m, RQ_HDR);
spin_lock_irq(&r... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_debugfs.c | void drbd_debugfs_device_add(struct drbd_device *device) {
struct dentry *vols_dir = device->resource->debugfs_res_volumes;
char minor_buf[8];
char vnr_buf[8]; /* volume number vnr is even 16 bit only; */
char *slink_name = NULL;
struct dentry *dentry;
if (!vols_dir || !drbd_debugfs_minors)
return;
... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_debugfs.c |
void drbd_debugfs_device_cleanup(struct drbd_device *device) {
drbd_debugfs_remove(&device->debugfs_minor);
drbd_debugfs_remove(&device->debugfs_vol_oldest_requests);
drbd_debugfs_remove(&device->debugfs_vol_act_log_extents);
drbd_debugfs_remove(&device->debugfs_vol_resync_extents);
drbd_debugfs_remove(&devi... | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.