Skip to content

Commit

Permalink
fs/: Import alps-release-q0.mp1-V9.156.1 kernel changes
Browse files Browse the repository at this point in the history
Signed-off-by: Hadenix <vsegda_online_007@bk.ru>
  • Loading branch information
Hadenix committed Feb 2, 2024
1 parent 242f8b8 commit 8da5b64
Show file tree
Hide file tree
Showing 126 changed files with 1,579 additions and 274 deletions.
2 changes: 2 additions & 0 deletions fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# Rewritten to use lists instead of if-statements.
#

subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/include

obj-y := open.o read_write.o file_table.o super.o \
char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
ioctl.o readdir.o select.o dcache.o inode.o \
Expand Down
10 changes: 7 additions & 3 deletions fs/binfmt_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,7 @@ static int elf_core_dump(struct coredump_params *cprm)

dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);

vma_filesz = kmalloc_array(segs - 1, sizeof(*vma_filesz), GFP_KERNEL);
vma_filesz = vmalloc((segs - 1) * sizeof(*vma_filesz));
if (!vma_filesz)
goto end_coredump;

Expand Down Expand Up @@ -2334,8 +2334,12 @@ static int elf_core_dump(struct coredump_params *cprm)
put_page(page);
} else
stop = !dump_skip(cprm, PAGE_SIZE);
if (stop)
if (stop) {
pr_info("%s: stop:0x%lx, vm_start:0x%lx, vm_end:0x%lx\n",
__func__, addr,
vma->vm_start, vma->vm_end);
goto end_coredump;
}
}
}
dump_truncate(cprm);
Expand All @@ -2354,7 +2358,7 @@ static int elf_core_dump(struct coredump_params *cprm)
cleanup:
free_note_info(&info);
kfree(shdr4extnum);
kfree(vma_filesz);
vfree(vma_filesz);
kfree(phdr4note);
kfree(elf);
out:
Expand Down
2 changes: 1 addition & 1 deletion fs/binfmt_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ static const struct super_operations s_ops = {
static int bm_fill_super(struct super_block *sb, void *data, int silent)
{
int err;
static struct tree_descr bm_files[] = {
static const struct tree_descr bm_files[] = {
[2] = {"status", &bm_status_operations, S_IWUSR|S_IRUGO},
[3] = {"register", &bm_register_operations, S_IWUSR},
/* last one */ {""}
Expand Down
22 changes: 22 additions & 0 deletions fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,8 @@ static void bdev_evict_inode(struct inode *inode)
spin_lock(&bdev_lock);
list_del_init(&bdev->bd_list);
spin_unlock(&bdev_lock);
if (bdev->bd_bdi != &noop_backing_dev_info)
bdi_put(bdev->bd_bdi);
}

static const struct super_operations bdev_sops = {
Expand Down Expand Up @@ -712,6 +714,21 @@ static int bdev_set(struct inode *inode, void *data)

static LIST_HEAD(all_bdevs);

/*
* If there is a bdev inode for this device, unhash it so that it gets evicted
* as soon as last inode reference is dropped.
*/
void bdev_unhash_inode(dev_t dev)
{
struct inode *inode;

inode = ilookup5(blockdev_superblock, hash(dev), bdev_test, &dev);
if (inode) {
remove_inode_hash(inode);
iput(inode);
}
}

struct block_device *bdget(dev_t dev)
{
struct block_device *bdev;
Expand All @@ -729,6 +746,7 @@ struct block_device *bdget(dev_t dev)
bdev->bd_contains = NULL;
bdev->bd_super = NULL;
bdev->bd_inode = inode;
bdev->bd_bdi = &noop_backing_dev_info;
bdev->bd_block_size = i_blocksize(inode);
bdev->bd_part_count = 0;
bdev->bd_invalidated = 0;
Expand Down Expand Up @@ -1275,6 +1293,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
bdev->bd_disk = disk;
bdev->bd_queue = disk->queue;
bdev->bd_contains = bdev;
if (bdev->bd_bdi == &noop_backing_dev_info)
bdev->bd_bdi = bdi_get(disk->queue->backing_dev_info);

if (!partno) {
ret = -ENXIO;
Expand Down Expand Up @@ -1373,6 +1393,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
bdev->bd_disk = NULL;
bdev->bd_part = NULL;
bdev->bd_queue = NULL;
bdi_put(bdev->bd_bdi);
bdev->bd_bdi = &noop_backing_dev_info;
if (bdev != bdev->bd_contains)
__blkdev_put(bdev->bd_contains, mode, 1);
bdev->bd_contains = NULL;
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
list_for_each_entry_rcu(device, &info->fs_devices->devices, dev_list) {
if (!device->bdev)
continue;
bdi = blk_get_backing_dev_info(device->bdev);
bdi = device->bdev->bd_bdi;
if (bdi_congested(bdi, bdi_bits)) {
ret = 1;
break;
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ static noinline void run_scheduled_bios(struct btrfs_device *device)
*/
blk_start_plug(&plug);

bdi = blk_get_backing_dev_info(device->bdev);
bdi = device->bdev->bd_bdi;
fs_info = device->dev_root->fs_info;
limit = btrfs_async_submit_limit(fs_info);
limit = limit * 2 / 3;
Expand Down
71 changes: 51 additions & 20 deletions fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@
#include <linux/mpage.h>
#include <linux/bit_spinlock.h>
#include <trace/events/block.h>
#include <linux/hie.h>

static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
unsigned long bio_flags,
static int submit_bh_wbc_crypt(struct inode *inode, int op, int op_flags,
struct buffer_head *bh, unsigned long bio_flags,
struct writeback_control *wbc);

#define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
Expand Down Expand Up @@ -1083,6 +1084,10 @@ static struct buffer_head *
__getblk_slow(struct block_device *bdev, sector_t block,
unsigned size, gfp_t gfp)
{
#ifdef CONFIG_ZONE_MOVABLE_CMA
/* __GFP_MOVABLE is not allowed for buffer_head */
gfp &= ~__GFP_MOVABLE;
#endif
/* Size must be multiple of hard sectorsize */
if (unlikely(size & (bdev_logical_block_size(bdev)-1) ||
(size < 512 || size > PAGE_SIZE))) {
Expand Down Expand Up @@ -1787,7 +1792,8 @@ int __block_write_full_page(struct inode *inode, struct page *page,
do {
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc);
submit_bh_wbc_crypt(inode, REQ_OP_WRITE,
write_flags, bh, 0, wbc);
nr_underway++;
}
bh = next;
Expand Down Expand Up @@ -1841,7 +1847,8 @@ int __block_write_full_page(struct inode *inode, struct page *page,
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
clear_buffer_dirty(bh);
submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc);
submit_bh_wbc_crypt(inode, REQ_OP_WRITE,
write_flags, bh, 0, wbc);
nr_underway++;
}
bh = next;
Expand Down Expand Up @@ -3059,8 +3066,9 @@ void guard_bio_eod(int op, struct bio *bio)
}
}

static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
unsigned long bio_flags, struct writeback_control *wbc)
int submit_bh_wbc_crypt(struct inode *inode, int op, int op_flags,
struct buffer_head *bh, unsigned long bio_flags,
struct writeback_control *wbc)
{
struct bio *bio;

Expand Down Expand Up @@ -3097,6 +3105,9 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
bio->bi_private = bh;
bio->bi_flags |= bio_flags;

if (inode)
hie_set_bio_crypt_context(inode, bio);

/* Take care of bh's that straddle the end of the device */
guard_bio_eod(op, bio);

Expand All @@ -3113,13 +3124,20 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
int _submit_bh(int op, int op_flags, struct buffer_head *bh,
unsigned long bio_flags)
{
return submit_bh_wbc(op, op_flags, bh, bio_flags, NULL);
return submit_bh_wbc_crypt(NULL, op, op_flags, bh, bio_flags, NULL);
}
EXPORT_SYMBOL_GPL(_submit_bh);

int submit_bh(int op, int op_flags, struct buffer_head *bh)
int submit_bh_crypt(struct inode *inode, int op, int op_flags,
struct buffer_head *bh)
{
return submit_bh_wbc(op, op_flags, bh, 0, NULL);
return submit_bh_wbc_crypt(inode, op, op_flags, bh, 0, NULL);
}
EXPORT_SYMBOL(submit_bh_crypt);

int submit_bh(int op, int op_flags, struct buffer_head *bh)
{
return submit_bh_wbc_crypt(NULL, op, op_flags, bh, 0, NULL);
}
EXPORT_SYMBOL(submit_bh);

Expand Down Expand Up @@ -3149,7 +3167,8 @@ EXPORT_SYMBOL(submit_bh);
* All of the buffers must be for the same device, and must also be a
* multiple of the current approved size for the device.
*/
void ll_rw_block(int op, int op_flags, int nr, struct buffer_head *bhs[])
void ll_rw_block_crypt(struct inode *inode, int op, int op_flags, int nr,
struct buffer_head *bhs[])
{
int i;

Expand All @@ -3162,20 +3181,26 @@ void ll_rw_block(int op, int op_flags, int nr, struct buffer_head *bhs[])
if (test_clear_buffer_dirty(bh)) {
bh->b_end_io = end_buffer_write_sync;
get_bh(bh);
submit_bh(op, op_flags, bh);
submit_bh_crypt(inode, op, op_flags, bh);
continue;
}
} else {
if (!buffer_uptodate(bh)) {
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
submit_bh(op, op_flags, bh);
submit_bh_crypt(inode, op, op_flags, bh);
continue;
}
}
unlock_buffer(bh);
}
}
EXPORT_SYMBOL(ll_rw_block_crypt);

void ll_rw_block(int op, int op_flags, int nr, struct buffer_head *bhs[])
{
ll_rw_block_crypt(NULL, op, op_flags, nr, bhs);
}
EXPORT_SYMBOL(ll_rw_block);

void write_dirty_buffer(struct buffer_head *bh, int op_flags)
Expand Down Expand Up @@ -3451,13 +3476,7 @@ int bh_uptodate_or_lock(struct buffer_head *bh)
}
EXPORT_SYMBOL(bh_uptodate_or_lock);

/**
* bh_submit_read - Submit a locked buffer for reading
* @bh: struct buffer_head
*
* Returns zero on success and -EIO on error.
*/
int bh_submit_read(struct buffer_head *bh)
int bh_submit_read_crypt(struct inode *inode, struct buffer_head *bh)
{
BUG_ON(!buffer_locked(bh));

Expand All @@ -3468,12 +3487,24 @@ int bh_submit_read(struct buffer_head *bh)

get_bh(bh);
bh->b_end_io = end_buffer_read_sync;
submit_bh(REQ_OP_READ, 0, bh);
submit_bh_crypt(inode, REQ_OP_READ, 0, bh);
wait_on_buffer(bh);
if (buffer_uptodate(bh))
return 0;
return -EIO;
}
EXPORT_SYMBOL(bh_submit_read_crypt);

/**
* bh_submit_read - Submit a locked buffer for reading
* @bh: struct buffer_head
*
* Returns zero on success and -EIO on error.
*/
int bh_submit_read(struct buffer_head *bh)
{
return bh_submit_read_crypt(NULL, bh);
}
EXPORT_SYMBOL(bh_submit_read);

void __init buffer_init(void)
Expand Down
Loading

0 comments on commit 8da5b64

Please sign in to comment.