mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-29 18:11:43 +00:00
Merge branch '2021-01-20-fs-fixes'
- Minor SquashFS, BTRFS ubifs fixes
This commit is contained in:
commit
83433fdab4
4 changed files with 43 additions and 30 deletions
|
@ -1030,7 +1030,6 @@ out:
|
||||||
int close_ctree_fs_info(struct btrfs_fs_info *fs_info)
|
int close_ctree_fs_info(struct btrfs_fs_info *fs_info)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
free_fs_roots_tree(&fs_info->fs_root_tree);
|
free_fs_roots_tree(&fs_info->fs_root_tree);
|
||||||
|
|
||||||
|
@ -1038,9 +1037,7 @@ int close_ctree_fs_info(struct btrfs_fs_info *fs_info)
|
||||||
ret = btrfs_close_devices(fs_info->fs_devices);
|
ret = btrfs_close_devices(fs_info->fs_devices);
|
||||||
btrfs_cleanup_all_caches(fs_info);
|
btrfs_cleanup_all_caches(fs_info);
|
||||||
btrfs_free_fs_info(fs_info);
|
btrfs_free_fs_info(fs_info);
|
||||||
if (!err)
|
return ret;
|
||||||
err = ret;
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid)
|
int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid)
|
||||||
|
|
|
@ -1030,7 +1030,7 @@ again:
|
||||||
*/
|
*/
|
||||||
stripe_nr = stripe_nr / map->stripe_len;
|
stripe_nr = stripe_nr / map->stripe_len;
|
||||||
|
|
||||||
stripe_offset = stripe_nr * map->stripe_len;
|
stripe_offset = stripe_nr * (u64)map->stripe_len;
|
||||||
BUG_ON(offset < stripe_offset);
|
BUG_ON(offset < stripe_offset);
|
||||||
|
|
||||||
/* stripe_offset is the offset of this block in its stripe*/
|
/* stripe_offset is the offset of this block in its stripe*/
|
||||||
|
@ -1103,7 +1103,7 @@ again:
|
||||||
rot = stripe_nr % map->num_stripes;
|
rot = stripe_nr % map->num_stripes;
|
||||||
|
|
||||||
/* Fill in the logical address of each stripe */
|
/* Fill in the logical address of each stripe */
|
||||||
tmp = stripe_nr * nr_data_stripes(map);
|
tmp = (u64)stripe_nr * nr_data_stripes(map);
|
||||||
|
|
||||||
for (i = 0; i < nr_data_stripes(map); i++)
|
for (i = 0; i < nr_data_stripes(map); i++)
|
||||||
raid_map[(i+rot) % map->num_stripes] =
|
raid_map[(i+rot) % map->num_stripes] =
|
||||||
|
|
|
@ -1310,7 +1310,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
|
||||||
{
|
{
|
||||||
char *dir = NULL, *fragment_block, *datablock = NULL, *data_buffer = NULL;
|
char *dir = NULL, *fragment_block, *datablock = NULL, *data_buffer = NULL;
|
||||||
char *fragment = NULL, *file = NULL, *resolved, *data;
|
char *fragment = NULL, *file = NULL, *resolved, *data;
|
||||||
u64 start, n_blks, table_size, data_offset, table_offset;
|
u64 start, n_blks, table_size, data_offset, table_offset, sparse_size;
|
||||||
int ret, j, i_number, datablk_count = 0;
|
int ret, j, i_number, datablk_count = 0;
|
||||||
struct squashfs_super_block *sblk = ctxt.sblk;
|
struct squashfs_super_block *sblk = ctxt.sblk;
|
||||||
struct squashfs_fragment_block_entry frag_entry;
|
struct squashfs_fragment_block_entry frag_entry;
|
||||||
|
@ -1444,6 +1444,13 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
|
||||||
n_blks = DIV_ROUND_UP(table_size + table_offset,
|
n_blks = DIV_ROUND_UP(table_size + table_offset,
|
||||||
ctxt.cur_dev->blksz);
|
ctxt.cur_dev->blksz);
|
||||||
|
|
||||||
|
/* Don't load any data for sparse blocks */
|
||||||
|
if (finfo.blk_sizes[j] == 0) {
|
||||||
|
n_blks = 0;
|
||||||
|
table_offset = 0;
|
||||||
|
data_buffer = NULL;
|
||||||
|
data = NULL;
|
||||||
|
} else {
|
||||||
data_buffer = malloc_cache_aligned(n_blks * ctxt.cur_dev->blksz);
|
data_buffer = malloc_cache_aligned(n_blks * ctxt.cur_dev->blksz);
|
||||||
|
|
||||||
if (!data_buffer) {
|
if (!data_buffer) {
|
||||||
|
@ -1463,9 +1470,17 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
|
||||||
}
|
}
|
||||||
|
|
||||||
data = data_buffer + table_offset;
|
data = data_buffer + table_offset;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the data */
|
/* Load the data */
|
||||||
if (SQFS_COMPRESSED_BLOCK(finfo.blk_sizes[j])) {
|
if (finfo.blk_sizes[j] == 0) {
|
||||||
|
/* This is a sparse block */
|
||||||
|
sparse_size = get_unaligned_le32(&sblk->block_size);
|
||||||
|
if ((*actread + sparse_size) > len)
|
||||||
|
sparse_size = len - *actread;
|
||||||
|
memset(buf + *actread, 0, sparse_size);
|
||||||
|
*actread += sparse_size;
|
||||||
|
} else if (SQFS_COMPRESSED_BLOCK(finfo.blk_sizes[j])) {
|
||||||
dest_len = get_unaligned_le32(&sblk->block_size);
|
dest_len = get_unaligned_le32(&sblk->block_size);
|
||||||
ret = sqfs_decompress(&ctxt, datablock, &dest_len,
|
ret = sqfs_decompress(&ctxt, datablock, &dest_len,
|
||||||
data, table_size);
|
data, table_size);
|
||||||
|
@ -1484,6 +1499,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
|
||||||
}
|
}
|
||||||
|
|
||||||
data_offset += table_size;
|
data_offset += table_size;
|
||||||
|
if (data_buffer)
|
||||||
free(data_buffer);
|
free(data_buffer);
|
||||||
data_buffer = NULL;
|
data_buffer = NULL;
|
||||||
if (*actread >= len)
|
if (*actread >= len)
|
||||||
|
|
|
@ -114,7 +114,7 @@ int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs,
|
||||||
int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs,
|
int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
ubifs_assert(!c->ro_media && !c->ro_mount);
|
ubifs_assert(!c->ro_media && !c->ro_mount);
|
||||||
if (c->ro_error)
|
if (c->ro_error)
|
||||||
|
@ -136,7 +136,7 @@ int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs,
|
||||||
|
|
||||||
int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len)
|
int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len)
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
ubifs_assert(!c->ro_media && !c->ro_mount);
|
ubifs_assert(!c->ro_media && !c->ro_mount);
|
||||||
if (c->ro_error)
|
if (c->ro_error)
|
||||||
|
@ -158,7 +158,7 @@ int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len)
|
||||||
|
|
||||||
int ubifs_leb_unmap(struct ubifs_info *c, int lnum)
|
int ubifs_leb_unmap(struct ubifs_info *c, int lnum)
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
ubifs_assert(!c->ro_media && !c->ro_mount);
|
ubifs_assert(!c->ro_media && !c->ro_mount);
|
||||||
if (c->ro_error)
|
if (c->ro_error)
|
||||||
|
@ -179,7 +179,7 @@ int ubifs_leb_unmap(struct ubifs_info *c, int lnum)
|
||||||
|
|
||||||
int ubifs_leb_map(struct ubifs_info *c, int lnum)
|
int ubifs_leb_map(struct ubifs_info *c, int lnum)
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
ubifs_assert(!c->ro_media && !c->ro_mount);
|
ubifs_assert(!c->ro_media && !c->ro_mount);
|
||||||
if (c->ro_error)
|
if (c->ro_error)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue