super.c (df7686101956929dcea410971656e34926773b88) super.c (95175dafc4399ab5b9e937da205b2a6927b19227)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/super.c
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#include <linux/module.h>

--- 1010 unchanged lines hidden (view full) ---

1019
1020static void destroy_device_list(struct f2fs_sb_info *sbi)
1021{
1022 int i;
1023
1024 for (i = 0; i < sbi->s_ndevs; i++) {
1025 blkdev_put(FDEV(i).bdev, FMODE_EXCL);
1026#ifdef CONFIG_BLK_DEV_ZONED
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/super.c
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#include <linux/module.h>

--- 1010 unchanged lines hidden (view full) ---

1019
1020static void destroy_device_list(struct f2fs_sb_info *sbi)
1021{
1022 int i;
1023
1024 for (i = 0; i < sbi->s_ndevs; i++) {
1025 blkdev_put(FDEV(i).bdev, FMODE_EXCL);
1026#ifdef CONFIG_BLK_DEV_ZONED
1027 kvfree(FDEV(i).blkz_type);
1027 kvfree(FDEV(i).blkz_seq);
1028#endif
1029 }
1030 kvfree(sbi->devs);
1031}
1032
1033static void f2fs_put_super(struct super_block *sb)
1034{
1035 struct f2fs_sb_info *sbi = F2FS_SB(sb);

--- 1757 unchanged lines hidden (view full) ---

2793 __ilog2_u32(sbi->blocks_per_blkz))
2794 return -EINVAL;
2795 sbi->log_blocks_per_blkz = __ilog2_u32(sbi->blocks_per_blkz);
2796 FDEV(devi).nr_blkz = SECTOR_TO_BLOCK(nr_sectors) >>
2797 sbi->log_blocks_per_blkz;
2798 if (nr_sectors & (bdev_zone_sectors(bdev) - 1))
2799 FDEV(devi).nr_blkz++;
2800
1028#endif
1029 }
1030 kvfree(sbi->devs);
1031}
1032
1033static void f2fs_put_super(struct super_block *sb)
1034{
1035 struct f2fs_sb_info *sbi = F2FS_SB(sb);

--- 1757 unchanged lines hidden (view full) ---

2793 __ilog2_u32(sbi->blocks_per_blkz))
2794 return -EINVAL;
2795 sbi->log_blocks_per_blkz = __ilog2_u32(sbi->blocks_per_blkz);
2796 FDEV(devi).nr_blkz = SECTOR_TO_BLOCK(nr_sectors) >>
2797 sbi->log_blocks_per_blkz;
2798 if (nr_sectors & (bdev_zone_sectors(bdev) - 1))
2799 FDEV(devi).nr_blkz++;
2800
2801 FDEV(devi).blkz_type = f2fs_kmalloc(sbi, FDEV(devi).nr_blkz,
2802 GFP_KERNEL);
2803 if (!FDEV(devi).blkz_type)
2801 FDEV(devi).blkz_seq = f2fs_kzalloc(sbi,
2802 BITS_TO_LONGS(FDEV(devi).nr_blkz)
2803 * sizeof(unsigned long),
2804 GFP_KERNEL);
2805 if (!FDEV(devi).blkz_seq)
2804 return -ENOMEM;
2805
2806#define F2FS_REPORT_NR_ZONES 4096
2807
2808 zones = f2fs_kzalloc(sbi,
2809 array_size(F2FS_REPORT_NR_ZONES,
2810 sizeof(struct blk_zone)),
2811 GFP_KERNEL);

--- 10 unchanged lines hidden (view full) ---

2822 if (err)
2823 break;
2824 if (!nr_zones) {
2825 err = -EIO;
2826 break;
2827 }
2828
2829 for (i = 0; i < nr_zones; i++) {
2806 return -ENOMEM;
2807
2808#define F2FS_REPORT_NR_ZONES 4096
2809
2810 zones = f2fs_kzalloc(sbi,
2811 array_size(F2FS_REPORT_NR_ZONES,
2812 sizeof(struct blk_zone)),
2813 GFP_KERNEL);

--- 10 unchanged lines hidden (view full) ---

2824 if (err)
2825 break;
2826 if (!nr_zones) {
2827 err = -EIO;
2828 break;
2829 }
2830
2831 for (i = 0; i < nr_zones; i++) {
2830 FDEV(devi).blkz_type[n] = zones[i].type;
2832 if (zones[i].type != BLK_ZONE_TYPE_CONVENTIONAL)
2833 set_bit(n, FDEV(devi).blkz_seq);
2831 sector += zones[i].len;
2832 n++;
2833 }
2834 }
2835
2836 kvfree(zones);
2837
2838 return err;

--- 807 unchanged lines hidden ---
2834 sector += zones[i].len;
2835 n++;
2836 }
2837 }
2838
2839 kvfree(zones);
2840
2841 return err;

--- 807 unchanged lines hidden ---