void ext2_error (struct super_block * sb, const char * function, const char * fmt, ...) { va_list args; struct ext2_super_block *es = EXT2_SB(sb)->s_es; if (!(sb->s_flags & MS_RDONLY)) { sb->u.ext2_sb.s_mount_state |= EXT2_ERROR_FS; es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) | EXT2_ERROR_FS); ext2_sync_super(sb, es); } va_start (args, fmt); vsprintf (error_buf, fmt, args); va_end (args); if (test_opt (sb, ERRORS_PANIC) || (le16_to_cpu(sb->u.ext2_sb.s_es->s_errors) == EXT2_ERRORS_PANIC && !test_opt (sb, ERRORS_CONT) && !test_opt (sb, ERRORS_RO))) panic ("EXT2-fs panic (device %s): %s: %s\n", bdevname(sb->s_dev), function, error_buf); printk (KERN_CRIT "EXT2-fs error (device %s): %s: %s\n", bdevname(sb->s_dev), function, error_buf); if (test_opt (sb, ERRORS_RO) || (le16_to_cpu(sb->u.ext2_sb.s_es->s_errors) == EXT2_ERRORS_RO && !test_opt (sb, ERRORS_CONT) && !test_opt (sb, ERRORS_PANIC))) { printk ("Remounting filesystem read-only\n"); sb->s_flags |= MS_RDONLY; } }
static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) { int n = 0; char b[BDEVNAME_SIZE]; if (block < 0) { printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n", block, bdevname(inode->i_sb->s_bdev, b)); } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { if (printk_ratelimit()) printk("MINIX-fs: block_to_path: " "block %ld too big on dev %s\n", block, bdevname(inode->i_sb->s_bdev, b)); } else if (block < 7) { offsets[n++] = block; } else if ((block -= 7) < 512) { offsets[n++] = 7; offsets[n++] = block; } else { block -= 512; offsets[n++] = 8; offsets[n++] = block>>9; offsets[n++] = block & 511; } return n; }
static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) { int n = 0; char b[BDEVNAME_SIZE]; struct super_block *sb = inode->i_sb; struct xiafs_sb_info *sbi = xiafs_sb(sb); if (block < 0) { printk("XIAFS-fs: block_to_path: block %ld < 0 on dev %s\n", block, bdevname(sb->s_bdev, b)); } else if (block >= (xiafs_sb(inode->i_sb)->s_max_size/sb->s_blocksize)) { if (printk_ratelimit()) printk("XIAFS-fs: block_to_path: " "block %ld too big on dev %s\n", block, bdevname(sb->s_bdev, b)); } else if (block < 8) { offsets[n++] = block; } else if ((block -= 8) < XIAFS_ADDRS_PER_Z(sbi)) { offsets[n++] = 8; offsets[n++] = block; } else { block -= XIAFS_ADDRS_PER_Z(sbi); offsets[n++] = 9; offsets[n++] = block>>XIAFS_ADDRS_PER_Z_BITS(sbi); offsets[n++] = block & (XIAFS_ADDRS_PER_Z(sbi)-1); } return n; }
static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) { int n = 0; char b[BDEVNAME_SIZE]; struct super_block *sb = inode->i_sb; if (block < 0) { printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n", block, bdevname(sb->s_bdev, b)); } else if (block >= (minix_sb(inode->i_sb)->s_max_size/sb->s_blocksize)) { if (printk_ratelimit()) printk("MINIX-fs: block_to_path: " "block %ld too big on dev %s\n", block, bdevname(sb->s_bdev, b)); } else if (block < DIRCOUNT) { offsets[n++] = block; } else if ((block -= DIRCOUNT) < INDIRCOUNT(sb)) { offsets[n++] = DIRCOUNT; offsets[n++] = block; } else if ((block -= INDIRCOUNT(sb)) < INDIRCOUNT(sb) * INDIRCOUNT(sb)) { offsets[n++] = DIRCOUNT + 1; offsets[n++] = block / INDIRCOUNT(sb); offsets[n++] = block % INDIRCOUNT(sb); } else { block -= INDIRCOUNT(sb) * INDIRCOUNT(sb); offsets[n++] = DIRCOUNT + 2; offsets[n++] = (block / INDIRCOUNT(sb)) / INDIRCOUNT(sb); offsets[n++] = (block / INDIRCOUNT(sb)) % INDIRCOUNT(sb); offsets[n++] = block % INDIRCOUNT(sb); } return n; }
static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) { int i, c, err; sector_t curr_zone_end, sectors; struct md_rdev *smallest, *rdev1, *rdev2, *rdev, **dev; struct strip_zone *zone; int cnt; char b[BDEVNAME_SIZE]; char b2[BDEVNAME_SIZE]; struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); unsigned short blksize = 512; *private_conf = ERR_PTR(-ENOMEM); if (!conf) return -ENOMEM; rdev_for_each(rdev1, mddev) { pr_debug("md/raid0:%s: looking at %s\n", mdname(mddev), bdevname(rdev1->bdev, b)); c = 0; /* round size to chunk_size */ sectors = rdev1->sectors; sector_div(sectors, mddev->chunk_sectors); rdev1->sectors = sectors * mddev->chunk_sectors; blksize = max(blksize, queue_logical_block_size( rdev1->bdev->bd_disk->queue)); rdev_for_each(rdev2, mddev) { pr_debug("md/raid0:%s: comparing %s(%llu)" " with %s(%llu)\n", mdname(mddev), bdevname(rdev1->bdev,b), (unsigned long long)rdev1->sectors, bdevname(rdev2->bdev,b2), (unsigned long long)rdev2->sectors); if (rdev2 == rdev1) { pr_debug("md/raid0:%s: END\n", mdname(mddev)); break; } if (rdev2->sectors == rdev1->sectors) { /* * Not unique, don't count it as a new * group */ pr_debug("md/raid0:%s: EQUAL\n", mdname(mddev)); c = 1; break; } pr_debug("md/raid0:%s: NOT EQUAL\n", mdname(mddev)); }
static void bfs_read_inode(struct inode * inode) { unsigned long ino = inode->i_ino; kdev_t dev = inode->i_dev; struct bfs_inode * di; struct buffer_head * bh; int block, off; if (ino < BFS_ROOT_INO || ino > inode->i_sb->su_lasti) { printf("Bad inode number %s:%08lx\n", bdevname(dev), ino); make_bad_inode(inode); return; } block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; bh = sb_bread(inode->i_sb, block); if (!bh) { printf("Unable to read inode %s:%08lx\n", bdevname(dev), ino); make_bad_inode(inode); return; } off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; di = (struct bfs_inode *)bh->b_data + off; inode->i_mode = 0x0000FFFF & di->i_mode; if (di->i_vtype == BFS_VDIR) { inode->i_mode |= S_IFDIR; inode->i_op = &bfs_dir_inops; inode->i_fop = &bfs_dir_operations; } else if (di->i_vtype == BFS_VREG) { inode->i_mode |= S_IFREG; inode->i_op = &bfs_file_inops; inode->i_fop = &bfs_file_operations; inode->i_mapping->a_ops = &bfs_aops; } inode->i_uid = di->i_uid; inode->i_gid = di->i_gid; inode->i_nlink = di->i_nlink; inode->i_size = BFS_FILESIZE(di); inode->i_blocks = BFS_FILEBLOCKS(di); inode->i_blksize = PAGE_SIZE; inode->i_atime = di->i_atime; inode->i_mtime = di->i_mtime; inode->i_ctime = di->i_ctime; inode->iu_dsk_ino = di->i_ino; /* can be 0 so we store a copy */ inode->iu_sblock = di->i_sblock; inode->iu_eblock = di->i_eblock; brelse(bh); }
int reiserfs_proc_info_init( struct super_block *sb ) { spin_lock_init( & __PINFO( sb ).lock ); sb->u.reiserfs_sb.procdir = proc_mkdir( bdevname( sb -> s_dev ), proc_info_root ); if( sb->u.reiserfs_sb.procdir ) { sb->u.reiserfs_sb.procdir -> owner = THIS_MODULE; return 0; } reiserfs_warning( "reiserfs: cannot create /proc/%s/%s\n", proc_info_root_name, bdevname( sb -> s_dev ) ); return 1; }
static ssize_t iblock_show_configfs_dev_params( struct se_hba *hba, struct se_subsystem_dev *se_dev, char *b) { struct iblock_dev *ibd = se_dev->se_dev_su_ptr; struct block_device *bd = ibd->ibd_bd; char buf[BDEVNAME_SIZE]; ssize_t bl = 0; if (bd) bl += sprintf(b + bl, "iBlock device: %s", bdevname(bd, buf)); if (ibd->ibd_flags & IBDF_HAS_UDEV_PATH) bl += sprintf(b + bl, " UDEV PATH: %s", ibd->ibd_udev_path); bl += sprintf(b + bl, " readonly: %d\n", ibd->ibd_readonly); bl += sprintf(b + bl, " "); if (bd) { bl += sprintf(b + bl, "Major: %d Minor: %d %s\n", MAJOR(bd->bd_dev), MINOR(bd->bd_dev), (!bd->bd_contains) ? "" : (bd->bd_holder == ibd) ? "CLAIMED: IBLOCK" : "CLAIMED: OS"); } else { bl += sprintf(b + bl, "Major: 0 Minor: 0\n"); } return bl; }
/** * blk_trace_ioctl: - handle the ioctls associated with tracing * @bdev: the block device * @cmd: the ioctl cmd * @arg: the argument data, if any * **/ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg) { struct request_queue *q; int ret, start = 0; char b[BDEVNAME_SIZE]; q = bdev_get_queue(bdev); if (!q) return -ENXIO; mutex_lock(&bdev->bd_mutex); switch (cmd) { case BLKTRACESETUP: bdevname(bdev, b); ret = blk_trace_setup(q, b, bdev->bd_dev, bdev, arg); break; case BLKTRACESTART: start = 1; case BLKTRACESTOP: ret = blk_trace_startstop(q, start); break; case BLKTRACETEARDOWN: ret = blk_trace_remove(q); break; default: ret = -ENOTTY; break; } mutex_unlock(&bdev->bd_mutex); return ret; }
// Dumps block info void dump(struct bio *bio) { if (!head) { // initialize linked list tail = head = read_p = kmalloc(sizeof(struct sp_io), GFP_KERNEL); if (!tail) { // Exception handling printk("SP kmalloc failed!\n"); return; } } else { struct sp_io *temp = kmalloc(sizeof(struct sp_io), GFP_KERNEL); if (!temp) { // Exception handling printk("SP kmalloc failed!\n"); return; } tail->next = temp; tail = temp; } // initialize sp_io struct tail->sector = bio->bi_sector; // get device name bdevname(bio->bi_bdev, tail->dev_name); tail->count = bio_sectors(bio); struct timespec current_time; getnstimeofday(¤t_time); tail->sec = current_time.tv_sec; tail->nsec = current_time.tv_nsec; }
/* * inform the user of the raid configuration */ static void dump_zones(struct mddev *mddev) { int j, k; sector_t zone_size = 0; sector_t zone_start = 0; char b[BDEVNAME_SIZE]; struct r0conf *conf = mddev->private; int raid_disks = conf->strip_zone[0].nb_dev; printk(KERN_INFO "md: RAID0 configuration for %s - %d zone%s\n", mdname(mddev), conf->nr_strip_zones, conf->nr_strip_zones==1?"":"s"); for (j = 0; j < conf->nr_strip_zones; j++) { printk(KERN_INFO "md: zone%d=[", j); for (k = 0; k < conf->strip_zone[j].nb_dev; k++) printk(KERN_CONT "%s%s", k?"/":"", bdevname(conf->devlist[j*raid_disks + k]->bdev, b)); printk(KERN_CONT "]\n"); zone_size = conf->strip_zone[j].zone_end - zone_start; printk(KERN_INFO " zone-offset=%10lluKB, " "device-offset=%10lluKB, size=%10lluKB\n", (unsigned long long)zone_start>>1, (unsigned long long)conf->strip_zone[j].dev_start>>1, (unsigned long long)zone_size>>1); zone_start = conf->strip_zone[j].zone_end; } printk(KERN_INFO "\n"); }
/* * Conversion of logical to physical block numbers for the journal * * On external journals the journal blocks are identity-mapped, so * this is a no-op. If needed, we can use j_blk_offset - everything is * ready. */ int journal_bmap(journal_t *journal, unsigned int blocknr, unsigned int *retp) { int err = 0; unsigned int ret; if (journal->j_inode) { ret = bmap(journal->j_inode, blocknr); if (ret) *retp = ret; else { char b[BDEVNAME_SIZE]; printk(KERN_ALERT "%s: journal block not found " "at offset %u on %s\n", __func__, blocknr, bdevname(journal->j_dev, b)); err = -EIO; __journal_abort_soft(journal, err); } } else { *retp = blocknr; /* +journal->j_blk_offset */ } return err; }
/* * Careful, this can execute in IRQ contexts as well! */ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev) { multipath_conf_t *conf = mddev_to_conf(mddev); if (conf->working_disks <= 1) { /* * Uh oh, we can do nothing if this is our last path, but * first check if this is a queued request for a device * which has just failed. */ printk(KERN_ALERT "multipath: only one IO path left and IO error.\n"); /* leave it active... it's all we have */ } else { /* * Mark disk as unusable */ if (!test_bit(Faulty, &rdev->flags)) { char b[BDEVNAME_SIZE]; clear_bit(In_sync, &rdev->flags); set_bit(Faulty, &rdev->flags); mddev->sb_dirty = 1; conf->working_disks--; printk(KERN_ALERT "multipath: IO failure on %s," " disabling IO path. \n Operation continuing" " on %d IO paths.\n", bdevname (rdev->bdev,b), conf->working_disks); } } }
static int multipath_end_request(struct bio *bio, unsigned int bytes_done, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); struct multipath_bh * mp_bh = (struct multipath_bh *)(bio->bi_private); multipath_conf_t *conf = mddev_to_conf(mp_bh->mddev); mdk_rdev_t *rdev = conf->multipaths[mp_bh->path].rdev; if (bio->bi_size) return 1; if (uptodate) multipath_end_bh_io(mp_bh, 0); else if (!bio_rw_ahead(bio)) { /* * oops, IO error: */ char b[BDEVNAME_SIZE]; md_error (mp_bh->mddev, rdev); printk(KERN_ERR "multipath: %s: rescheduling sector %llu\n", bdevname(rdev->bdev,b), (unsigned long long)bio->bi_sector); multipath_reschedule_retry(mp_bh); } else multipath_end_bh_io(mp_bh, error); rdev_dec_pending(rdev, conf->mddev); return 0; }
/* * inform the user of the raid configuration */ static void dump_zones(struct mddev *mddev) { int j, k; sector_t zone_size = 0; sector_t zone_start = 0; char b[BDEVNAME_SIZE]; struct r0conf *conf = mddev->private; int raid_disks = conf->strip_zone[0].nb_dev; pr_debug("md: RAID0 configuration for %s - %d zone%s\n", mdname(mddev), conf->nr_strip_zones, conf->nr_strip_zones==1?"":"s"); for (j = 0; j < conf->nr_strip_zones; j++) { char line[200]; int len = 0; for (k = 0; k < conf->strip_zone[j].nb_dev; k++) len += snprintf(line+len, 200-len, "%s%s", k?"/":"", bdevname(conf->devlist[j*raid_disks + k]->bdev, b)); pr_debug("md: zone%d=[%s]\n", j, line); zone_size = conf->strip_zone[j].zone_end - zone_start; pr_debug(" zone-offset=%10lluKB, device-offset=%10lluKB, size=%10lluKB\n", (unsigned long long)zone_start>>1, (unsigned long long)conf->strip_zone[j].dev_start>>1, (unsigned long long)zone_size>>1); zone_start = conf->strip_zone[j].zone_end; } }
ssize_t diskdump_sysfs_show_disk(struct gendisk *disk, char *buf) { struct block_device *bdev; int part, tmp, len = 0, maxlen = 1024; char* p = buf; char name[BDEVNAME_SIZE]; if (!dump_ops || !dump_ops->find_dump) return 0; if (!disk->part) return 0; /* print device */ down(&dump_ops_mutex); for (part = 0; part < disk->minors; part++) { bdev = bdget_disk(disk, part); if (dump_ops->find_dump(bdev)) { tmp = sprintf(p, "%s\n", bdevname(bdev, name)); len += tmp; p += tmp; } bdput(bdev); if(len >= maxlen) break; } up(&dump_ops_mutex); return len; }
/* * This routine checks whether a removable media has been changed, * and invalidates all buffer-cache-entries in that case. This * is a relatively slow routine, so we have to try to minimize using * it. Thus it is called only upon a 'mount' or 'open'. This * is the best way of combining speed and utility, I think. * People changing diskettes in the middle of an operation deserve * to loose :-) */ int check_disk_change(kdev_t dev) { int i; struct file_operations * fops; struct super_block * sb; i = MAJOR(dev); if (i >= MAX_BLKDEV || (fops = blkdevs[i].fops) == NULL) return 0; if (fops->check_media_change == NULL) return 0; if (!fops->check_media_change(dev)) return 0; printk(KERN_DEBUG "VFS: Disk change detected on device %s\n", bdevname(dev)); sb = get_super(dev); if (sb && invalidate_inodes(sb)) printk("VFS: busy inodes on changed media.\n"); invalidate_buffers(dev); if (fops->revalidate) fops->revalidate(dev); return 1; }
/* * Print an buffer I/O error compatible with the fs/buffer.c. This * provides compatibility with dmesg scrapers that look for a specific * buffer I/O error message. We really need a unified error reporting * structure to userspace ala Digital Unix's uerf system, but it's * probably not going to happen in my lifetime, due to LKML politics... */ static void buffer_io_error(struct buffer_head *bh) { char b[BDEVNAME_SIZE]; printk_ratelimited(KERN_ERR "Buffer I/O error on device %s, logical block %llu\n", bdevname(bh->b_bdev, b), (unsigned long long)bh->b_blocknr); }
/* * This must be called after early kernel init, since then the rootdev * is available. */ static void check_pinning_enforcement(struct super_block *mnt_sb) { bool ro = false; /* * If load pinning is not enforced via a read-only block * device, allow sysctl to change modes for testing. */ if (mnt_sb->s_bdev) { char bdev[BDEVNAME_SIZE]; ro = bdev_read_only(mnt_sb->s_bdev); bdevname(mnt_sb->s_bdev, bdev); pr_info("%s (%u:%u): %s\n", bdev, MAJOR(mnt_sb->s_bdev->bd_dev), MINOR(mnt_sb->s_bdev->bd_dev), ro ? "read-only" : "writable"); } else pr_info("mnt_sb lacks block device, treating as: writable\n"); if (!ro) { if (!register_sysctl_paths(loadpin_sysctl_path, loadpin_sysctl_table)) pr_notice("sysctl registration failed!\n"); else pr_info("enforcement can be disabled.\n"); } else pr_info("load pinning engaged.\n"); }
/* Done it all: now write the commit record. We should have * cleaned up our previous buffers by now, so if we are in abort * mode we can now just skip the rest of the journal write * entirely. * * Returns 1 if the journal needs to be aborted or 0 on success */ static int journal_write_commit_record(journal_t *journal, transaction_t *commit_transaction) { struct journal_head *descriptor; struct buffer_head *bh; int i, ret; int barrier_done = 0; if (is_journal_aborted(journal)) return 0; descriptor = jbd2_journal_get_descriptor_buffer(journal); if (!descriptor) return 1; bh = jh2bh(descriptor); /* AKPM: buglet - add `i' to tmp! */ for (i = 0; i < bh->b_size; i += 512) { journal_header_t *tmp = (journal_header_t*)bh->b_data; tmp->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK); tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid); } JBUFFER_TRACE(descriptor, "write commit block"); set_buffer_dirty(bh); if (journal->j_flags & JBD2_BARRIER) { set_buffer_ordered(bh); barrier_done = 1; } ret = sync_dirty_buffer(bh); /* is it possible for another commit to fail at roughly * the same time as this one? If so, we don't want to * trust the barrier flag in the super, but instead want * to remember if we sent a barrier request */ if (ret == -EOPNOTSUPP && barrier_done) { char b[BDEVNAME_SIZE]; printk(KERN_WARNING "JBD: barrier-based sync failed on %s - " "disabling barriers\n", bdevname(journal->j_dev, b)); spin_lock(&journal->j_state_lock); journal->j_flags &= ~JBD2_BARRIER; spin_unlock(&journal->j_state_lock); /* And try again, without the barrier */ clear_buffer_ordered(bh); set_buffer_uptodate(bh); set_buffer_dirty(bh); ret = sync_dirty_buffer(bh); } put_bh(bh); /* One for getblk() */ jbd2_journal_put_journal_head(descriptor); return (ret == -EIO); }
/* Done it all: now write the commit record. We should have * cleaned up our previous buffers by now, so if we are in abort * mode we can now just skip the rest of the journal write * entirely. * * Returns 1 if the journal needs to be aborted or 0 on success */ static int journal_write_commit_record(journal_t *journal, transaction_t *commit_transaction) { struct journal_head *descriptor; struct buffer_head *bh; journal_header_t *header; int ret; if (is_journal_aborted(journal)) return 0; descriptor = journal_get_descriptor_buffer(journal); if (!descriptor) return 1; bh = jh2bh(descriptor); header = (journal_header_t *)(bh->b_data); header->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); header->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK); header->h_sequence = cpu_to_be32(commit_transaction->t_tid); JBUFFER_TRACE(descriptor, "write commit block"); set_buffer_dirty(bh); if (journal->j_flags & JFS_BARRIER) { ret = __sync_dirty_buffer(bh, WRITE_SYNC | WRITE_BARRIER); /* * Is it possible for another commit to fail at roughly * the same time as this one? If so, we don't want to * trust the barrier flag in the super, but instead want * to remember if we sent a barrier request */ if (ret == -EOPNOTSUPP) { char b[BDEVNAME_SIZE]; printk(KERN_WARNING "JBD: barrier-based sync failed on %s - " "disabling barriers\n", bdevname(journal->j_dev, b)); spin_lock(&journal->j_state_lock); journal->j_flags &= ~JFS_BARRIER; spin_unlock(&journal->j_state_lock); /* And try again, without the barrier */ set_buffer_uptodate(bh); set_buffer_dirty(bh); ret = sync_dirty_buffer(bh); } } else { ret = sync_dirty_buffer(bh); } put_bh(bh); /* One for getblk() */ journal_put_journal_head(descriptor); return (ret == -EIO); }
static void bfs_write_inode(struct inode * inode, int unused) { unsigned long ino = inode->i_ino; kdev_t dev = inode->i_dev; struct bfs_inode * di; struct buffer_head * bh; int block, off; if (ino < BFS_ROOT_INO || ino > inode->i_sb->su_lasti) { printf("Bad inode number %s:%08lx\n", bdevname(dev), ino); return; } lock_kernel(); block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; bh = sb_bread(inode->i_sb, block); if (!bh) { printf("Unable to read inode %s:%08lx\n", bdevname(dev), ino); unlock_kernel(); return; } off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK; di = (struct bfs_inode *)bh->b_data + off; if (inode->i_ino == BFS_ROOT_INO) di->i_vtype = BFS_VDIR; else di->i_vtype = BFS_VREG; di->i_ino = inode->i_ino; di->i_mode = inode->i_mode; di->i_uid = inode->i_uid; di->i_gid = inode->i_gid; di->i_nlink = inode->i_nlink; di->i_atime = inode->i_atime; di->i_mtime = inode->i_mtime; di->i_ctime = inode->i_ctime; di->i_sblock = inode->iu_sblock; di->i_eblock = inode->iu_eblock; di->i_eoffset = di->i_sblock * BFS_BSIZE + inode->i_size - 1; mark_buffer_dirty(bh); brelse(bh); unlock_kernel(); }
static int create_strip_zones (mddev_t *mddev) { int i, c, j; sector_t current_offset, curr_zone_offset; sector_t min_spacing; raid0_conf_t *conf = mddev_to_conf(mddev); mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev; struct list_head *tmp1, *tmp2; struct strip_zone *zone; int cnt; char b[BDEVNAME_SIZE]; /* * The number of 'same size groups' */ conf->nr_strip_zones = 0; rdev_for_each(rdev1, tmp1, mddev) { printk("raid0: looking at %s\n", bdevname(rdev1->bdev,b)); c = 0; rdev_for_each(rdev2, tmp2, mddev) { printk("raid0: comparing %s(%llu)", bdevname(rdev1->bdev,b), (unsigned long long)rdev1->size); printk(" with %s(%llu)\n", bdevname(rdev2->bdev,b), (unsigned long long)rdev2->size); if (rdev2 == rdev1) { printk("raid0: END\n"); break; } if (rdev2->size == rdev1->size) { /* * Not unique, don't count it as a new * group */ printk("raid0: EQUAL\n"); c = 1; break; } printk("raid0: NOT EQUAL\n"); }
static void warn_dirty_buffer(struct buffer_head *bh) { char b[BDEVNAME_SIZE]; printk(KERN_WARNING "JBD: Spotted dirty metadata buffer (dev = %s, blocknr = %llu). " "There's a risk of filesystem corruption in case of system " "crash.\n", bdevname(bh->b_bdev, b), (unsigned long long)bh->b_blocknr); }
void ext2_warning (struct super_block * sb, const char * function, const char * fmt, ...) { va_list args; va_start (args, fmt); vsprintf (error_buf, fmt, args); va_end (args); printk (KERN_WARNING "EXT2-fs warning (device %s): %s: %s\n", bdevname(sb->s_dev), function, error_buf); }
int reiserfs_proc_info_done( struct super_block *sb ) { spin_lock( & __PINFO( sb ).lock ); __PINFO( sb ).exiting = 1; spin_unlock( & __PINFO( sb ).lock ); if ( proc_info_root ) { remove_proc_entry( bdevname( sb -> s_dev ), proc_info_root ); sb->u.reiserfs_sb.procdir = NULL; } return 0; }
static void multipathd(struct md_thread *thread) { for (;;) { if ((mp_bh->path = multipath_map (conf))<0) { printk(KERN_ERR "multipath: %s: redirecting sector %llu" " to another IO path\n", bdevname(bio->bi_bdev,b), (unsigned long long)bio->bi_iter.bi_sector); } } }
int sgi_partition(struct parsed_partitions *state) { int i, csum; __be32 magic; int slot = 1; unsigned int start, blocks; __be32 *ui, cs; Sector sect; struct sgi_disklabel *label; struct sgi_partition *p; char b[BDEVNAME_SIZE]; label = read_part_sector(state, 0, §); if (!label) return -1; p = &label->partitions[0]; magic = label->magic_mushroom; if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) { /* */ put_dev_sector(sect); return 0; } ui = ((__be32 *) (label + 1)) - 1; for(csum = 0; ui >= ((__be32 *) label);) { cs = *ui--; csum += be32_to_cpu(cs); } if(csum) { printk(KERN_WARNING "Dev %s SGI disklabel: csum bad, label corrupted\n", bdevname(state->bdev, b)); put_dev_sector(sect); return 0; } /* */ for(i = 0; i < 16; i++, p++) { blocks = be32_to_cpu(p->num_blocks); start = be32_to_cpu(p->first_block); if (blocks) { put_partition(state, slot, start, blocks); if (be32_to_cpu(p->type) == LINUX_RAID_PARTITION) state->parts[slot].flags = ADDPART_FLAG_RAID; } slot++; } strlcat(state->pp_buf, "\n", PAGE_SIZE); put_dev_sector(sect); return 1; }
int ext2_remount (struct super_block * sb, int * flags, char * data) { struct ext2_super_block * es; unsigned short resuid = sb->u.ext2_sb.s_resuid; unsigned short resgid = sb->u.ext2_sb.s_resgid; unsigned long new_mount_opt; unsigned long tmp; /* * Allow the "check" option to be passed as a remount option. */ new_mount_opt = sb->u.ext2_sb.s_mount_opt; if (!parse_options (data, &tmp, &resuid, &resgid, &new_mount_opt)) return -EINVAL; sb->u.ext2_sb.s_mount_opt = new_mount_opt; sb->u.ext2_sb.s_resuid = resuid; sb->u.ext2_sb.s_resgid = resgid; es = sb->u.ext2_sb.s_es; if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) return 0; if (*flags & MS_RDONLY) { if (le16_to_cpu(es->s_state) & EXT2_VALID_FS || !(sb->u.ext2_sb.s_mount_state & EXT2_VALID_FS)) return 0; /* * OK, we are remounting a valid rw partition rdonly, so set * the rdonly flag and then mark the partition as valid again. */ es->s_state = cpu_to_le16(sb->u.ext2_sb.s_mount_state); es->s_mtime = cpu_to_le32(CURRENT_TIME); } else { int ret; if ((ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))) { printk("EXT2-fs: %s: couldn't remount RDWR because of " "unsupported optional features (%x).\n", bdevname(sb->s_dev), ret); return -EROFS; } /* * Mounting a RDONLY partition read-write, so reread and * store the current valid flag. (It may have been changed * by e2fsck since we originally mounted the partition.) */ sb->u.ext2_sb.s_mount_state = le16_to_cpu(es->s_state); if (!ext2_setup_super (sb, es, 0)) sb->s_flags &= ~MS_RDONLY; } ext2_sync_super(sb, es); return 0; }
int sgi_partition(struct parsed_partitions *state, struct block_device *bdev) { int i, csum; __be32 magic; int slot = 1; unsigned int start, blocks; __be32 *ui, cs; Sector sect; struct sgi_disklabel *label; struct sgi_partition *p; char b[BDEVNAME_SIZE]; label = (struct sgi_disklabel *) read_dev_sector(bdev, 0, §); if (!label) return -1; p = &label->partitions[0]; magic = label->magic_mushroom; if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) { /*printk("Dev %s SGI disklabel: bad magic %08x\n", bdevname(bdev, b), be32_to_cpu(magic));*/ put_dev_sector(sect); return 0; } ui = ((__be32 *) (label + 1)) - 1; for(csum = 0; ui >= ((__be32 *) label);) { cs = *ui--; csum += be32_to_cpu(cs); } if(csum) { printk(KERN_WARNING "Dev %s SGI disklabel: csum bad, label corrupted\n", bdevname(bdev, b)); put_dev_sector(sect); return 0; } /* All SGI disk labels have 16 partitions, disks under Linux only * have 15 minor's. Luckily there are always a few zero length * partitions which we don't care about so we never overflow the * current_minor. */ for(i = 0; i < 16; i++, p++) { blocks = be32_to_cpu(p->num_blocks); start = be32_to_cpu(p->first_block); if (blocks) { put_partition(state, slot, start, blocks); if (be32_to_cpu(p->type) == LINUX_RAID_PARTITION) state->parts[slot].flags = ADDPART_FLAG_RAID; } slot++; } printk("\n"); put_dev_sector(sect); return 1; }