mirror of
https://github.com/torvalds/linux
synced 2024-09-20 02:57:25 +00:00
zonefs fixes for 5.8-rc7
Two fixes, the first one to remove compilation warnings and the second to avoid potentially inefficient allocation of BIOs for direct writes into sequential zones. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSRPv8tYSvhwAzJdzjdoc3SxdoYdgUCXxqPOwAKCRDdoc3SxdoY dkUzAQCp8p1ijemK+t2pN35dz+J9TG2idX0iUkZA5dAUkwsZmQD+NT/U52WLTqCH eKc72BZTfdMhTK/Sk6fnUtFzVXvGhgM= =RERh -----END PGP SIGNATURE----- Merge tag 'zonefs-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs into master Pull zonefs fixes from Damien Le Moal: "Two fixes, the first one to remove compilation warnings and the second to avoid potentially inefficient allocation of BIOs for direct writes into sequential zones" * tag 'zonefs-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs: zonefs: count pages after truncating the iterator zonefs: Fix compilation warning
This commit is contained in:
commit
6a343656d3
|
@ -607,14 +607,14 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from)
|
||||||
int nr_pages;
|
int nr_pages;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
nr_pages = iov_iter_npages(from, BIO_MAX_PAGES);
|
|
||||||
if (!nr_pages)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
max = queue_max_zone_append_sectors(bdev_get_queue(bdev));
|
max = queue_max_zone_append_sectors(bdev_get_queue(bdev));
|
||||||
max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize);
|
max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize);
|
||||||
iov_iter_truncate(from, max);
|
iov_iter_truncate(from, max);
|
||||||
|
|
||||||
|
nr_pages = iov_iter_npages(from, BIO_MAX_PAGES);
|
||||||
|
if (!nr_pages)
|
||||||
|
return 0;
|
||||||
|
|
||||||
bio = bio_alloc_bioset(GFP_NOFS, nr_pages, &fs_bio_set);
|
bio = bio_alloc_bioset(GFP_NOFS, nr_pages, &fs_bio_set);
|
||||||
if (!bio)
|
if (!bio)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -1119,7 +1119,7 @@ static int zonefs_create_zgroup(struct zonefs_zone_data *zd,
|
||||||
char *file_name;
|
char *file_name;
|
||||||
struct dentry *dir;
|
struct dentry *dir;
|
||||||
unsigned int n = 0;
|
unsigned int n = 0;
|
||||||
int ret = -ENOMEM;
|
int ret;
|
||||||
|
|
||||||
/* If the group is empty, there is nothing to do */
|
/* If the group is empty, there is nothing to do */
|
||||||
if (!zd->nr_zones[type])
|
if (!zd->nr_zones[type])
|
||||||
|
@ -1135,8 +1135,10 @@ static int zonefs_create_zgroup(struct zonefs_zone_data *zd,
|
||||||
zgroup_name = "seq";
|
zgroup_name = "seq";
|
||||||
|
|
||||||
dir = zonefs_create_inode(sb->s_root, zgroup_name, NULL, type);
|
dir = zonefs_create_inode(sb->s_root, zgroup_name, NULL, type);
|
||||||
if (!dir)
|
if (!dir) {
|
||||||
|
ret = -ENOMEM;
|
||||||
goto free;
|
goto free;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The first zone contains the super block: skip it.
|
* The first zone contains the super block: skip it.
|
||||||
|
@ -1174,8 +1176,10 @@ static int zonefs_create_zgroup(struct zonefs_zone_data *zd,
|
||||||
* Use the file number within its group as file name.
|
* Use the file number within its group as file name.
|
||||||
*/
|
*/
|
||||||
snprintf(file_name, ZONEFS_NAME_MAX - 1, "%u", n);
|
snprintf(file_name, ZONEFS_NAME_MAX - 1, "%u", n);
|
||||||
if (!zonefs_create_inode(dir, file_name, zone, type))
|
if (!zonefs_create_inode(dir, file_name, zone, type)) {
|
||||||
|
ret = -ENOMEM;
|
||||||
goto free;
|
goto free;
|
||||||
|
}
|
||||||
|
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue