Commit 6a343656 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'zonefs-5.8-rc7' of...

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
parents 1f68f31b 89ee7237
...@@ -607,14 +607,14 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment