Skip to content

Commit 6a34365

Browse files
committed
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
2 parents 1f68f31 + 89ee723 commit 6a34365

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

fs/zonefs/super.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -607,14 +607,14 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from)
607607
int nr_pages;
608608
ssize_t ret;
609609

610-
nr_pages = iov_iter_npages(from, BIO_MAX_PAGES);
611-
if (!nr_pages)
612-
return 0;
613-
614610
max = queue_max_zone_append_sectors(bdev_get_queue(bdev));
615611
max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize);
616612
iov_iter_truncate(from, max);
617613

614+
nr_pages = iov_iter_npages(from, BIO_MAX_PAGES);
615+
if (!nr_pages)
616+
return 0;
617+
618618
bio = bio_alloc_bioset(GFP_NOFS, nr_pages, &fs_bio_set);
619619
if (!bio)
620620
return -ENOMEM;
@@ -1119,7 +1119,7 @@ static int zonefs_create_zgroup(struct zonefs_zone_data *zd,
11191119
char *file_name;
11201120
struct dentry *dir;
11211121
unsigned int n = 0;
1122-
int ret = -ENOMEM;
1122+
int ret;
11231123

11241124
/* If the group is empty, there is nothing to do */
11251125
if (!zd->nr_zones[type])
@@ -1135,8 +1135,10 @@ static int zonefs_create_zgroup(struct zonefs_zone_data *zd,
11351135
zgroup_name = "seq";
11361136

11371137
dir = zonefs_create_inode(sb->s_root, zgroup_name, NULL, type);
1138-
if (!dir)
1138+
if (!dir) {
1139+
ret = -ENOMEM;
11391140
goto free;
1141+
}
11401142

11411143
/*
11421144
* The first zone contains the super block: skip it.
@@ -1174,8 +1176,10 @@ static int zonefs_create_zgroup(struct zonefs_zone_data *zd,
11741176
* Use the file number within its group as file name.
11751177
*/
11761178
snprintf(file_name, ZONEFS_NAME_MAX - 1, "%u", n);
1177-
if (!zonefs_create_inode(dir, file_name, zone, type))
1179+
if (!zonefs_create_inode(dir, file_name, zone, type)) {
1180+
ret = -ENOMEM;
11781181
goto free;
1182+
}
11791183

11801184
n++;
11811185
}

0 commit comments

Comments
 (0)