Skip to contentSkip to conversation

f2fs: zone: don't block IO if there is remained open zone

PATCH In review Chao Yu 2 participants 5 messages Oct 17, 2024 – Oct 22, 2024 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH v7 1/1 f2fs: zone: don't block IO if there is remained open zone

max open zone may be larger than log header number of f2fs, for such case, it doesn't need to wait last IO in previous zone, let's introduce available_open_zone semaphore, and reduce it once we submit first write IO in a zone, and increase it after completion of last IO in the zone.

---
v7:
- export f2fs_is_blkaddr_zone_boundary()
- adapt to f2fs_get_segment_temp() change
- avoid null pointer dereference in destroy_curseg()

 fs/f2fs/data.c    | 107 ++++++++++++++++++++++++++++++----------------
 fs/f2fs/f2fs.h    |  37 +++++++++++++---
 fs/f2fs/iostat.c  |   7 +++
 fs/f2fs/iostat.h  |   2 +
 fs/f2fs/segment.c |  42 +++++++++++++++++-
 fs/f2fs/segment.h |   3 +-
 fs/f2fs/super.c   |   2 +
 7 files changed, 157 insertions(+), 43 deletions(-)
fs/f2fs/data.c +71 -36
index 90fa8ab85194..949b6bb957c7 100644
@@ -372,11 +372,10 @@ static void f2fs_write_end_io(struct bio *bio)
 #ifdef CONFIG_BLK_DEV_ZONED
 static void f2fs_zone_write_end_io(struct bio *bio)
 {
-	struct f2fs_bio_info *io = (struct f2fs_bio_info *)bio->bi_private;
+	struct f2fs_sb_info *sbi = iostat_get_bio_private(bio);
 
-	bio->bi_private = io->bi_private;
-	complete(&io->zone_wait);
 	f2fs_write_end_io(bio);
+	up(&sbi->available_open_zones);
 }
 #endif
 
@@ -532,6 +531,24 @@ static void __submit_merged_bio(struct f2fs_bio_info *io)
 	if (!io->bio)
 		return;
 
+#ifdef CONFIG_BLK_DEV_ZONED
+	if (io->open_zone) {
+		/*
+		 * if there is no open zone, it will wait for last IO in
+		 * previous zone before submitting new IO.
+		 */
+		down(&fio->sbi->available_open_zones);
+		io->open_zone = false;
+		io->zone_opened = true;
+	}
+
+	if (io->close_zone) {
+		io->bio->bi_end_io = f2fs_zone_write_end_io;
+		io->zone_opened = false;
+		io->close_zone = false;
+	}
+#endif
+
 	if (is_read_io(fio->op)) {
 		trace_f2fs_prepare_read_bio(io->sbi->sb, fio->type, io->bio);
 		f2fs_submit_read_bio(io->sbi, io->bio, fio->type);
@@ -605,9 +622,9 @@ int f2fs_init_write_merge_io(struct f2fs_sb_info *sbi)
 			INIT_LIST_HEAD(&io->bio_list);
 			init_f2fs_rwsem(&io->bio_list_lock);
 #ifdef CONFIG_BLK_DEV_ZONED
-			init_completion(&io->zone_wait);
-			io->zone_pending_bio = NULL;
-			io->bi_private = NULL;
+			io->open_zone = false;
+			io->zone_opened = false;
+			io->close_zone = false;
 #endif
 		}
 	}
@@ -638,6 +655,31 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,
 	f2fs_up_write(&io->io_rwsem);
 }
 
+void f2fs_blkzoned_submit_merged_write(struct f2fs_sb_info *sbi, int type)
+{
+#ifdef CONFIG_BLK_DEV_ZONED
+	struct f2fs_bio_info *io;
+
+	if (!f2fs_sb_has_blkzoned(sbi))
+		return;
+
+	io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);
+
+	f2fs_down_write(&io->io_rwsem);
+	if (io->zone_opened) {
+		if (io->bio) {
+			io->close_zone = true;
+			__submit_merged_bio(io);
+		} else {
+			up(&sbi->available_open_zones);
+			io->zone_opened = false;
+		}
+	}
+	f2fs_up_write(&io->io_rwsem);
+#endif
+
+}
+
 static void __submit_merged_write_cond(struct f2fs_sb_info *sbi,
 				struct inode *inode, struct page *page,
 				nid_t ino, enum page_type type, bool force)
@@ -922,24 +964,21 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)
 }
 
 #ifdef CONFIG_BLK_DEV_ZONED
-static bool is_end_zone_blkaddr(struct f2fs_sb_info *sbi, block_t blkaddr)
+bool f2fs_is_blkaddr_zone_boundary(struct f2fs_sb_info *sbi,
+					block_t blkaddr, bool start)
 {
-	struct block_device *bdev = sbi->sb->s_bdev;
-	int devi = 0;
+	if (!f2fs_blkaddr_in_seqzone(sbi, blkaddr))
+		return false;
 
 	if (f2fs_is_multi_device(sbi)) {
-		devi = f2fs_target_device_index(sbi, blkaddr);
-		if (blkaddr < FDEV(devi).start_blk ||
-		    blkaddr > FDEV(devi).end_blk) {
-			f2fs_err(sbi, "Invalid block %x", blkaddr);
-			return false;
-		}
+		int devi = f2fs_target_device_index(sbi, blkaddr);
+
 		blkaddr -= FDEV(devi).start_blk;
-		bdev = FDEV(devi).bdev;
 	}
-	return bdev_is_zoned(bdev) &&
-		f2fs_blkz_is_seq(sbi, devi, blkaddr) &&
-		(blkaddr % sbi->blocks_per_blkz == sbi->blocks_per_blkz - 1);
+
+	if (start)
+		return (blkaddr % sbi->blocks_per_blkz) == 0;
+	return (blkaddr % sbi->blocks_per_blkz == sbi->blocks_per_blkz - 1);
 }
 #endif
 
@@ -950,20 +989,14 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
 	struct f2fs_bio_info *io = sbi->write_io[btype] + fio->temp;
 	struct page *bio_page;
 	enum count_type type;
+#ifdef CONFIG_BLK_DEV_ZONED
+	bool blkzoned = f2fs_sb_has_blkzoned(sbi) && btype < META;
+#endif
 
 	f2fs_bug_on(sbi, is_read_io(fio->op));
 
 	f2fs_down_write(&io->io_rwsem);
 next:
-#ifdef CONFIG_BLK_DEV_ZONED
-	if (f2fs_sb_has_blkzoned(sbi) && btype < META && io->zone_pending_bio) {
-		wait_for_completion_io(&io->zone_wait);
-		bio_put(io->zone_pending_bio);
-		io->zone_pending_bio = NULL;
-		io->bi_private = NULL;
-	}
-#endif
-
 	if (fio->in_list) {
 		spin_lock(&io->io_lock);
 		if (list_empty(&io->io_list)) {
@@ -991,6 +1024,12 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
 	type = WB_DATA_TYPE(bio_page, fio->compressed_page);
 	inc_page_count(sbi, type);
 
+#ifdef CONFIG_BLK_DEV_ZONED
+	if (blkzoned &&
+		f2fs_is_blkaddr_zone_boundary(sbi, fio->new_blkaddr, true))
+		io->open_zone = true;
+#endif
+
 	if (io->bio &&
 	    (!io_is_mergeable(sbi, io->bio, io, fio, io->last_block_in_bio,
 			      fio->new_blkaddr) ||
@@ -1016,15 +1055,11 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
 	io->last_block_in_bio = fio->new_blkaddr;
 
 	trace_f2fs_submit_page_write(fio->page, fio);
+
 #ifdef CONFIG_BLK_DEV_ZONED
-	if (f2fs_sb_has_blkzoned(sbi) && btype < META &&
-			is_end_zone_blkaddr(sbi, fio->new_blkaddr)) {
-		bio_get(io->bio);
-		reinit_completion(&io->zone_wait);
-		io->bi_private = io->bio->bi_private;
-		io->bio->bi_private = io;
-		io->bio->bi_end_io = f2fs_zone_write_end_io;
-		io->zone_pending_bio = io->bio;
+	if (blkzoned &&
+		f2fs_is_blkaddr_zone_boundary(sbi, fio->new_blkaddr, false)) {
+		io->close_zone = true;
 		__submit_merged_bio(io);
 	}
 #endif
fs/f2fs/f2fs.h +32 -5
index 56797f8e6659..0ff7f2812312 100644
@@ -1241,16 +1241,16 @@ struct f2fs_bio_info {
 	struct bio *bio;		/* bios to merge */
 	sector_t last_block_in_bio;	/* last block number */
 	struct f2fs_io_info fio;	/* store buffered io info. */
-#ifdef CONFIG_BLK_DEV_ZONED
-	struct completion zone_wait;	/* condition value for the previous open zone to close */
-	struct bio *zone_pending_bio;	/* pending bio for the previous zone */
-	void *bi_private;		/* previous bi_private for pending bio */
-#endif
 	struct f2fs_rwsem io_rwsem;	/* blocking op for bio */
 	spinlock_t io_lock;		/* serialize DATA/NODE IOs */
 	struct list_head io_list;	/* track fios */
 	struct list_head bio_list;	/* bio entry list head */
 	struct f2fs_rwsem bio_list_lock;	/* lock to protect bio entry list */
+#ifdef CONFIG_BLK_DEV_ZONED
+	bool open_zone;			/* open a zone */
+	bool zone_opened;		/* zone has been opened */
+	bool close_zone;		/* close a zone */
+#endif
 };
 
 #define FDEV(i)				(sbi->devs[i])
@@ -1572,6 +1572,7 @@ struct f2fs_sb_info {
 	unsigned int max_open_zones;		/* max open zone resources of the zoned device */
 	/* For adjust the priority writing position of data in zone UFS */
 	unsigned int blkzone_alloc_policy;
+	struct semaphore available_open_zones;	/* available open zones */
 #endif
 
 	/* for node-related operations */
@@ -3861,6 +3862,7 @@ void f2fs_destroy_bio_entry_cache(void);
 void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, struct bio *bio,
 			  enum page_type type);
 int f2fs_init_write_merge_io(struct f2fs_sb_info *sbi);
+void f2fs_blkzoned_submit_merged_write(struct f2fs_sb_info *sbi, int type);
 void f2fs_submit_merged_write(struct f2fs_sb_info *sbi, enum page_type type);
 void f2fs_submit_merged_write_cond(struct f2fs_sb_info *sbi,
 				struct inode *inode, struct page *page,
@@ -3870,6 +3872,10 @@ void f2fs_submit_merged_ipu_write(struct f2fs_sb_info *sbi,
 void f2fs_flush_merged_writes(struct f2fs_sb_info *sbi);
 int f2fs_submit_page_bio(struct f2fs_io_info *fio);
 int f2fs_merge_page_bio(struct f2fs_io_info *fio);
+#ifdef CONFIG_BLK_DEV_ZONED
+bool f2fs_is_blkaddr_zone_boundary(struct f2fs_sb_info *sbi,
+					block_t blkaddr, bool start);
+#endif
 void f2fs_submit_page_write(struct f2fs_io_info *fio);
 struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi,
 		block_t blk_addr, sector_t *sector);
@@ -4541,6 +4547,27 @@ static inline bool f2fs_blkz_is_seq(struct f2fs_sb_info *sbi, int devi,
 
 	return test_bit(zno, FDEV(devi).blkz_seq);
 }
+
+static inline bool f2fs_blkaddr_in_seqzone(struct f2fs_sb_info *sbi,
+							block_t blkaddr)
+{
+	struct block_device *bdev = sbi->sb->s_bdev;
+	int devi = 0;
+
+	if (f2fs_is_multi_device(sbi)) {
+		devi = f2fs_target_device_index(sbi, blkaddr);
+		if (blkaddr < FDEV(devi).start_blk ||
+		    blkaddr > FDEV(devi).end_blk) {
+			f2fs_err(sbi, "Invalid block %x", blkaddr);
+			return false;
+		}
+		blkaddr -= FDEV(devi).start_blk;
+		bdev = FDEV(devi).bdev;
+	}
+
+	return bdev_is_zoned(bdev) &&
+		f2fs_blkz_is_seq(sbi, devi, blkaddr);
+}
 #endif
 
 static inline int f2fs_bdev_index(struct f2fs_sb_info *sbi,
fs/f2fs/iostat.c +7 -0
index f8703038e1d8..a8626e297876 100644
@@ -237,6 +237,13 @@ static inline void __update_iostat_latency(struct bio_iostat_ctx *iostat_ctx,
 	spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags);
 }
 
+void *iostat_get_bio_private(struct bio *bio)
+{
+	struct bio_iostat_ctx *iostat_ctx = bio->bi_private;
+
+	return iostat_ctx->sbi;
+}
+
 void iostat_update_and_unbind_ctx(struct bio *bio)
 {
 	struct bio_iostat_ctx *iostat_ctx = bio->bi_private;
fs/f2fs/iostat.h +2 -0
index eb99d05cf272..9006c3d41590 100644
@@ -58,6 +58,7 @@ static inline struct bio_post_read_ctx *get_post_read_ctx(struct bio *bio)
 	return iostat_ctx->post_read_ctx;
 }
 
+extern void *iostat_get_bio_private(struct bio *bio);
 extern void iostat_update_and_unbind_ctx(struct bio *bio);
 extern void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi,
 		struct bio *bio, struct bio_post_read_ctx *ctx);
@@ -68,6 +69,7 @@ extern void f2fs_destroy_iostat(struct f2fs_sb_info *sbi);
 #else
 static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode,
 		enum iostat_type type, unsigned long long io_bytes) {}
+static inline void *iostat_get_bio_private(struct bio *bio) { return bio->bi_private; }
 static inline void iostat_update_and_unbind_ctx(struct bio *bio) {}
 static inline void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi,
 		struct bio *bio, struct bio_post_read_ctx *ctx) {}
fs/f2fs/segment.c +41 -1

64 lines not on this page · raw message

fs/f2fs/segment.h +2 -1
index 6a23bb1d16a2..cd6325f3b9ca 100644
@@ -26,7 +26,8 @@
 
 #define IS_DATASEG(t)	((t) <= CURSEG_COLD_DATA)
 #define IS_NODESEG(t)	((t) >= CURSEG_HOT_NODE && (t) <= CURSEG_COLD_NODE)
-#define SE_PAGETYPE(se)	((IS_NODESEG((se)->type) ? NODE : DATA))
+#define PAGE_TYPE(t)	(IS_NODESEG(t) ? NODE : DATA)
+#define SE_PAGETYPE(se)	(PAGE_TYPE((se)->type))
 
 static inline void sanity_check_seg_type(struct f2fs_sb_info *sbi,
 						unsigned short seg_type)
fs/f2fs/super.c +2 -0
index aa14c8fce7d9..0d96e352b4ac 100644
@@ -3923,6 +3923,8 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)
 				sbi->max_open_zones, F2FS_OPTION(sbi).active_logs);
 			return -EINVAL;
 		}
+
+		sema_init(&sbi->available_open_zones, sbi->max_open_zones);
 	}
 
 	zone_sectors = bdev_zone_sectors(bdev);
Signature · 1 line
2.40.1
#1 lore raw
kernel test robot noticed the following build warnings:

Hi Chao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jaegeuk-f2fs/dev-test]
[also build test WARNING on jaegeuk-f2fs/dev linus/master v6.12-rc3 next-20241018] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chao-Yu/f2fs-zone-don-t-block-IO-if-there-is-remained-open-zone/20241017-162658
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link:    https://lore.kernel.org/r/20241017081421.2213743-1-chao%40kernel.org
patch subject: [PATCH v7] f2fs: zone: don't block IO if there is remained open zone
config: x86_64-buildonly-randconfig-004-20241018 (https://download.01.org/0day-ci/archive/20241018/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241018/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

fs/f2fs/data.c: In function 'f2fs_blkzoned_submit_merged_write':

>> fs/f2fs/data.c:666:69: warning: passing argument 1 of 'f2fs_get_segment_temp' makes integer from pointer without a cast [-Wint-conversion]
     666 |         io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);
         |                                                                     ^~~
         |                                                                     |
         |                                                                     struct f2fs_sb_info *
   In file included from fs/f2fs/data.c:24:
   fs/f2fs/f2fs.h:3762:31: note: expected 'int' but argument is of type 'struct f2fs_sb_info *'
    3762 | int f2fs_get_segment_temp(int seg_type);
         |                           ~~~~^~~~~~~~
   fs/f2fs/data.c:666:47: error: too many arguments to function 'f2fs_get_segment_temp'
     666 |         io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);
         |                                               ^~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/f2fs.h:3762:5: note: declared here
    3762 | int f2fs_get_segment_temp(int seg_type);
         |     ^~~~~~~~~~~~~~~~~~~~~
--
   fs/f2fs/segment.c: In function 'restore_curseg_summaries':
>> fs/f2fs/segment.c:4324:54: warning: passing argument 1 of 'f2fs_get_segment_temp' makes integer from pointer without a cast [-Wint-conversion]
    4324 |                         temp = f2fs_get_segment_temp(sbi, type);
         |                                                      ^~~
         |                                                      |
         |                                                      struct f2fs_sb_info *
   fs/f2fs/segment.c:3610:31: note: expected 'int' but argument is of type 'struct f2fs_sb_info *'
    3610 | int f2fs_get_segment_temp(int seg_type)
         |                           ~~~~^~~~~~~~
   fs/f2fs/segment.c:4324:32: error: too many arguments to function 'f2fs_get_segment_temp'
    4324 |                         temp = f2fs_get_segment_temp(sbi, type);
         |                                ^~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/segment.c:3610:5: note: declared here
    3610 | int f2fs_get_segment_temp(int seg_type)
         |     ^~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/segment.c: In function 'destroy_curseg':
   fs/f2fs/segment.c:5666:69: warning: passing argument 1 of 'f2fs_get_segment_temp' makes integer from pointer without a cast [-Wint-conversion]
    5666 |                         enum temp_type temp = f2fs_get_segment_temp(sbi, i);
         |                                                                     ^~~
         |                                                                     |
         |                                                                     struct f2fs_sb_info *
   fs/f2fs/segment.c:3610:31: note: expected 'int' but argument is of type 'struct f2fs_sb_info *'
    3610 | int f2fs_get_segment_temp(int seg_type)
         |                           ~~~~^~~~~~~~
   fs/f2fs/segment.c:5666:47: error: too many arguments to function 'f2fs_get_segment_temp'
    5666 |                         enum temp_type temp = f2fs_get_segment_temp(sbi, i);
         |                                               ^~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/segment.c:3610:5: note: declared here
    3610 | int f2fs_get_segment_temp(int seg_type)
         |     ^~~~~~~~~~~~~~~~~~~~~

vim +/f2fs_get_segment_temp +666 fs/f2fs/data.c

657
658 void f2fs_blkzoned_submit_merged_write(struct f2fs_sb_info *sbi, int type)
659 {
660 #ifdef CONFIG_BLK_DEV_ZONED
661 struct f2fs_bio_info *io;
662
663 if (!f2fs_sb_has_blkzoned(sbi))
664 return;
665

 > 666		io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);

667
668 f2fs_down_write(&io->io_rwsem);
669 if (io->zone_opened) {
670 if (io->bio) {
671 io->close_zone = true;
672 __submit_merged_bio(io);
673 } else {
674 up(&sbi->available_open_zones);
675 io->zone_opened = false;
676 }
677 }
678 f2fs_up_write(&io->io_rwsem);
679 #endif
680

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author maintainer
#2 lore raw

Hi,

Thanks for the report, I rebased this patch on top of
https://lore.kernel.org/linux-f2fs-devel/[email protected],
so there will be dependency in between these two patch.

Thanks,

Quoted 101 lines · kernel test robot

Hi Chao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jaegeuk-f2fs/dev-test]
[also build test WARNING on jaegeuk-f2fs/dev linus/master v6.12-rc3 next-20241018] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chao-Yu/f2fs-zone-don-t-block-IO-if-there-is-remained-open-zone/20241017-162658
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link:    https://lore.kernel.org/r/20241017081421.2213743-1-chao%40kernel.org
patch subject: [PATCH v7] f2fs: zone: don't block IO if there is remained open zone
config: x86_64-buildonly-randconfig-004-20241018 (https://download.01.org/0day-ci/archive/20241018/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241018/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

fs/f2fs/data.c: In function 'f2fs_blkzoned_submit_merged_write':

Quoted 1 line
Quoted 1 line

fs/f2fs/data.c:666:69: warning: passing argument 1 of 'f2fs_get_segment_temp' makes integer from pointer without a cast [-Wint-conversion]

      666 |         io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);
          |                                                                     ^~~
          |                                                                     |
          |                                                                     struct f2fs_sb_info *
    In file included from fs/f2fs/data.c:24:
    fs/f2fs/f2fs.h:3762:31: note: expected 'int' but argument is of type 'struct f2fs_sb_info *'
     3762 | int f2fs_get_segment_temp(int seg_type);
          |                           ~~~~^~~~~~~~
    fs/f2fs/data.c:666:47: error: too many arguments to function 'f2fs_get_segment_temp'
      666 |         io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);
          |                                               ^~~~~~~~~~~~~~~~~~~~~
    fs/f2fs/f2fs.h:3762:5: note: declared here
     3762 | int f2fs_get_segment_temp(int seg_type);
          |     ^~~~~~~~~~~~~~~~~~~~~

--
fs/f2fs/segment.c: In function 'restore_curseg_summaries':

Quoted 1 line
Quoted 1 line

fs/f2fs/segment.c:4324:54: warning: passing argument 1 of 'f2fs_get_segment_temp' makes integer from pointer without a cast [-Wint-conversion]

     4324 |                         temp = f2fs_get_segment_temp(sbi, type);
          |                                                      ^~~
          |                                                      |
          |                                                      struct f2fs_sb_info *
    fs/f2fs/segment.c:3610:31: note: expected 'int' but argument is of type 'struct f2fs_sb_info *'
     3610 | int f2fs_get_segment_temp(int seg_type)
          |                           ~~~~^~~~~~~~
    fs/f2fs/segment.c:4324:32: error: too many arguments to function 'f2fs_get_segment_temp'
     4324 |                         temp = f2fs_get_segment_temp(sbi, type);
          |                                ^~~~~~~~~~~~~~~~~~~~~
    fs/f2fs/segment.c:3610:5: note: declared here
     3610 | int f2fs_get_segment_temp(int seg_type)
          |     ^~~~~~~~~~~~~~~~~~~~~
    fs/f2fs/segment.c: In function 'destroy_curseg':
    fs/f2fs/segment.c:5666:69: warning: passing argument 1 of 'f2fs_get_segment_temp' makes integer from pointer without a cast [-Wint-conversion]
     5666 |                         enum temp_type temp = f2fs_get_segment_temp(sbi, i);
          |                                                                     ^~~
          |                                                                     |
          |                                                                     struct f2fs_sb_info *
    fs/f2fs/segment.c:3610:31: note: expected 'int' but argument is of type 'struct f2fs_sb_info *'
     3610 | int f2fs_get_segment_temp(int seg_type)
          |                           ~~~~^~~~~~~~
    fs/f2fs/segment.c:5666:47: error: too many arguments to function 'f2fs_get_segment_temp'
     5666 |                         enum temp_type temp = f2fs_get_segment_temp(sbi, i);
          |                                               ^~~~~~~~~~~~~~~~~~~~~
    fs/f2fs/segment.c:3610:5: note: declared here
     3610 | int f2fs_get_segment_temp(int seg_type)
          |     ^~~~~~~~~~~~~~~~~~~~~

vim +/f2fs_get_segment_temp +666 fs/f2fs/data.c

    657	
    658	void f2fs_blkzoned_submit_merged_write(struct f2fs_sb_info *sbi, int type)
    659	{
    660	#ifdef CONFIG_BLK_DEV_ZONED
    661		struct f2fs_bio_info *io;
    662	
    663		if (!f2fs_sb_has_blkzoned(sbi))
    664			return;
    665	
Quoted 1 line

666 io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);

    667	
    668		f2fs_down_write(&io->io_rwsem);
    669		if (io->zone_opened) {
    670			if (io->bio) {
    671				io->close_zone = true;
    672				__submit_merged_bio(io);
    673			} else {
    674				up(&sbi->available_open_zones);
    675				io->zone_opened = false;
    676			}
    677		}
    678		f2fs_up_write(&io->io_rwsem);
    679	#endif
    680	
#3 lore raw
In reply to Chao Yu
kernel test robot noticed the following build errors:

Hi Chao,

kernel test robot noticed the following build errors:

[auto build test ERROR on jaegeuk-f2fs/dev-test]
[also build test ERROR on jaegeuk-f2fs/dev linus/master v6.12-rc3 next-20241018] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chao-Yu/f2fs-zone-don-t-block-IO-if-there-is-remained-open-zone/20241017-162658
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link:    https://lore.kernel.org/r/20241017081421.2213743-1-chao%40kernel.org
patch subject: [PATCH v7] f2fs: zone: don't block IO if there is remained open zone
config: i386-buildonly-randconfig-002-20241018 (https://download.01.org/0day-ci/archive/20241018/[email protected]/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241018/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> fs/f2fs/data.c:666:67: error: too many arguments to function call, expected single argument 'seg_type', have 2 arguments
     666 |         io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);
         |                                               ~~~~~~~~~~~~~~~~~~~~~      ^~~~
   fs/f2fs/f2fs.h:3762:5: note: 'f2fs_get_segment_temp' declared here
    3762 | int f2fs_get_segment_temp(int seg_type);
         |     ^                     ~~~~~~~~~~~~
   fs/f2fs/data.c:2426:10: warning: variable 'index' set but not used [-Wunused-but-set-variable]
    2426 |         pgoff_t index;
         |                 ^
   1 warning and 1 error generated.
--
>> fs/f2fs/segment.c:4324:38: error: too many arguments to function call, expected single argument 'seg_type', have 2 arguments
    4324 |                         temp = f2fs_get_segment_temp(sbi, type);
         |                                ~~~~~~~~~~~~~~~~~~~~~      ^~~~
   fs/f2fs/segment.c:3610:5: note: 'f2fs_get_segment_temp' declared here
    3610 | int f2fs_get_segment_temp(int seg_type)
         |     ^                     ~~~~~~~~~~~~
   fs/f2fs/segment.c:5666:53: error: too many arguments to function call, expected single argument 'seg_type', have 2 arguments
    5666 |                         enum temp_type temp = f2fs_get_segment_temp(sbi, i);
         |                                               ~~~~~~~~~~~~~~~~~~~~~      ^
   fs/f2fs/segment.c:3610:5: note: 'f2fs_get_segment_temp' declared here
    3610 | int f2fs_get_segment_temp(int seg_type)
         |     ^                     ~~~~~~~~~~~~

2 errors generated.

vim +/seg_type +666 fs/f2fs/data.c

657
658 void f2fs_blkzoned_submit_merged_write(struct f2fs_sb_info *sbi, int type)
659 {
660 #ifdef CONFIG_BLK_DEV_ZONED
661 struct f2fs_bio_info *io;
662
663 if (!f2fs_sb_has_blkzoned(sbi))
664 return;
665

 > 666		io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);

667
668 f2fs_down_write(&io->io_rwsem);
669 if (io->zone_opened) {
670 if (io->bio) {
671 io->close_zone = true;
672 __submit_merged_bio(io);
673 } else {
674 up(&sbi->available_open_zones);
675 io->zone_opened = false;
676 }
677 }
678 f2fs_up_write(&io->io_rwsem);
679 #endif
680

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#4 lore raw
In reply to Chao Yu
kernel test robot noticed the following build errors:

Hi Chao,

kernel test robot noticed the following build errors:

[auto build test ERROR on jaegeuk-f2fs/dev-test]
[also build test ERROR on jaegeuk-f2fs/dev linus/master v6.12-rc3 next-20241018] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chao-Yu/f2fs-zone-don-t-block-IO-if-there-is-remained-open-zone/20241017-162658
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link:    https://lore.kernel.org/r/20241017081421.2213743-1-chao%40kernel.org
patch subject: [PATCH v7] f2fs: zone: don't block IO if there is remained open zone
config: openrisc-randconfig-r072-20241018 (https://download.01.org/0day-ci/archive/20241018/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241018/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

fs/f2fs/data.c: In function 'f2fs_blkzoned_submit_merged_write':

>> fs/f2fs/data.c:666:69: error: passing argument 1 of 'f2fs_get_segment_temp' makes integer from pointer without a cast [-Wint-conversion]
     666 |         io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);
         |                                                                     ^~~
         |                                                                     |
         |                                                                     struct f2fs_sb_info *
   In file included from fs/f2fs/data.c:24:
   fs/f2fs/f2fs.h:3762:31: note: expected 'int' but argument is of type 'struct f2fs_sb_info *'
    3762 | int f2fs_get_segment_temp(int seg_type);
         |                           ~~~~^~~~~~~~
>> fs/f2fs/data.c:666:47: error: too many arguments to function 'f2fs_get_segment_temp'
     666 |         io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);
         |                                               ^~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/f2fs.h:3762:5: note: declared here
    3762 | int f2fs_get_segment_temp(int seg_type);
         |     ^~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/data.c: In function 'f2fs_mpage_readpages':
   fs/f2fs/data.c:2426:17: warning: variable 'index' set but not used [-Wunused-but-set-variable]
    2426 |         pgoff_t index;
         |                 ^~~~~
--
   fs/f2fs/segment.c: In function 'restore_curseg_summaries':
>> fs/f2fs/segment.c:4324:54: error: passing argument 1 of 'f2fs_get_segment_temp' makes integer from pointer without a cast [-Wint-conversion]
    4324 |                         temp = f2fs_get_segment_temp(sbi, type);
         |                                                      ^~~
         |                                                      |
         |                                                      struct f2fs_sb_info *
   fs/f2fs/segment.c:3610:31: note: expected 'int' but argument is of type 'struct f2fs_sb_info *'
    3610 | int f2fs_get_segment_temp(int seg_type)
         |                           ~~~~^~~~~~~~
>> fs/f2fs/segment.c:4324:32: error: too many arguments to function 'f2fs_get_segment_temp'
    4324 |                         temp = f2fs_get_segment_temp(sbi, type);
         |                                ^~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/segment.c:3610:5: note: declared here
    3610 | int f2fs_get_segment_temp(int seg_type)
         |     ^~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/segment.c: In function 'destroy_curseg':
   fs/f2fs/segment.c:5666:69: error: passing argument 1 of 'f2fs_get_segment_temp' makes integer from pointer without a cast [-Wint-conversion]
    5666 |                         enum temp_type temp = f2fs_get_segment_temp(sbi, i);
         |                                                                     ^~~
         |                                                                     |
         |                                                                     struct f2fs_sb_info *
   fs/f2fs/segment.c:3610:31: note: expected 'int' but argument is of type 'struct f2fs_sb_info *'
    3610 | int f2fs_get_segment_temp(int seg_type)
         |                           ~~~~^~~~~~~~
   fs/f2fs/segment.c:5666:47: error: too many arguments to function 'f2fs_get_segment_temp'
    5666 |                         enum temp_type temp = f2fs_get_segment_temp(sbi, i);
         |                                               ^~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/segment.c:3610:5: note: declared here
    3610 | int f2fs_get_segment_temp(int seg_type)
         |     ^~~~~~~~~~~~~~~~~~~~~

vim +/f2fs_get_segment_temp +666 fs/f2fs/data.c

657
658 void f2fs_blkzoned_submit_merged_write(struct f2fs_sb_info *sbi, int type)
659 {
660 #ifdef CONFIG_BLK_DEV_ZONED
661 struct f2fs_bio_info *io;
662
663 if (!f2fs_sb_has_blkzoned(sbi))
664 return;
665

 > 666		io = sbi->write_io[PAGE_TYPE(type)] + f2fs_get_segment_temp(sbi, type);

667
668 f2fs_down_write(&io->io_rwsem);
669 if (io->zone_opened) {
670 if (io->bio) {
671 io->close_zone = true;
672 __submit_merged_bio(io);
673 } else {
674 up(&sbi->available_open_zones);
675 io->zone_opened = false;
676 }
677 }
678 f2fs_up_write(&io->io_rwsem);
679 #endif
680

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki