You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'for-3.20/bdi' of git://git.kernel.dk/linux-block
Pull backing device changes from Jens Axboe: "This contains a cleanup of how the backing device is handled, in preparation for a rework of the life time rules. In this part, the most important change is to split the unrelated nommu mmap flags from it, but also removing a backing_dev_info pointer from the address_space (and inode), and a cleanup of other various minor bits. Christoph did all the work here, I just fixed an oops with pages that have a swap backing. Arnd fixed a missing export, and Oleg killed the lustre backing_dev_info from staging. Last patch was from Al, unexporting parts that are now no longer needed outside" * 'for-3.20/bdi' of git://git.kernel.dk/linux-block: Make super_blocks and sb_lock static mtd: export new mtd_mmap_capabilities fs: make inode_to_bdi() handle NULL inode staging/lustre/llite: get rid of backing_dev_info fs: remove default_backing_dev_info fs: don't reassign dirty inodes to default_backing_dev_info nfs: don't call bdi_unregister ceph: remove call to bdi_unregister fs: remove mapping->backing_dev_info fs: export inode_to_bdi and use it in favor of mapping->backing_dev_info nilfs2: set up s_bdi like the generic mount_bdev code block_dev: get bdev inode bdi directly from the block device block_dev: only write bdev inode on close fs: introduce f_op->mmap_capabilities for nommu mmap support fs: kill BDI_CAP_SWAP_BACKED fs: deduplicate noop_backing_dev_info
This commit is contained in:
@@ -43,12 +43,12 @@ and it's also much more restricted in the latter case:
|
|||||||
even if this was created by another process.
|
even if this was created by another process.
|
||||||
|
|
||||||
- If possible, the file mapping will be directly on the backing device
|
- If possible, the file mapping will be directly on the backing device
|
||||||
if the backing device has the BDI_CAP_MAP_DIRECT capability and
|
if the backing device has the NOMMU_MAP_DIRECT capability and
|
||||||
appropriate mapping protection capabilities. Ramfs, romfs, cramfs
|
appropriate mapping protection capabilities. Ramfs, romfs, cramfs
|
||||||
and mtd might all permit this.
|
and mtd might all permit this.
|
||||||
|
|
||||||
- If the backing device device can't or won't permit direct sharing,
|
- If the backing device device can't or won't permit direct sharing,
|
||||||
but does have the BDI_CAP_MAP_COPY capability, then a copy of the
|
but does have the NOMMU_MAP_COPY capability, then a copy of the
|
||||||
appropriate bit of the file will be read into a contiguous bit of
|
appropriate bit of the file will be read into a contiguous bit of
|
||||||
memory and any extraneous space beyond the EOF will be cleared
|
memory and any extraneous space beyond the EOF will be cleared
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ directly (can't be copied).
|
|||||||
|
|
||||||
The file->f_op->mmap() operation will be called to actually inaugurate the
|
The file->f_op->mmap() operation will be called to actually inaugurate the
|
||||||
mapping. It can be rejected at that point. Returning the ENOSYS error will
|
mapping. It can be rejected at that point. Returning the ENOSYS error will
|
||||||
cause the mapping to be copied instead if BDI_CAP_MAP_COPY is specified.
|
cause the mapping to be copied instead if NOMMU_MAP_COPY is specified.
|
||||||
|
|
||||||
The vm_ops->close() routine will be invoked when the last mapping on a chardev
|
The vm_ops->close() routine will be invoked when the last mapping on a chardev
|
||||||
is removed. An existing mapping will be shared, partially or not, if possible
|
is removed. An existing mapping will be shared, partially or not, if possible
|
||||||
@@ -232,7 +232,7 @@ want to handle it, despite the fact it's got an operation. For instance, it
|
|||||||
might try directing the call to a secondary driver which turns out not to
|
might try directing the call to a secondary driver which turns out not to
|
||||||
implement it. Such is the case for the framebuffer driver which attempts to
|
implement it. Such is the case for the framebuffer driver which attempts to
|
||||||
direct the call to the device-specific driver. Under such circumstances, the
|
direct the call to the device-specific driver. Under such circumstances, the
|
||||||
mapping request will be rejected if BDI_CAP_MAP_COPY is not specified, and a
|
mapping request will be rejected if NOMMU_MAP_COPY is not specified, and a
|
||||||
copy mapped otherwise.
|
copy mapped otherwise.
|
||||||
|
|
||||||
IMPORTANT NOTE:
|
IMPORTANT NOTE:
|
||||||
|
|||||||
+1
-1
@@ -607,7 +607,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
|
|||||||
q->backing_dev_info.ra_pages =
|
q->backing_dev_info.ra_pages =
|
||||||
(VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
|
(VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
|
||||||
q->backing_dev_info.state = 0;
|
q->backing_dev_info.state = 0;
|
||||||
q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY;
|
q->backing_dev_info.capabilities = 0;
|
||||||
q->backing_dev_info.name = "block";
|
q->backing_dev_info.name = "block";
|
||||||
q->node = node_id;
|
q->node = node_id;
|
||||||
|
|
||||||
|
|||||||
+32
-32
@@ -287,13 +287,24 @@ static unsigned long get_unmapped_area_mem(struct file *file,
|
|||||||
return pgoff << PAGE_SHIFT;
|
return pgoff << PAGE_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* permit direct mmap, for read, write or exec */
|
||||||
|
static unsigned memory_mmap_capabilities(struct file *file)
|
||||||
|
{
|
||||||
|
return NOMMU_MAP_DIRECT |
|
||||||
|
NOMMU_MAP_READ | NOMMU_MAP_WRITE | NOMMU_MAP_EXEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned zero_mmap_capabilities(struct file *file)
|
||||||
|
{
|
||||||
|
return NOMMU_MAP_COPY;
|
||||||
|
}
|
||||||
|
|
||||||
/* can't do an in-place private mapping if there's no MMU */
|
/* can't do an in-place private mapping if there's no MMU */
|
||||||
static inline int private_mapping_ok(struct vm_area_struct *vma)
|
static inline int private_mapping_ok(struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
return vma->vm_flags & VM_MAYSHARE;
|
return vma->vm_flags & VM_MAYSHARE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define get_unmapped_area_mem NULL
|
|
||||||
|
|
||||||
static inline int private_mapping_ok(struct vm_area_struct *vma)
|
static inline int private_mapping_ok(struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
@@ -721,7 +732,10 @@ static const struct file_operations mem_fops = {
|
|||||||
.write = write_mem,
|
.write = write_mem,
|
||||||
.mmap = mmap_mem,
|
.mmap = mmap_mem,
|
||||||
.open = open_mem,
|
.open = open_mem,
|
||||||
|
#ifndef CONFIG_MMU
|
||||||
.get_unmapped_area = get_unmapped_area_mem,
|
.get_unmapped_area = get_unmapped_area_mem,
|
||||||
|
.mmap_capabilities = memory_mmap_capabilities,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_DEVKMEM
|
#ifdef CONFIG_DEVKMEM
|
||||||
@@ -731,7 +745,10 @@ static const struct file_operations kmem_fops = {
|
|||||||
.write = write_kmem,
|
.write = write_kmem,
|
||||||
.mmap = mmap_kmem,
|
.mmap = mmap_kmem,
|
||||||
.open = open_kmem,
|
.open = open_kmem,
|
||||||
|
#ifndef CONFIG_MMU
|
||||||
.get_unmapped_area = get_unmapped_area_mem,
|
.get_unmapped_area = get_unmapped_area_mem,
|
||||||
|
.mmap_capabilities = memory_mmap_capabilities,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -760,16 +777,9 @@ static const struct file_operations zero_fops = {
|
|||||||
.read_iter = read_iter_zero,
|
.read_iter = read_iter_zero,
|
||||||
.aio_write = aio_write_zero,
|
.aio_write = aio_write_zero,
|
||||||
.mmap = mmap_zero,
|
.mmap = mmap_zero,
|
||||||
};
|
#ifndef CONFIG_MMU
|
||||||
|
.mmap_capabilities = zero_mmap_capabilities,
|
||||||
/*
|
#endif
|
||||||
* capabilities for /dev/zero
|
|
||||||
* - permits private mappings, "copies" are taken of the source of zeros
|
|
||||||
* - no writeback happens
|
|
||||||
*/
|
|
||||||
static struct backing_dev_info zero_bdi = {
|
|
||||||
.name = "char/mem",
|
|
||||||
.capabilities = BDI_CAP_MAP_COPY | BDI_CAP_NO_ACCT_AND_WRITEBACK,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct file_operations full_fops = {
|
static const struct file_operations full_fops = {
|
||||||
@@ -783,22 +793,22 @@ static const struct memdev {
|
|||||||
const char *name;
|
const char *name;
|
||||||
umode_t mode;
|
umode_t mode;
|
||||||
const struct file_operations *fops;
|
const struct file_operations *fops;
|
||||||
struct backing_dev_info *dev_info;
|
fmode_t fmode;
|
||||||
} devlist[] = {
|
} devlist[] = {
|
||||||
[1] = { "mem", 0, &mem_fops, &directly_mappable_cdev_bdi },
|
[1] = { "mem", 0, &mem_fops, FMODE_UNSIGNED_OFFSET },
|
||||||
#ifdef CONFIG_DEVKMEM
|
#ifdef CONFIG_DEVKMEM
|
||||||
[2] = { "kmem", 0, &kmem_fops, &directly_mappable_cdev_bdi },
|
[2] = { "kmem", 0, &kmem_fops, FMODE_UNSIGNED_OFFSET },
|
||||||
#endif
|
#endif
|
||||||
[3] = { "null", 0666, &null_fops, NULL },
|
[3] = { "null", 0666, &null_fops, 0 },
|
||||||
#ifdef CONFIG_DEVPORT
|
#ifdef CONFIG_DEVPORT
|
||||||
[4] = { "port", 0, &port_fops, NULL },
|
[4] = { "port", 0, &port_fops, 0 },
|
||||||
#endif
|
#endif
|
||||||
[5] = { "zero", 0666, &zero_fops, &zero_bdi },
|
[5] = { "zero", 0666, &zero_fops, 0 },
|
||||||
[7] = { "full", 0666, &full_fops, NULL },
|
[7] = { "full", 0666, &full_fops, 0 },
|
||||||
[8] = { "random", 0666, &random_fops, NULL },
|
[8] = { "random", 0666, &random_fops, 0 },
|
||||||
[9] = { "urandom", 0666, &urandom_fops, NULL },
|
[9] = { "urandom", 0666, &urandom_fops, 0 },
|
||||||
#ifdef CONFIG_PRINTK
|
#ifdef CONFIG_PRINTK
|
||||||
[11] = { "kmsg", 0644, &kmsg_fops, NULL },
|
[11] = { "kmsg", 0644, &kmsg_fops, 0 },
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -816,12 +826,7 @@ static int memory_open(struct inode *inode, struct file *filp)
|
|||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
filp->f_op = dev->fops;
|
filp->f_op = dev->fops;
|
||||||
if (dev->dev_info)
|
filp->f_mode |= dev->fmode;
|
||||||
filp->f_mapping->backing_dev_info = dev->dev_info;
|
|
||||||
|
|
||||||
/* Is /dev/mem or /dev/kmem ? */
|
|
||||||
if (dev->dev_info == &directly_mappable_cdev_bdi)
|
|
||||||
filp->f_mode |= FMODE_UNSIGNED_OFFSET;
|
|
||||||
|
|
||||||
if (dev->fops->open)
|
if (dev->fops->open)
|
||||||
return dev->fops->open(inode, filp);
|
return dev->fops->open(inode, filp);
|
||||||
@@ -846,11 +851,6 @@ static struct class *mem_class;
|
|||||||
static int __init chr_dev_init(void)
|
static int __init chr_dev_init(void)
|
||||||
{
|
{
|
||||||
int minor;
|
int minor;
|
||||||
int err;
|
|
||||||
|
|
||||||
err = bdi_init(&zero_bdi);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
if (register_chrdev(MEM_MAJOR, "mem", &memory_fops))
|
if (register_chrdev(MEM_MAJOR, "mem", &memory_fops))
|
||||||
printk("unable to get major %d for memory devs\n", MEM_MAJOR);
|
printk("unable to get major %d for memory devs\n", MEM_MAJOR);
|
||||||
|
|||||||
+1
-3
@@ -104,11 +104,9 @@ static int raw_release(struct inode *inode, struct file *filp)
|
|||||||
|
|
||||||
mutex_lock(&raw_mutex);
|
mutex_lock(&raw_mutex);
|
||||||
bdev = raw_devices[minor].binding;
|
bdev = raw_devices[minor].binding;
|
||||||
if (--raw_devices[minor].inuse == 0) {
|
if (--raw_devices[minor].inuse == 0)
|
||||||
/* Here inode->i_mapping == bdev->bd_inode->i_mapping */
|
/* Here inode->i_mapping == bdev->bd_inode->i_mapping */
|
||||||
inode->i_mapping = &inode->i_data;
|
inode->i_mapping = &inode->i_data;
|
||||||
inode->i_mapping->backing_dev_info = &default_backing_dev_info;
|
|
||||||
}
|
|
||||||
mutex_unlock(&raw_mutex);
|
mutex_unlock(&raw_mutex);
|
||||||
|
|
||||||
blkdev_put(bdev, filp->f_mode | FMODE_EXCL);
|
blkdev_put(bdev, filp->f_mode | FMODE_EXCL);
|
||||||
|
|||||||
+10
-62
@@ -49,7 +49,6 @@ static DEFINE_MUTEX(mtd_mutex);
|
|||||||
*/
|
*/
|
||||||
struct mtd_file_info {
|
struct mtd_file_info {
|
||||||
struct mtd_info *mtd;
|
struct mtd_info *mtd;
|
||||||
struct inode *ino;
|
|
||||||
enum mtd_file_modes mode;
|
enum mtd_file_modes mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,10 +58,6 @@ static loff_t mtdchar_lseek(struct file *file, loff_t offset, int orig)
|
|||||||
return fixed_size_llseek(file, offset, orig, mfi->mtd->size);
|
return fixed_size_llseek(file, offset, orig, mfi->mtd->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int count;
|
|
||||||
static struct vfsmount *mnt;
|
|
||||||
static struct file_system_type mtd_inodefs_type;
|
|
||||||
|
|
||||||
static int mtdchar_open(struct inode *inode, struct file *file)
|
static int mtdchar_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
int minor = iminor(inode);
|
int minor = iminor(inode);
|
||||||
@@ -70,7 +65,6 @@ static int mtdchar_open(struct inode *inode, struct file *file)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct mtd_info *mtd;
|
struct mtd_info *mtd;
|
||||||
struct mtd_file_info *mfi;
|
struct mtd_file_info *mfi;
|
||||||
struct inode *mtd_ino;
|
|
||||||
|
|
||||||
pr_debug("MTD_open\n");
|
pr_debug("MTD_open\n");
|
||||||
|
|
||||||
@@ -78,10 +72,6 @@ static int mtdchar_open(struct inode *inode, struct file *file)
|
|||||||
if ((file->f_mode & FMODE_WRITE) && (minor & 1))
|
if ((file->f_mode & FMODE_WRITE) && (minor & 1))
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
||||||
ret = simple_pin_fs(&mtd_inodefs_type, &mnt, &count);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
mutex_lock(&mtd_mutex);
|
mutex_lock(&mtd_mutex);
|
||||||
mtd = get_mtd_device(NULL, devnum);
|
mtd = get_mtd_device(NULL, devnum);
|
||||||
|
|
||||||
@@ -95,43 +85,26 @@ static int mtdchar_open(struct inode *inode, struct file *file)
|
|||||||
goto out1;
|
goto out1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mtd_ino = iget_locked(mnt->mnt_sb, devnum);
|
|
||||||
if (!mtd_ino) {
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto out1;
|
|
||||||
}
|
|
||||||
if (mtd_ino->i_state & I_NEW) {
|
|
||||||
mtd_ino->i_private = mtd;
|
|
||||||
mtd_ino->i_mode = S_IFCHR;
|
|
||||||
mtd_ino->i_data.backing_dev_info = mtd->backing_dev_info;
|
|
||||||
unlock_new_inode(mtd_ino);
|
|
||||||
}
|
|
||||||
file->f_mapping = mtd_ino->i_mapping;
|
|
||||||
|
|
||||||
/* You can't open it RW if it's not a writeable device */
|
/* You can't open it RW if it's not a writeable device */
|
||||||
if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) {
|
if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) {
|
||||||
ret = -EACCES;
|
ret = -EACCES;
|
||||||
goto out2;
|
goto out1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mfi = kzalloc(sizeof(*mfi), GFP_KERNEL);
|
mfi = kzalloc(sizeof(*mfi), GFP_KERNEL);
|
||||||
if (!mfi) {
|
if (!mfi) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out2;
|
goto out1;
|
||||||
}
|
}
|
||||||
mfi->ino = mtd_ino;
|
|
||||||
mfi->mtd = mtd;
|
mfi->mtd = mtd;
|
||||||
file->private_data = mfi;
|
file->private_data = mfi;
|
||||||
mutex_unlock(&mtd_mutex);
|
mutex_unlock(&mtd_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out2:
|
|
||||||
iput(mtd_ino);
|
|
||||||
out1:
|
out1:
|
||||||
put_mtd_device(mtd);
|
put_mtd_device(mtd);
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&mtd_mutex);
|
mutex_unlock(&mtd_mutex);
|
||||||
simple_release_fs(&mnt, &count);
|
|
||||||
return ret;
|
return ret;
|
||||||
} /* mtdchar_open */
|
} /* mtdchar_open */
|
||||||
|
|
||||||
@@ -148,12 +121,9 @@ static int mtdchar_close(struct inode *inode, struct file *file)
|
|||||||
if ((file->f_mode & FMODE_WRITE))
|
if ((file->f_mode & FMODE_WRITE))
|
||||||
mtd_sync(mtd);
|
mtd_sync(mtd);
|
||||||
|
|
||||||
iput(mfi->ino);
|
|
||||||
|
|
||||||
put_mtd_device(mtd);
|
put_mtd_device(mtd);
|
||||||
file->private_data = NULL;
|
file->private_data = NULL;
|
||||||
kfree(mfi);
|
kfree(mfi);
|
||||||
simple_release_fs(&mnt, &count);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} /* mtdchar_close */
|
} /* mtdchar_close */
|
||||||
@@ -1117,6 +1087,13 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file,
|
|||||||
ret = mtd_get_unmapped_area(mtd, len, offset, flags);
|
ret = mtd_get_unmapped_area(mtd, len, offset, flags);
|
||||||
return ret == -EOPNOTSUPP ? -ENODEV : ret;
|
return ret == -EOPNOTSUPP ? -ENODEV : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned mtdchar_mmap_capabilities(struct file *file)
|
||||||
|
{
|
||||||
|
struct mtd_file_info *mfi = file->private_data;
|
||||||
|
|
||||||
|
return mtd_mmap_capabilities(mfi->mtd);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1160,27 +1137,10 @@ static const struct file_operations mtd_fops = {
|
|||||||
.mmap = mtdchar_mmap,
|
.mmap = mtdchar_mmap,
|
||||||
#ifndef CONFIG_MMU
|
#ifndef CONFIG_MMU
|
||||||
.get_unmapped_area = mtdchar_get_unmapped_area,
|
.get_unmapped_area = mtdchar_get_unmapped_area,
|
||||||
|
.mmap_capabilities = mtdchar_mmap_capabilities,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct super_operations mtd_ops = {
|
|
||||||
.drop_inode = generic_delete_inode,
|
|
||||||
.statfs = simple_statfs,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct dentry *mtd_inodefs_mount(struct file_system_type *fs_type,
|
|
||||||
int flags, const char *dev_name, void *data)
|
|
||||||
{
|
|
||||||
return mount_pseudo(fs_type, "mtd_inode:", &mtd_ops, NULL, MTD_INODE_FS_MAGIC);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct file_system_type mtd_inodefs_type = {
|
|
||||||
.name = "mtd_inodefs",
|
|
||||||
.mount = mtd_inodefs_mount,
|
|
||||||
.kill_sb = kill_anon_super,
|
|
||||||
};
|
|
||||||
MODULE_ALIAS_FS("mtd_inodefs");
|
|
||||||
|
|
||||||
int __init init_mtdchar(void)
|
int __init init_mtdchar(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -1193,23 +1153,11 @@ int __init init_mtdchar(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = register_filesystem(&mtd_inodefs_type);
|
|
||||||
if (ret) {
|
|
||||||
pr_err("Can't register mtd_inodefs filesystem, error %d\n",
|
|
||||||
ret);
|
|
||||||
goto err_unregister_chdev;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
err_unregister_chdev:
|
|
||||||
__unregister_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS, "mtd");
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __exit cleanup_mtdchar(void)
|
void __exit cleanup_mtdchar(void)
|
||||||
{
|
{
|
||||||
unregister_filesystem(&mtd_inodefs_type);
|
|
||||||
__unregister_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS, "mtd");
|
__unregister_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS, "mtd");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -732,8 +732,6 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c
|
|||||||
|
|
||||||
concat->mtd.ecc_stats.badblocks = subdev[0]->ecc_stats.badblocks;
|
concat->mtd.ecc_stats.badblocks = subdev[0]->ecc_stats.badblocks;
|
||||||
|
|
||||||
concat->mtd.backing_dev_info = subdev[0]->backing_dev_info;
|
|
||||||
|
|
||||||
concat->subdev[0] = subdev[0];
|
concat->subdev[0] = subdev[0];
|
||||||
|
|
||||||
for (i = 1; i < num_devs; i++) {
|
for (i = 1; i < num_devs; i++) {
|
||||||
@@ -761,14 +759,6 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c
|
|||||||
subdev[i]->flags & MTD_WRITEABLE;
|
subdev[i]->flags & MTD_WRITEABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only permit direct mapping if the BDIs are all the same
|
|
||||||
* - copy-mapping is still permitted
|
|
||||||
*/
|
|
||||||
if (concat->mtd.backing_dev_info !=
|
|
||||||
subdev[i]->backing_dev_info)
|
|
||||||
concat->mtd.backing_dev_info =
|
|
||||||
&default_backing_dev_info;
|
|
||||||
|
|
||||||
concat->mtd.size += subdev[i]->size;
|
concat->mtd.size += subdev[i]->size;
|
||||||
concat->mtd.ecc_stats.badblocks +=
|
concat->mtd.ecc_stats.badblocks +=
|
||||||
subdev[i]->ecc_stats.badblocks;
|
subdev[i]->ecc_stats.badblocks;
|
||||||
|
|||||||
+23
-58
@@ -43,33 +43,7 @@
|
|||||||
|
|
||||||
#include "mtdcore.h"
|
#include "mtdcore.h"
|
||||||
|
|
||||||
/*
|
static struct backing_dev_info mtd_bdi = {
|
||||||
* backing device capabilities for non-mappable devices (such as NAND flash)
|
|
||||||
* - permits private mappings, copies are taken of the data
|
|
||||||
*/
|
|
||||||
static struct backing_dev_info mtd_bdi_unmappable = {
|
|
||||||
.capabilities = BDI_CAP_MAP_COPY,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* backing device capabilities for R/O mappable devices (such as ROM)
|
|
||||||
* - permits private mappings, copies are taken of the data
|
|
||||||
* - permits non-writable shared mappings
|
|
||||||
*/
|
|
||||||
static struct backing_dev_info mtd_bdi_ro_mappable = {
|
|
||||||
.capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT |
|
|
||||||
BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP),
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* backing device capabilities for writable mappable devices (such as RAM)
|
|
||||||
* - permits private mappings, copies are taken of the data
|
|
||||||
* - permits non-writable shared mappings
|
|
||||||
*/
|
|
||||||
static struct backing_dev_info mtd_bdi_rw_mappable = {
|
|
||||||
.capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT |
|
|
||||||
BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP |
|
|
||||||
BDI_CAP_WRITE_MAP),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int mtd_cls_suspend(struct device *dev, pm_message_t state);
|
static int mtd_cls_suspend(struct device *dev, pm_message_t state);
|
||||||
@@ -365,6 +339,23 @@ static struct device_type mtd_devtype = {
|
|||||||
.release = mtd_release,
|
.release = mtd_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef CONFIG_MMU
|
||||||
|
unsigned mtd_mmap_capabilities(struct mtd_info *mtd)
|
||||||
|
{
|
||||||
|
switch (mtd->type) {
|
||||||
|
case MTD_RAM:
|
||||||
|
return NOMMU_MAP_COPY | NOMMU_MAP_DIRECT | NOMMU_MAP_EXEC |
|
||||||
|
NOMMU_MAP_READ | NOMMU_MAP_WRITE;
|
||||||
|
case MTD_ROM:
|
||||||
|
return NOMMU_MAP_COPY | NOMMU_MAP_DIRECT | NOMMU_MAP_EXEC |
|
||||||
|
NOMMU_MAP_READ;
|
||||||
|
default:
|
||||||
|
return NOMMU_MAP_COPY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(mtd_mmap_capabilities);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add_mtd_device - register an MTD device
|
* add_mtd_device - register an MTD device
|
||||||
* @mtd: pointer to new MTD device info structure
|
* @mtd: pointer to new MTD device info structure
|
||||||
@@ -380,19 +371,7 @@ int add_mtd_device(struct mtd_info *mtd)
|
|||||||
struct mtd_notifier *not;
|
struct mtd_notifier *not;
|
||||||
int i, error;
|
int i, error;
|
||||||
|
|
||||||
if (!mtd->backing_dev_info) {
|
mtd->backing_dev_info = &mtd_bdi;
|
||||||
switch (mtd->type) {
|
|
||||||
case MTD_RAM:
|
|
||||||
mtd->backing_dev_info = &mtd_bdi_rw_mappable;
|
|
||||||
break;
|
|
||||||
case MTD_ROM:
|
|
||||||
mtd->backing_dev_info = &mtd_bdi_ro_mappable;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
mtd->backing_dev_info = &mtd_bdi_unmappable;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BUG_ON(mtd->writesize == 0);
|
BUG_ON(mtd->writesize == 0);
|
||||||
mutex_lock(&mtd_table_mutex);
|
mutex_lock(&mtd_table_mutex);
|
||||||
@@ -1237,17 +1216,9 @@ static int __init init_mtd(void)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto err_reg;
|
goto err_reg;
|
||||||
|
|
||||||
ret = mtd_bdi_init(&mtd_bdi_unmappable, "mtd-unmap");
|
ret = mtd_bdi_init(&mtd_bdi, "mtd");
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_bdi1;
|
goto err_bdi;
|
||||||
|
|
||||||
ret = mtd_bdi_init(&mtd_bdi_ro_mappable, "mtd-romap");
|
|
||||||
if (ret)
|
|
||||||
goto err_bdi2;
|
|
||||||
|
|
||||||
ret = mtd_bdi_init(&mtd_bdi_rw_mappable, "mtd-rwmap");
|
|
||||||
if (ret)
|
|
||||||
goto err_bdi3;
|
|
||||||
|
|
||||||
proc_mtd = proc_create("mtd", 0, NULL, &mtd_proc_ops);
|
proc_mtd = proc_create("mtd", 0, NULL, &mtd_proc_ops);
|
||||||
|
|
||||||
@@ -1260,11 +1231,7 @@ static int __init init_mtd(void)
|
|||||||
out_procfs:
|
out_procfs:
|
||||||
if (proc_mtd)
|
if (proc_mtd)
|
||||||
remove_proc_entry("mtd", NULL);
|
remove_proc_entry("mtd", NULL);
|
||||||
err_bdi3:
|
err_bdi:
|
||||||
bdi_destroy(&mtd_bdi_ro_mappable);
|
|
||||||
err_bdi2:
|
|
||||||
bdi_destroy(&mtd_bdi_unmappable);
|
|
||||||
err_bdi1:
|
|
||||||
class_unregister(&mtd_class);
|
class_unregister(&mtd_class);
|
||||||
err_reg:
|
err_reg:
|
||||||
pr_err("Error registering mtd class or bdi: %d\n", ret);
|
pr_err("Error registering mtd class or bdi: %d\n", ret);
|
||||||
@@ -1277,9 +1244,7 @@ static void __exit cleanup_mtd(void)
|
|||||||
if (proc_mtd)
|
if (proc_mtd)
|
||||||
remove_proc_entry("mtd", NULL);
|
remove_proc_entry("mtd", NULL);
|
||||||
class_unregister(&mtd_class);
|
class_unregister(&mtd_class);
|
||||||
bdi_destroy(&mtd_bdi_unmappable);
|
bdi_destroy(&mtd_bdi);
|
||||||
bdi_destroy(&mtd_bdi_ro_mappable);
|
|
||||||
bdi_destroy(&mtd_bdi_rw_mappable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(init_mtd);
|
module_init(init_mtd);
|
||||||
|
|||||||
@@ -378,7 +378,6 @@ static struct mtd_part *allocate_partition(struct mtd_info *master,
|
|||||||
|
|
||||||
slave->mtd.name = name;
|
slave->mtd.name = name;
|
||||||
slave->mtd.owner = master->owner;
|
slave->mtd.owner = master->owner;
|
||||||
slave->mtd.backing_dev_info = master->backing_dev_info;
|
|
||||||
|
|
||||||
/* NOTE: we don't arrange MTDs as a tree; it'd be error-prone
|
/* NOTE: we don't arrange MTDs as a tree; it'd be error-prone
|
||||||
* to have the same data be in two different partitions.
|
* to have the same data be in two different partitions.
|
||||||
|
|||||||
@@ -987,7 +987,7 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
|
|||||||
if (err)
|
if (err)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
lsi->lsi_flags |= LSI_BDI_INITIALIZED;
|
lsi->lsi_flags |= LSI_BDI_INITIALIZED;
|
||||||
lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY;
|
lsi->lsi_bdi.capabilities = 0;
|
||||||
err = ll_bdi_register(&lsi->lsi_bdi);
|
err = ll_bdi_register(&lsi->lsi_bdi);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
@@ -1812,10 +1812,6 @@ void ll_read_inode2(struct inode *inode, void *opaque)
|
|||||||
|
|
||||||
/* OIDEBUG(inode); */
|
/* OIDEBUG(inode); */
|
||||||
|
|
||||||
/* initializing backing dev info. */
|
|
||||||
inode->i_mapping->backing_dev_info = &s2lsi(inode->i_sb)->lsi_bdi;
|
|
||||||
|
|
||||||
|
|
||||||
if (S_ISREG(inode->i_mode)) {
|
if (S_ISREG(inode->i_mode)) {
|
||||||
struct ll_sb_info *sbi = ll_i2sbi(inode);
|
struct ll_sb_info *sbi = ll_i2sbi(inode);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -335,7 +335,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
|
|||||||
}
|
}
|
||||||
init_rwsem(&v9ses->rename_sem);
|
init_rwsem(&v9ses->rename_sem);
|
||||||
|
|
||||||
rc = bdi_setup_and_register(&v9ses->bdi, "9p", BDI_CAP_MAP_COPY);
|
rc = bdi_setup_and_register(&v9ses->bdi, "9p");
|
||||||
if (rc) {
|
if (rc) {
|
||||||
kfree(v9ses->aname);
|
kfree(v9ses->aname);
|
||||||
kfree(v9ses->uname);
|
kfree(v9ses->uname);
|
||||||
|
|||||||
+1
-1
@@ -106,7 +106,7 @@ struct afs_volume *afs_volume_lookup(struct afs_mount_params *params)
|
|||||||
volume->cell = params->cell;
|
volume->cell = params->cell;
|
||||||
volume->vid = vlocation->vldb.vid[params->type];
|
volume->vid = vlocation->vldb.vid[params->type];
|
||||||
|
|
||||||
ret = bdi_setup_and_register(&volume->bdi, "afs", BDI_CAP_MAP_COPY);
|
ret = bdi_setup_and_register(&volume->bdi, "afs");
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_bdi;
|
goto error_bdi;
|
||||||
|
|
||||||
|
|||||||
@@ -165,15 +165,6 @@ static struct vfsmount *aio_mnt;
|
|||||||
static const struct file_operations aio_ring_fops;
|
static const struct file_operations aio_ring_fops;
|
||||||
static const struct address_space_operations aio_ctx_aops;
|
static const struct address_space_operations aio_ctx_aops;
|
||||||
|
|
||||||
/* Backing dev info for aio fs.
|
|
||||||
* -no dirty page accounting or writeback happens
|
|
||||||
*/
|
|
||||||
static struct backing_dev_info aio_fs_backing_dev_info = {
|
|
||||||
.name = "aiofs",
|
|
||||||
.state = 0,
|
|
||||||
.capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_MAP_COPY,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages)
|
static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages)
|
||||||
{
|
{
|
||||||
struct qstr this = QSTR_INIT("[aio]", 5);
|
struct qstr this = QSTR_INIT("[aio]", 5);
|
||||||
@@ -185,7 +176,6 @@ static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages)
|
|||||||
|
|
||||||
inode->i_mapping->a_ops = &aio_ctx_aops;
|
inode->i_mapping->a_ops = &aio_ctx_aops;
|
||||||
inode->i_mapping->private_data = ctx;
|
inode->i_mapping->private_data = ctx;
|
||||||
inode->i_mapping->backing_dev_info = &aio_fs_backing_dev_info;
|
|
||||||
inode->i_size = PAGE_SIZE * nr_pages;
|
inode->i_size = PAGE_SIZE * nr_pages;
|
||||||
|
|
||||||
path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this);
|
path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this);
|
||||||
@@ -230,9 +220,6 @@ static int __init aio_setup(void)
|
|||||||
if (IS_ERR(aio_mnt))
|
if (IS_ERR(aio_mnt))
|
||||||
panic("Failed to create aio fs mount.");
|
panic("Failed to create aio fs mount.");
|
||||||
|
|
||||||
if (bdi_init(&aio_fs_backing_dev_info))
|
|
||||||
panic("Failed to init aio fs backing dev info.");
|
|
||||||
|
|
||||||
kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
|
kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
|
||||||
kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
|
kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
|
||||||
|
|
||||||
|
|||||||
+10
-27
@@ -49,23 +49,15 @@ inline struct block_device *I_BDEV(struct inode *inode)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(I_BDEV);
|
EXPORT_SYMBOL(I_BDEV);
|
||||||
|
|
||||||
/*
|
static void bdev_write_inode(struct inode *inode)
|
||||||
* Move the inode from its current bdi to a new bdi. Make sure the inode
|
|
||||||
* is clean before moving so that it doesn't linger on the old bdi.
|
|
||||||
*/
|
|
||||||
static void bdev_inode_switch_bdi(struct inode *inode,
|
|
||||||
struct backing_dev_info *dst)
|
|
||||||
{
|
{
|
||||||
while (true) {
|
spin_lock(&inode->i_lock);
|
||||||
spin_lock(&inode->i_lock);
|
while (inode->i_state & I_DIRTY) {
|
||||||
if (!(inode->i_state & I_DIRTY)) {
|
|
||||||
inode->i_data.backing_dev_info = dst;
|
|
||||||
spin_unlock(&inode->i_lock);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
WARN_ON_ONCE(write_inode_now(inode, true));
|
WARN_ON_ONCE(write_inode_now(inode, true));
|
||||||
|
spin_lock(&inode->i_lock);
|
||||||
}
|
}
|
||||||
|
spin_unlock(&inode->i_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Kill _all_ buffers and pagecache , dirty or not.. */
|
/* Kill _all_ buffers and pagecache , dirty or not.. */
|
||||||
@@ -584,7 +576,6 @@ struct block_device *bdget(dev_t dev)
|
|||||||
inode->i_bdev = bdev;
|
inode->i_bdev = bdev;
|
||||||
inode->i_data.a_ops = &def_blk_aops;
|
inode->i_data.a_ops = &def_blk_aops;
|
||||||
mapping_set_gfp_mask(&inode->i_data, GFP_USER);
|
mapping_set_gfp_mask(&inode->i_data, GFP_USER);
|
||||||
inode->i_data.backing_dev_info = &default_backing_dev_info;
|
|
||||||
spin_lock(&bdev_lock);
|
spin_lock(&bdev_lock);
|
||||||
list_add(&bdev->bd_list, &all_bdevs);
|
list_add(&bdev->bd_list, &all_bdevs);
|
||||||
spin_unlock(&bdev_lock);
|
spin_unlock(&bdev_lock);
|
||||||
@@ -1145,8 +1136,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
|
|||||||
bdev->bd_queue = disk->queue;
|
bdev->bd_queue = disk->queue;
|
||||||
bdev->bd_contains = bdev;
|
bdev->bd_contains = bdev;
|
||||||
if (!partno) {
|
if (!partno) {
|
||||||
struct backing_dev_info *bdi;
|
|
||||||
|
|
||||||
ret = -ENXIO;
|
ret = -ENXIO;
|
||||||
bdev->bd_part = disk_get_part(disk, partno);
|
bdev->bd_part = disk_get_part(disk, partno);
|
||||||
if (!bdev->bd_part)
|
if (!bdev->bd_part)
|
||||||
@@ -1172,11 +1161,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret)
|
||||||
bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
|
bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
|
||||||
bdi = blk_get_backing_dev_info(bdev);
|
|
||||||
bdev_inode_switch_bdi(bdev->bd_inode, bdi);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the device is invalidated, rescan partition
|
* If the device is invalidated, rescan partition
|
||||||
@@ -1203,8 +1189,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto out_clear;
|
goto out_clear;
|
||||||
bdev->bd_contains = whole;
|
bdev->bd_contains = whole;
|
||||||
bdev_inode_switch_bdi(bdev->bd_inode,
|
|
||||||
whole->bd_inode->i_data.backing_dev_info);
|
|
||||||
bdev->bd_part = disk_get_part(disk, partno);
|
bdev->bd_part = disk_get_part(disk, partno);
|
||||||
if (!(disk->flags & GENHD_FL_UP) ||
|
if (!(disk->flags & GENHD_FL_UP) ||
|
||||||
!bdev->bd_part || !bdev->bd_part->nr_sects) {
|
!bdev->bd_part || !bdev->bd_part->nr_sects) {
|
||||||
@@ -1244,7 +1228,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
|
|||||||
bdev->bd_disk = NULL;
|
bdev->bd_disk = NULL;
|
||||||
bdev->bd_part = NULL;
|
bdev->bd_part = NULL;
|
||||||
bdev->bd_queue = NULL;
|
bdev->bd_queue = NULL;
|
||||||
bdev_inode_switch_bdi(bdev->bd_inode, &default_backing_dev_info);
|
|
||||||
if (bdev != bdev->bd_contains)
|
if (bdev != bdev->bd_contains)
|
||||||
__blkdev_put(bdev->bd_contains, mode, 1);
|
__blkdev_put(bdev->bd_contains, mode, 1);
|
||||||
bdev->bd_contains = NULL;
|
bdev->bd_contains = NULL;
|
||||||
@@ -1464,11 +1447,11 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
|
|||||||
WARN_ON_ONCE(bdev->bd_holders);
|
WARN_ON_ONCE(bdev->bd_holders);
|
||||||
sync_blockdev(bdev);
|
sync_blockdev(bdev);
|
||||||
kill_bdev(bdev);
|
kill_bdev(bdev);
|
||||||
/* ->release can cause the old bdi to disappear,
|
/*
|
||||||
* so must switch it out first
|
* ->release can cause the queue to disappear, so flush all
|
||||||
|
* dirty data before.
|
||||||
*/
|
*/
|
||||||
bdev_inode_switch_bdi(bdev->bd_inode,
|
bdev_write_inode(bdev->bd_inode);
|
||||||
&default_backing_dev_info);
|
|
||||||
}
|
}
|
||||||
if (bdev->bd_contains == bdev) {
|
if (bdev->bd_contains == bdev) {
|
||||||
if (disk->fops->release)
|
if (disk->fops->release)
|
||||||
|
|||||||
+2
-4
@@ -1715,12 +1715,11 @@ static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
bdi->capabilities = BDI_CAP_MAP_COPY;
|
err = bdi_setup_and_register(bdi, "btrfs");
|
||||||
err = bdi_setup_and_register(bdi, "btrfs", BDI_CAP_MAP_COPY);
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
bdi->ra_pages = default_backing_dev_info.ra_pages;
|
bdi->ra_pages = VM_MAX_READAHEAD * 1024 / PAGE_CACHE_SIZE;
|
||||||
bdi->congested_fn = btrfs_congested_fn;
|
bdi->congested_fn = btrfs_congested_fn;
|
||||||
bdi->congested_data = info;
|
bdi->congested_data = info;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2319,7 +2318,6 @@ int open_ctree(struct super_block *sb,
|
|||||||
*/
|
*/
|
||||||
fs_info->btree_inode->i_size = OFFSET_MAX;
|
fs_info->btree_inode->i_size = OFFSET_MAX;
|
||||||
fs_info->btree_inode->i_mapping->a_ops = &btree_aops;
|
fs_info->btree_inode->i_mapping->a_ops = &btree_aops;
|
||||||
fs_info->btree_inode->i_mapping->backing_dev_info = &fs_info->bdi;
|
|
||||||
|
|
||||||
RB_CLEAR_NODE(&BTRFS_I(fs_info->btree_inode)->rb_node);
|
RB_CLEAR_NODE(&BTRFS_I(fs_info->btree_inode)->rb_node);
|
||||||
extent_io_tree_init(&BTRFS_I(fs_info->btree_inode)->io_tree,
|
extent_io_tree_init(&BTRFS_I(fs_info->btree_inode)->io_tree,
|
||||||
|
|||||||
+1
-1
@@ -1746,7 +1746,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb,
|
|||||||
|
|
||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
|
|
||||||
current->backing_dev_info = inode->i_mapping->backing_dev_info;
|
current->backing_dev_info = inode_to_bdi(inode);
|
||||||
err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode));
|
err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode));
|
||||||
if (err) {
|
if (err) {
|
||||||
mutex_unlock(&inode->i_mutex);
|
mutex_unlock(&inode->i_mutex);
|
||||||
|
|||||||
@@ -3608,7 +3608,6 @@ cache_acl:
|
|||||||
switch (inode->i_mode & S_IFMT) {
|
switch (inode->i_mode & S_IFMT) {
|
||||||
case S_IFREG:
|
case S_IFREG:
|
||||||
inode->i_mapping->a_ops = &btrfs_aops;
|
inode->i_mapping->a_ops = &btrfs_aops;
|
||||||
inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
|
|
||||||
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
|
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
|
||||||
inode->i_fop = &btrfs_file_operations;
|
inode->i_fop = &btrfs_file_operations;
|
||||||
inode->i_op = &btrfs_file_inode_operations;
|
inode->i_op = &btrfs_file_inode_operations;
|
||||||
@@ -3623,7 +3622,6 @@ cache_acl:
|
|||||||
case S_IFLNK:
|
case S_IFLNK:
|
||||||
inode->i_op = &btrfs_symlink_inode_operations;
|
inode->i_op = &btrfs_symlink_inode_operations;
|
||||||
inode->i_mapping->a_ops = &btrfs_symlink_aops;
|
inode->i_mapping->a_ops = &btrfs_symlink_aops;
|
||||||
inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
inode->i_op = &btrfs_special_inode_operations;
|
inode->i_op = &btrfs_special_inode_operations;
|
||||||
@@ -6088,7 +6086,6 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
|
|||||||
inode->i_fop = &btrfs_file_operations;
|
inode->i_fop = &btrfs_file_operations;
|
||||||
inode->i_op = &btrfs_file_inode_operations;
|
inode->i_op = &btrfs_file_inode_operations;
|
||||||
inode->i_mapping->a_ops = &btrfs_aops;
|
inode->i_mapping->a_ops = &btrfs_aops;
|
||||||
inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
|
|
||||||
|
|
||||||
err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
|
err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
|
||||||
if (err)
|
if (err)
|
||||||
@@ -9203,7 +9200,6 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
|
|||||||
inode->i_fop = &btrfs_file_operations;
|
inode->i_fop = &btrfs_file_operations;
|
||||||
inode->i_op = &btrfs_file_inode_operations;
|
inode->i_op = &btrfs_file_inode_operations;
|
||||||
inode->i_mapping->a_ops = &btrfs_aops;
|
inode->i_mapping->a_ops = &btrfs_aops;
|
||||||
inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
|
|
||||||
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
|
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
|
||||||
|
|
||||||
err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
|
err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
|
||||||
@@ -9247,7 +9243,6 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
|
|||||||
|
|
||||||
inode->i_op = &btrfs_symlink_inode_operations;
|
inode->i_op = &btrfs_symlink_inode_operations;
|
||||||
inode->i_mapping->a_ops = &btrfs_symlink_aops;
|
inode->i_mapping->a_ops = &btrfs_symlink_aops;
|
||||||
inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
|
|
||||||
inode_set_bytes(inode, name_len);
|
inode_set_bytes(inode, name_len);
|
||||||
btrfs_i_size_write(inode, name_len);
|
btrfs_i_size_write(inode, name_len);
|
||||||
err = btrfs_update_inode(trans, root, inode);
|
err = btrfs_update_inode(trans, root, inode);
|
||||||
@@ -9459,7 +9454,6 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
|
|||||||
inode->i_op = &btrfs_file_inode_operations;
|
inode->i_op = &btrfs_file_inode_operations;
|
||||||
|
|
||||||
inode->i_mapping->a_ops = &btrfs_aops;
|
inode->i_mapping->a_ops = &btrfs_aops;
|
||||||
inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
|
|
||||||
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
|
BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
|
||||||
|
|
||||||
ret = btrfs_init_inode_security(trans, inode, dir, NULL);
|
ret = btrfs_init_inode_security(trans, inode, dir, NULL);
|
||||||
|
|||||||
+1
-1
@@ -945,7 +945,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
|||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
|
|
||||||
/* We can write back this queue in page reclaim */
|
/* We can write back this queue in page reclaim */
|
||||||
current->backing_dev_info = file->f_mapping->backing_dev_info;
|
current->backing_dev_info = inode_to_bdi(inode);
|
||||||
|
|
||||||
err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode));
|
err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode));
|
||||||
if (err)
|
if (err)
|
||||||
|
|||||||
@@ -783,8 +783,6 @@ static int fill_inode(struct inode *inode, struct page *locked_page,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inode->i_mapping->a_ops = &ceph_aops;
|
inode->i_mapping->a_ops = &ceph_aops;
|
||||||
inode->i_mapping->backing_dev_info =
|
|
||||||
&ceph_sb_to_client(inode->i_sb)->backing_dev_info;
|
|
||||||
|
|
||||||
switch (inode->i_mode & S_IFMT) {
|
switch (inode->i_mode & S_IFMT) {
|
||||||
case S_IFIFO:
|
case S_IFIFO:
|
||||||
|
|||||||
+7
-13
@@ -40,17 +40,6 @@ static void ceph_put_super(struct super_block *s)
|
|||||||
|
|
||||||
dout("put_super\n");
|
dout("put_super\n");
|
||||||
ceph_mdsc_close_sessions(fsc->mdsc);
|
ceph_mdsc_close_sessions(fsc->mdsc);
|
||||||
|
|
||||||
/*
|
|
||||||
* ensure we release the bdi before put_anon_super releases
|
|
||||||
* the device name.
|
|
||||||
*/
|
|
||||||
if (s->s_bdi == &fsc->backing_dev_info) {
|
|
||||||
bdi_unregister(&fsc->backing_dev_info);
|
|
||||||
s->s_bdi = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
|
static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
|
||||||
@@ -910,7 +899,7 @@ static int ceph_register_bdi(struct super_block *sb,
|
|||||||
>> PAGE_SHIFT;
|
>> PAGE_SHIFT;
|
||||||
else
|
else
|
||||||
fsc->backing_dev_info.ra_pages =
|
fsc->backing_dev_info.ra_pages =
|
||||||
default_backing_dev_info.ra_pages;
|
VM_MAX_READAHEAD * 1024 / PAGE_CACHE_SIZE;
|
||||||
|
|
||||||
err = bdi_register(&fsc->backing_dev_info, NULL, "ceph-%ld",
|
err = bdi_register(&fsc->backing_dev_info, NULL, "ceph-%ld",
|
||||||
atomic_long_inc_return(&bdi_seq));
|
atomic_long_inc_return(&bdi_seq));
|
||||||
@@ -1002,11 +991,16 @@ out_final:
|
|||||||
static void ceph_kill_sb(struct super_block *s)
|
static void ceph_kill_sb(struct super_block *s)
|
||||||
{
|
{
|
||||||
struct ceph_fs_client *fsc = ceph_sb_to_client(s);
|
struct ceph_fs_client *fsc = ceph_sb_to_client(s);
|
||||||
|
dev_t dev = s->s_dev;
|
||||||
|
|
||||||
dout("kill_sb %p\n", s);
|
dout("kill_sb %p\n", s);
|
||||||
|
|
||||||
ceph_mdsc_pre_umount(fsc->mdsc);
|
ceph_mdsc_pre_umount(fsc->mdsc);
|
||||||
kill_anon_super(s); /* will call put_super after sb is r/o */
|
generic_shutdown_super(s);
|
||||||
ceph_mdsc_destroy(fsc);
|
ceph_mdsc_destroy(fsc);
|
||||||
|
|
||||||
destroy_fs_client(fsc);
|
destroy_fs_client(fsc);
|
||||||
|
free_anon_bdev(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_system_type ceph_fs_type = {
|
static struct file_system_type ceph_fs_type = {
|
||||||
|
|||||||
@@ -24,27 +24,6 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* capabilities for /dev/mem, /dev/kmem and similar directly mappable character
|
|
||||||
* devices
|
|
||||||
* - permits shared-mmap for read, write and/or exec
|
|
||||||
* - does not permit private mmap in NOMMU mode (can't do COW)
|
|
||||||
* - no readahead or I/O queue unplugging required
|
|
||||||
*/
|
|
||||||
struct backing_dev_info directly_mappable_cdev_bdi = {
|
|
||||||
.name = "char",
|
|
||||||
.capabilities = (
|
|
||||||
#ifdef CONFIG_MMU
|
|
||||||
/* permit private copies of the data to be taken */
|
|
||||||
BDI_CAP_MAP_COPY |
|
|
||||||
#endif
|
|
||||||
/* permit direct mmap, for read, write or exec */
|
|
||||||
BDI_CAP_MAP_DIRECT |
|
|
||||||
BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP |
|
|
||||||
/* no writeback happens */
|
|
||||||
BDI_CAP_NO_ACCT_AND_WRITEBACK),
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct kobj_map *cdev_map;
|
static struct kobj_map *cdev_map;
|
||||||
|
|
||||||
static DEFINE_MUTEX(chrdevs_lock);
|
static DEFINE_MUTEX(chrdevs_lock);
|
||||||
@@ -575,8 +554,6 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data)
|
|||||||
void __init chrdev_init(void)
|
void __init chrdev_init(void)
|
||||||
{
|
{
|
||||||
cdev_map = kobj_map_init(base_probe, &chrdevs_lock);
|
cdev_map = kobj_map_init(base_probe, &chrdevs_lock);
|
||||||
if (bdi_init(&directly_mappable_cdev_bdi))
|
|
||||||
panic("Failed to init directly mappable cdev bdi");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -590,4 +567,3 @@ EXPORT_SYMBOL(cdev_del);
|
|||||||
EXPORT_SYMBOL(cdev_add);
|
EXPORT_SYMBOL(cdev_add);
|
||||||
EXPORT_SYMBOL(__register_chrdev);
|
EXPORT_SYMBOL(__register_chrdev);
|
||||||
EXPORT_SYMBOL(__unregister_chrdev);
|
EXPORT_SYMBOL(__unregister_chrdev);
|
||||||
EXPORT_SYMBOL(directly_mappable_cdev_bdi);
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user