[PATCH 1/1] staging: exfat: Update MAINTAINERS file
Add a L: tag so get_maintainers.pl output includes the linux-fsdevel list Signed-off-by: Valdis Kletnieks --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3d09efe69508..188435ae 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6186,6 +6186,7 @@ F:include/uapi/linux/mii.h EXFAT FILE SYSTEM M: Valdis Kletnieks +L: linux-fsde...@vger.kernel.org S: Maintained F: drivers/staging/exfat/ -- 2.23.0
[PATCH 1/8] staging: exfat: Clean up namespace pollution, part 1
Make as much as possible static. We're over-exuberant here for the benefit of a following patch, as the compiler will flag now-unused static code Signed-off-by: Valdis Kletnieks --- drivers/staging/exfat/exfat.h | 156 ++--- drivers/staging/exfat/exfat_core.c | 142 +- 2 files changed, 149 insertions(+), 149 deletions(-) diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h index 3abab33e932c..0c779c8dd858 100644 --- a/drivers/staging/exfat/exfat.h +++ b/drivers/staging/exfat/exfat.h @@ -768,107 +768,107 @@ void buf_init(struct super_block *sb); void buf_shutdown(struct super_block *sb); int FAT_read(struct super_block *sb, u32 loc, u32 *content); s32 FAT_write(struct super_block *sb, u32 loc, u32 content); -u8 *FAT_getblk(struct super_block *sb, sector_t sec); -void FAT_modify(struct super_block *sb, sector_t sec); +static u8 *FAT_getblk(struct super_block *sb, sector_t sec); +static void FAT_modify(struct super_block *sb, sector_t sec); void FAT_release_all(struct super_block *sb); -void FAT_sync(struct super_block *sb); +static void FAT_sync(struct super_block *sb); u8 *buf_getblk(struct super_block *sb, sector_t sec); void buf_modify(struct super_block *sb, sector_t sec); void buf_lock(struct super_block *sb, sector_t sec); void buf_unlock(struct super_block *sb, sector_t sec); void buf_release(struct super_block *sb, sector_t sec); void buf_release_all(struct super_block *sb); -void buf_sync(struct super_block *sb); +static void buf_sync(struct super_block *sb); /* fs management functions */ void fs_set_vol_flags(struct super_block *sb, u32 new_flag); -void fs_error(struct super_block *sb); +static void fs_error(struct super_block *sb); /* cluster management functions */ -s32 clear_cluster(struct super_block *sb, u32 clu); -s32 fat_alloc_cluster(struct super_block *sb, s32 num_alloc, +static s32 clear_cluster(struct super_block *sb, u32 clu); +static s32 fat_alloc_cluster(struct super_block *sb, s32 num_alloc, struct chain_t *p_chain); -s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc, +static s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc, struct chain_t *p_chain); -void fat_free_cluster(struct super_block *sb, struct chain_t *p_chain, +static void fat_free_cluster(struct super_block *sb, struct chain_t *p_chain, s32 do_relse); -void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain, +static void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain, s32 do_relse); -u32 find_last_cluster(struct super_block *sb, struct chain_t *p_chain); +static u32 find_last_cluster(struct super_block *sb, struct chain_t *p_chain); s32 count_num_clusters(struct super_block *sb, struct chain_t *dir); -s32 fat_count_used_clusters(struct super_block *sb); -s32 exfat_count_used_clusters(struct super_block *sb); +static s32 fat_count_used_clusters(struct super_block *sb); +static s32 exfat_count_used_clusters(struct super_block *sb); void exfat_chain_cont_cluster(struct super_block *sb, u32 chain, s32 len); /* allocation bitmap management functions */ s32 load_alloc_bitmap(struct super_block *sb); void free_alloc_bitmap(struct super_block *sb); -s32 set_alloc_bitmap(struct super_block *sb, u32 clu); -s32 clr_alloc_bitmap(struct super_block *sb, u32 clu); -u32 test_alloc_bitmap(struct super_block *sb, u32 clu); -void sync_alloc_bitmap(struct super_block *sb); +static s32 set_alloc_bitmap(struct super_block *sb, u32 clu); +static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu); +static u32 test_alloc_bitmap(struct super_block *sb, u32 clu); +static void sync_alloc_bitmap(struct super_block *sb); /* upcase table management functions */ s32 load_upcase_table(struct super_block *sb); void free_upcase_table(struct super_block *sb); /* dir entry management functions */ -u32 fat_get_entry_type(struct dentry_t *p_entry); -u32 exfat_get_entry_type(struct dentry_t *p_entry); -void fat_set_entry_type(struct dentry_t *p_entry, u32 type); -void exfat_set_entry_type(struct dentry_t *p_entry, u32 type); -u32 fat_get_entry_attr(struct dentry_t *p_entry); -u32 exfat_get_entry_attr(struct dentry_t *p_entry); -void fat_set_entry_attr(struct dentry_t *p_entry, u32 attr); -void exfat_set_entry_attr(struct dentry_t *p_entry, u32 attr); -u8 fat_get_entry_flag(struct dentry_t *p_entry); -u8 exfat_get_entry_flag(struct dentry_t *p_entry); -void fat_set_entry_flag(struct dentry_t *p_entry, u8 flag); -void exfat_set_entry_flag(struct dentry_t *p_entry, u8 flag); -u32 fat_get_entry_clu0(struct dentry_t *p_entry); -u32 exfat_get_entry_clu0(struct dentry_t *p_entry); -void fat_set_entry_clu0(struct dentry_t *p_entry, u32 start_clu); -void exfat_set_entry_clu0(struct dentry_t *p_entry, u32 start_clu); -u64 fat_get_entry_size(struct dentry_t *p_entry); -u64 exfat_get_entry_size(struct
[PATCH 6/8] staging: exfat: More static cleanups for exfat_core.c
Move static function bodies before first use, remove the definition in exfat.h Signed-off-by: Valdis Kletnieks --- drivers/staging/exfat/exfat.h | 6 - drivers/staging/exfat/exfat_core.c | 500 ++--- 2 files changed, 250 insertions(+), 256 deletions(-) diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h index 654a0c46c1a0..b93df526355b 100644 --- a/drivers/staging/exfat/exfat.h +++ b/drivers/staging/exfat/exfat.h @@ -786,10 +786,6 @@ void exfat_chain_cont_cluster(struct super_block *sb, u32 chain, s32 len); /* allocation bitmap management functions */ s32 load_alloc_bitmap(struct super_block *sb); void free_alloc_bitmap(struct super_block *sb); -static s32 set_alloc_bitmap(struct super_block *sb, u32 clu); -static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu); -static u32 test_alloc_bitmap(struct super_block *sb, u32 clu); -static void sync_alloc_bitmap(struct super_block *sb); /* upcase table management functions */ s32 load_upcase_table(struct super_block *sb); @@ -812,8 +808,6 @@ void release_entry_set(struct entry_set_cache_t *es); static s32 write_whole_entry_set(struct super_block *sb, struct entry_set_cache_t *es); s32 count_dos_name_entries(struct super_block *sb, struct chain_t *p_dir, u32 type); -static void update_dir_checksum(struct super_block *sb, struct chain_t *p_dir, -s32 entry); void update_dir_checksum_with_entry_set(struct super_block *sb, struct entry_set_cache_t *es); bool is_dir_empty(struct super_block *sb, struct chain_t *p_dir); diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c index dd69a9a6dddc..1a49da231946 100644 --- a/drivers/staging/exfat/exfat_core.c +++ b/drivers/staging/exfat/exfat_core.c @@ -132,6 +132,199 @@ static void fs_error(struct super_block *sb) } } +/* + * Allocation Bitmap Management Functions + */ + +s32 load_alloc_bitmap(struct super_block *sb) +{ + int i, j, ret; + u32 map_size; + u32 type; + sector_t sector; + struct chain_t clu; + struct bmap_dentry_t *ep; + struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); + struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info); + + clu.dir = p_fs->root_dir; + clu.flags = 0x01; + + while (clu.dir != CLUSTER_32(~0)) { + if (p_fs->dev_ejected) + break; + + for (i = 0; i < p_fs->dentries_per_clu; i++) { + ep = (struct bmap_dentry_t *)get_entry_in_dir(sb, , + i, NULL); + if (!ep) + return FFS_MEDIAERR; + + type = p_fs->fs_func->get_entry_type((struct dentry_t *)ep); + + if (type == TYPE_UNUSED) + break; + if (type != TYPE_BITMAP) + continue; + + if (ep->flags == 0x0) { + p_fs->map_clu = GET32_A(ep->start_clu); + map_size = (u32)GET64_A(ep->size); + + p_fs->map_sectors = ((map_size - 1) >> p_bd->sector_size_bits) + 1; + + p_fs->vol_amap = kmalloc_array(p_fs->map_sectors, + sizeof(struct buffer_head *), + GFP_KERNEL); + if (!p_fs->vol_amap) + return FFS_MEMORYERR; + + sector = START_SECTOR(p_fs->map_clu); + + for (j = 0; j < p_fs->map_sectors; j++) { + p_fs->vol_amap[j] = NULL; + ret = sector_read(sb, sector + j, &(p_fs->vol_amap[j]), 1); + if (ret != FFS_SUCCESS) { + /* release all buffers and free vol_amap */ + i = 0; + while (i < j) + brelse(p_fs->vol_amap[i++]); + + kfree(p_fs->vol_amap); + p_fs->vol_amap = NULL; + return ret; + } + } + + p_fs->pbr_bh = NULL; + return FFS_SUCCESS; + } + } + + if (FAT_read(sb, clu.dir, ) != 0
[PATCH 7/8] staging: exfat: Finished code movement for static cleanups in exfat_core.c
Move static function bodies before first use, remove the definition in exfat.h Signed-off-by: Valdis Kletnieks --- drivers/staging/exfat/exfat.h | 10 - drivers/staging/exfat/exfat_core.c | 661 ++--- 2 files changed, 330 insertions(+), 341 deletions(-) diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h index b93df526355b..8738e41dd5a5 100644 --- a/drivers/staging/exfat/exfat.h +++ b/drivers/staging/exfat/exfat.h @@ -793,10 +793,6 @@ void free_upcase_table(struct super_block *sb); /* dir entry management functions */ struct timestamp_t *tm_current(struct timestamp_t *tm); -static void init_file_entry(struct file_dentry_t *ep, u32 type); -static void init_strm_entry(struct strm_dentry_t *ep, u8 flags, u32 start_clu, -u64 size); -static void init_name_entry(struct name_dentry_t *ep, u16 *uniname); struct dentry_t *get_entry_in_dir(struct super_block *sb, struct chain_t *p_dir, s32 entry, sector_t *sector); @@ -805,7 +801,6 @@ struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb, u32 type, struct dentry_t **file_ep); void release_entry_set(struct entry_set_cache_t *es); -static s32 write_whole_entry_set(struct super_block *sb, struct entry_set_cache_t *es); s32 count_dos_name_entries(struct super_block *sb, struct chain_t *p_dir, u32 type); void update_dir_checksum_with_entry_set(struct super_block *sb, @@ -819,11 +814,6 @@ s32 get_num_entries_and_dos_name(struct super_block *sb, struct chain_t *p_dir, void get_uni_name_from_dos_entry(struct super_block *sb, struct dos_dentry_t *ep, struct uni_name_t *p_uniname, u8 mode); -static s32 extract_uni_name_from_name_entry(struct name_dentry_t *ep, u16 *uniname, - s32 order); -static s32 fat_generate_dos_name(struct super_block *sb, struct chain_t *p_dir, - struct dos_name_t *p_dosname); -static void fat_attach_count_to_dos_name(u8 *dosname, s32 count); u16 calc_checksum_2byte(void *data, s32 len, u16 chksum, s32 type); /* name resolution functions */ diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c index 1a49da231946..7332e69fcbcd 100644 --- a/drivers/staging/exfat/exfat_core.c +++ b/drivers/staging/exfat/exfat_core.c @@ -791,6 +791,168 @@ void free_upcase_table(struct super_block *sb) p_fs->vol_utbl = NULL; } +static s32 __write_partial_entries_in_entry_set(struct super_block *sb, + struct entry_set_cache_t *es, + sector_t sec, s32 off, u32 count) +{ + s32 num_entries, buf_off = (off - es->offset); + u32 remaining_byte_in_sector, copy_entries; + struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); + struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info); + u32 clu; + u8 *buf, *esbuf = (u8 *)&(es->__buf); + + pr_debug("%s entered es %p sec %llu off %d count %d\n", + __func__, es, (unsigned long long)sec, off, count); + num_entries = count; + + while (num_entries) { + /* white per sector base */ + remaining_byte_in_sector = (1 << p_bd->sector_size_bits) - off; + copy_entries = min_t(s32, +remaining_byte_in_sector >> DENTRY_SIZE_BITS, +num_entries); + buf = buf_getblk(sb, sec); + if (!buf) + goto err_out; + pr_debug("es->buf %p buf_off %u\n", esbuf, buf_off); + pr_debug("copying %d entries from %p to sector %llu\n", + copy_entries, (esbuf + buf_off), + (unsigned long long)sec); + memcpy(buf + off, esbuf + buf_off, + copy_entries << DENTRY_SIZE_BITS); + buf_modify(sb, sec); + num_entries -= copy_entries; + + if (num_entries) { + /* get next sector */ + if (IS_LAST_SECTOR_IN_CLUSTER(sec)) { + clu = GET_CLUSTER_FROM_SECTOR(sec); + if (es->alloc_flag == 0x03) { + clu++; + } else { + if (FAT_read(sb, clu, ) == -1) + goto err_out; + } + sec = START_SECTOR(clu); + } else { + sec++; + } +
[PATCH 4/8] staging: exfat: Cleanup static entries in exfat.h
Many of the static definitions that remain are not needed, as the function definition is already before the first use. Signed-off-by: Valdis Kletnieks --- drivers/staging/exfat/exfat.h | 53 --- 1 file changed, 53 deletions(-) diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h index 9cd78b6417d0..dbd86a6cdc95 100644 --- a/drivers/staging/exfat/exfat.h +++ b/drivers/staging/exfat/exfat.h @@ -782,17 +782,9 @@ static void buf_sync(struct super_block *sb); /* fs management functions */ void fs_set_vol_flags(struct super_block *sb, u32 new_flag); -static void fs_error(struct super_block *sb); /* cluster management functions */ -static s32 clear_cluster(struct super_block *sb, u32 clu); -static s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc, - struct chain_t *p_chain); -static void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain, - s32 do_relse); -static u32 find_last_cluster(struct super_block *sb, struct chain_t *p_chain); s32 count_num_clusters(struct super_block *sb, struct chain_t *dir); -static s32 exfat_count_used_clusters(struct super_block *sb); void exfat_chain_cont_cluster(struct super_block *sb, u32 chain, s32 len); /* allocation bitmap management functions */ @@ -808,36 +800,12 @@ s32 load_upcase_table(struct super_block *sb); void free_upcase_table(struct super_block *sb); /* dir entry management functions */ -static u32 exfat_get_entry_type(struct dentry_t *p_entry); -static void exfat_set_entry_type(struct dentry_t *p_entry, u32 type); -static u32 exfat_get_entry_attr(struct dentry_t *p_entry); -static void exfat_set_entry_attr(struct dentry_t *p_entry, u32 attr); -static u8 exfat_get_entry_flag(struct dentry_t *p_entry); -static void exfat_set_entry_flag(struct dentry_t *p_entry, u8 flag); -static u32 exfat_get_entry_clu0(struct dentry_t *p_entry); -static void exfat_set_entry_clu0(struct dentry_t *p_entry, u32 start_clu); -static u64 exfat_get_entry_size(struct dentry_t *p_entry); -static void exfat_set_entry_size(struct dentry_t *p_entry, u64 size); struct timestamp_t *tm_current(struct timestamp_t *tm); -static void exfat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, - u8 mode); -static void exfat_set_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, - u8 mode); -static s32 exfat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir, -s32 entry, u32 type, u32 start_clu, u64 size); -static s32 exfat_init_ext_dir_entry(struct super_block *sb, struct chain_t *p_dir, -s32 entry, s32 num_entries, -struct uni_name_t *p_uniname, - struct dos_name_t *p_dosname); static void init_file_entry(struct file_dentry_t *ep, u32 type); static void init_strm_entry(struct strm_dentry_t *ep, u8 flags, u32 start_clu, u64 size); static void init_name_entry(struct name_dentry_t *ep, u16 *uniname); -static void exfat_delete_dir_entry(struct super_block *sb, struct chain_t *p_dir, - s32 entry, s32 order, s32 num_entries); -static s32 find_location(struct super_block *sb, struct chain_t *p_dir, s32 entry, - sector_t *sector, s32 *offset); struct dentry_t *get_entry_in_dir(struct super_block *sb, struct chain_t *p_dir, s32 entry, sector_t *sector); struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb, @@ -846,18 +814,6 @@ struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb, struct dentry_t **file_ep); void release_entry_set(struct entry_set_cache_t *es); static s32 write_whole_entry_set(struct super_block *sb, struct entry_set_cache_t *es); -static s32 write_partial_entries_in_entry_set(struct super_block *sb, - struct entry_set_cache_t *es, - struct dentry_t *ep, u32 count); -static s32 search_deleted_or_unused_entry(struct super_block *sb, - struct chain_t *p_dir, s32 num_entries); -static s32 find_empty_entry(struct inode *inode, struct chain_t *p_dir, -s32 num_entries); -static s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir, -struct uni_name_t *p_uniname, s32 num_entries, -struct dos_name_t *p_dosname, u32 type); -static s32 exfat_count_ext_entries(struct super_block *sb, struct chain_t *p_dir, - s32 entry, struct dentry_t *p_entry); s32 count_dos_name_entries(struct super_block *sb, struct chain_t *p_dir, u32 type); static void update_dir_checksum(struct super_block *sb, struct chain_t *p_dir, @@ -873,25 +829,16 @@ s32
[PATCH 8/8] staging: exfat: Update TODO
Signed-off-by: Valdis Kletnieks --- drivers/staging/exfat/TODO | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/staging/exfat/TODO b/drivers/staging/exfat/TODO index b60e50b9cf4e..110c30834bd2 100644 --- a/drivers/staging/exfat/TODO +++ b/drivers/staging/exfat/TODO @@ -1,21 +1,17 @@ exfat_core.c - ffsReadFile - the goto err_out seem to leak a brelse(). same for ffsWriteFile. -exfat_core.c - fs_sync(sb,0) all over the place looks fishy as hell. -There's only one place that calls it with a non-zero argument. -Randomly removing fs_sync() calls is *not* the right answer, especially -if the removal then leaves a call to fs_set_vol_flags(VOL_CLEAN), as that -says the file system is clean and synced when we *know* it isn't. -The proper fix here is to go through and actually analyze how DELAYED_SYNC -should work, and any time we're setting VOL_CLEAN, ensure the file system -has in fact been synced to disk. In other words, changing the 'false' to -'true' is probably more correct. Also, it's likely that the one current -place where it actually does an bdev_sync isn't sufficient in the DELAYED_SYNC -case. - ffsTruncateFile - if (old_size <= new_size) { That doesn't look right. How did it ever work? Are they relying on lazy block allocation when actual writes happen? If nothing else, it never does the 'fid->size = new_size' and do the inode update ffsSetAttr() is just dangling in the breeze, not wired up at all... + +exfat_core.c - The original code called fs_sync(sb,0) all over the place, +with only one place that calls it with a non-zero argument. That's now been +reversed, but a proper audit of sync and flush-to-disk is certainly needed. + +buf_sync(), sync_alloc_bitmap(), and FAT_sync() aren't actually used +anyplace. This is probably related to the borked original implementatin +of fs_sync() that didn't actually do anything either. -- 2.23.0
[PATCH 5/8] staging: exfat: Clean up static definitions in exfat_cache.c
Move static function bodies before first use, remove the definition in exfat.h Signed-off-by: Valdis Kletnieks --- drivers/staging/exfat/exfat.h | 4 -- drivers/staging/exfat/exfat_cache.c | 94 +++-- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h index dbd86a6cdc95..654a0c46c1a0 100644 --- a/drivers/staging/exfat/exfat.h +++ b/drivers/staging/exfat/exfat.h @@ -768,17 +768,13 @@ void buf_init(struct super_block *sb); void buf_shutdown(struct super_block *sb); int FAT_read(struct super_block *sb, u32 loc, u32 *content); s32 FAT_write(struct super_block *sb, u32 loc, u32 content); -static u8 *FAT_getblk(struct super_block *sb, sector_t sec); -static void FAT_modify(struct super_block *sb, sector_t sec); void FAT_release_all(struct super_block *sb); -static void FAT_sync(struct super_block *sb); u8 *buf_getblk(struct super_block *sb, sector_t sec); void buf_modify(struct super_block *sb, sector_t sec); void buf_lock(struct super_block *sb, sector_t sec); void buf_unlock(struct super_block *sb, sector_t sec); void buf_release(struct super_block *sb, sector_t sec); void buf_release_all(struct super_block *sb); -static void buf_sync(struct super_block *sb); /* fs management functions */ void fs_set_vol_flags(struct super_block *sb, u32 new_flag); diff --git a/drivers/staging/exfat/exfat_cache.c b/drivers/staging/exfat/exfat_cache.c index e1b001718709..e9ad0353b4e5 100644 --- a/drivers/staging/exfat/exfat_cache.c +++ b/drivers/staging/exfat/exfat_cache.c @@ -193,6 +193,50 @@ void buf_shutdown(struct super_block *sb) { } +static u8 *FAT_getblk(struct super_block *sb, sector_t sec) +{ + struct buf_cache_t *bp; + struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); + + bp = FAT_cache_find(sb, sec); + if (bp) { + move_to_mru(bp, _fs->FAT_cache_lru_list); + return bp->buf_bh->b_data; + } + + bp = FAT_cache_get(sb, sec); + + FAT_cache_remove_hash(bp); + + bp->drv = p_fs->drv; + bp->sec = sec; + bp->flag = 0; + + FAT_cache_insert_hash(sb, bp); + + if (sector_read(sb, sec, >buf_bh, 1) != FFS_SUCCESS) { + FAT_cache_remove_hash(bp); + bp->drv = -1; + bp->sec = ~0; + bp->flag = 0; + bp->buf_bh = NULL; + + move_to_lru(bp, _fs->FAT_cache_lru_list); + return NULL; + } + + return bp->buf_bh->b_data; +} + +static void FAT_modify(struct super_block *sb, sector_t sec) +{ + struct buf_cache_t *bp; + + bp = FAT_cache_find(sb, sec); + if (bp) + sector_write(sb, sec, bp->buf_bh, 0); +} + static int __FAT_read(struct super_block *sb, u32 loc, u32 *content) { s32 off; @@ -441,50 +485,6 @@ int FAT_write(struct super_block *sb, u32 loc, u32 content) return ret; } -u8 *FAT_getblk(struct super_block *sb, sector_t sec) -{ - struct buf_cache_t *bp; - struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); - - bp = FAT_cache_find(sb, sec); - if (bp) { - move_to_mru(bp, _fs->FAT_cache_lru_list); - return bp->buf_bh->b_data; - } - - bp = FAT_cache_get(sb, sec); - - FAT_cache_remove_hash(bp); - - bp->drv = p_fs->drv; - bp->sec = sec; - bp->flag = 0; - - FAT_cache_insert_hash(sb, bp); - - if (sector_read(sb, sec, >buf_bh, 1) != FFS_SUCCESS) { - FAT_cache_remove_hash(bp); - bp->drv = -1; - bp->sec = ~0; - bp->flag = 0; - bp->buf_bh = NULL; - - move_to_lru(bp, _fs->FAT_cache_lru_list); - return NULL; - } - - return bp->buf_bh->b_data; -} - -void FAT_modify(struct super_block *sb, sector_t sec) -{ - struct buf_cache_t *bp; - - bp = FAT_cache_find(sb, sec); - if (bp) - sector_write(sb, sec, bp->buf_bh, 0); -} - void FAT_release_all(struct super_block *sb) { struct buf_cache_t *bp; @@ -510,7 +510,8 @@ void FAT_release_all(struct super_block *sb) up(_sem); } -void FAT_sync(struct super_block *sb) +/* FIXME - this function is not used anyplace. See TODO */ +static void FAT_sync(struct super_block *sb) { struct buf_cache_t *bp; struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); @@ -704,7 +705,8 @@ void buf_release_all(struct super_block *sb) up(_sem); } -void buf_sync(struct super_block *sb) +/* FIXME - this function is not used anyplace. See TODO */ +static void buf_sync(struct super_block *sb) { struct buf_cache_t *bp; struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); -- 2.23.0
[PATCH 3/8] staging: exfat: Remove FAT/VFAT mount support, part 2
Remove no longer referenced FAT/VFAT routines. Signed-off-by: Valdis Kletnieks --- drivers/staging/exfat/exfat.h | 49 +- drivers/staging/exfat/exfat_core.c | 755 - 2 files changed, 2 insertions(+), 802 deletions(-) diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h index c2db3e9e9785..9cd78b6417d0 100644 --- a/drivers/staging/exfat/exfat.h +++ b/drivers/staging/exfat/exfat.h @@ -786,17 +786,12 @@ static void fs_error(struct super_block *sb); /* cluster management functions */ static s32 clear_cluster(struct super_block *sb, u32 clu); -static s32 fat_alloc_cluster(struct super_block *sb, s32 num_alloc, - struct chain_t *p_chain); static s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc, struct chain_t *p_chain); -static void fat_free_cluster(struct super_block *sb, struct chain_t *p_chain, - s32 do_relse); static void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain, s32 do_relse); static u32 find_last_cluster(struct super_block *sb, struct chain_t *p_chain); s32 count_num_clusters(struct super_block *sb, struct chain_t *dir); -static s32 fat_count_used_clusters(struct super_block *sb); static s32 exfat_count_used_clusters(struct super_block *sb); void exfat_chain_cont_cluster(struct super_block *sb, u32 chain, s32 len); @@ -813,63 +808,36 @@ s32 load_upcase_table(struct super_block *sb); void free_upcase_table(struct super_block *sb); /* dir entry management functions */ -static u32 fat_get_entry_type(struct dentry_t *p_entry); static u32 exfat_get_entry_type(struct dentry_t *p_entry); -static void fat_set_entry_type(struct dentry_t *p_entry, u32 type); static void exfat_set_entry_type(struct dentry_t *p_entry, u32 type); -static u32 fat_get_entry_attr(struct dentry_t *p_entry); static u32 exfat_get_entry_attr(struct dentry_t *p_entry); -static void fat_set_entry_attr(struct dentry_t *p_entry, u32 attr); static void exfat_set_entry_attr(struct dentry_t *p_entry, u32 attr); -static u8 fat_get_entry_flag(struct dentry_t *p_entry); static u8 exfat_get_entry_flag(struct dentry_t *p_entry); -static void fat_set_entry_flag(struct dentry_t *p_entry, u8 flag); static void exfat_set_entry_flag(struct dentry_t *p_entry, u8 flag); -static u32 fat_get_entry_clu0(struct dentry_t *p_entry); static u32 exfat_get_entry_clu0(struct dentry_t *p_entry); -static void fat_set_entry_clu0(struct dentry_t *p_entry, u32 start_clu); static void exfat_set_entry_clu0(struct dentry_t *p_entry, u32 start_clu); -static u64 fat_get_entry_size(struct dentry_t *p_entry); static u64 exfat_get_entry_size(struct dentry_t *p_entry); -static void fat_set_entry_size(struct dentry_t *p_entry, u64 size); static void exfat_set_entry_size(struct dentry_t *p_entry, u64 size); struct timestamp_t *tm_current(struct timestamp_t *tm); -static void fat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, - u8 mode); static void exfat_get_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, u8 mode); -static void fat_set_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, - u8 mode); static void exfat_set_entry_time(struct dentry_t *p_entry, struct timestamp_t *tp, u8 mode); -static s32 fat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir, s32 entry, - u32 type, u32 start_clu, u64 size); static s32 exfat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir, s32 entry, u32 type, u32 start_clu, u64 size); -static s32 fat_init_ext_dir_entry(struct super_block *sb, struct chain_t *p_dir, - s32 entry, s32 num_entries, - struct uni_name_t *p_uniname, - struct dos_name_t *p_dosname); static s32 exfat_init_ext_dir_entry(struct super_block *sb, struct chain_t *p_dir, s32 entry, s32 num_entries, struct uni_name_t *p_uniname, struct dos_name_t *p_dosname); -static void init_dos_entry(struct dos_dentry_t *ep, u32 type, u32 start_clu); -static void init_ext_entry(struct ext_dentry_t *ep, s32 order, u8 chksum, - u16 *uniname); static void init_file_entry(struct file_dentry_t *ep, u32 type); static void init_strm_entry(struct strm_dentry_t *ep, u8 flags, u32 start_clu, u64 size); static void init_name_entry(struct name_dentry_t *ep, u16 *uniname); -static void fat_delete_dir_entry(struct super_block *sb, struct chain_t *p_dir, - s32 entry, s32 order, s32 num_entries); static void exfat_delete_dir_entry(struct super_block *sb, struct chain_t *p_dir, s32 entry, s32 order, s32 num_entries); static s32 find_location(struct
[PATCH 2/8] staging: exfat: Remove FAT/VFAT mount support, part 1
Remove the top-level mount functionality, to make this driver handle only exfat file systems. Signed-off-by: Valdis Kletnieks --- drivers/staging/exfat/Kconfig | 9 -- drivers/staging/exfat/exfat.h | 2 - drivers/staging/exfat/exfat_core.c | 142 drivers/staging/exfat/exfat_super.c | 8 +- 4 files changed, 1 insertion(+), 160 deletions(-) diff --git a/drivers/staging/exfat/Kconfig b/drivers/staging/exfat/Kconfig index ce32dfe33bec..0130019cbec2 100644 --- a/drivers/staging/exfat/Kconfig +++ b/drivers/staging/exfat/Kconfig @@ -6,15 +6,6 @@ config EXFAT_FS help This adds support for the exFAT file system. -config EXFAT_DONT_MOUNT_VFAT - bool "Prohibit mounting of fat/vfat filesystems by exFAT" - depends on EXFAT_FS - default y - help - By default, the exFAT driver will only mount exFAT filesystems, and refuse - to mount fat/vfat filesystems. Set this to 'n' to allow the exFAT driver - to mount these filesystems. - config EXFAT_DISCARD bool "enable discard support" depends on EXFAT_FS diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h index 0c779c8dd858..c2db3e9e9785 100644 --- a/drivers/staging/exfat/exfat.h +++ b/drivers/staging/exfat/exfat.h @@ -935,8 +935,6 @@ s32 resolve_path(struct inode *inode, char *path, struct chain_t *p_dir, static s32 resolve_name(u8 *name, u8 **arg); /* file operation functions */ -static s32 fat16_mount(struct super_block *sb, struct pbr_sector_t *p_pbr); -static s32 fat32_mount(struct super_block *sb, struct pbr_sector_t *p_pbr); s32 exfat_mount(struct super_block *sb, struct pbr_sector_t *p_pbr); s32 create_dir(struct inode *inode, struct chain_t *p_dir, struct uni_name_t *p_uniname, struct file_id_t *fid); diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c index 0260e4fe3762..fd481b21f8b6 100644 --- a/drivers/staging/exfat/exfat_core.c +++ b/drivers/staging/exfat/exfat_core.c @@ -2980,148 +2980,6 @@ s32 resolve_path(struct inode *inode, char *path, struct chain_t *p_dir, /* * File Operation Functions */ -static struct fs_func fat_fs_func = { - .alloc_cluster = fat_alloc_cluster, - .free_cluster = fat_free_cluster, - .count_used_clusters = fat_count_used_clusters, - - .init_dir_entry = fat_init_dir_entry, - .init_ext_entry = fat_init_ext_entry, - .find_dir_entry = fat_find_dir_entry, - .delete_dir_entry = fat_delete_dir_entry, - .get_uni_name_from_ext_entry = fat_get_uni_name_from_ext_entry, - .count_ext_entries = fat_count_ext_entries, - .calc_num_entries = fat_calc_num_entries, - - .get_entry_type = fat_get_entry_type, - .set_entry_type = fat_set_entry_type, - .get_entry_attr = fat_get_entry_attr, - .set_entry_attr = fat_set_entry_attr, - .get_entry_flag = fat_get_entry_flag, - .set_entry_flag = fat_set_entry_flag, - .get_entry_clu0 = fat_get_entry_clu0, - .set_entry_clu0 = fat_set_entry_clu0, - .get_entry_size = fat_get_entry_size, - .set_entry_size = fat_set_entry_size, - .get_entry_time = fat_get_entry_time, - .set_entry_time = fat_set_entry_time, -}; - -static s32 fat16_mount(struct super_block *sb, struct pbr_sector_t *p_pbr) -{ - s32 num_reserved, num_root_sectors; - struct bpb16_t *p_bpb = (struct bpb16_t *)p_pbr->bpb; - struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); - struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info); - - if (p_bpb->num_fats == 0) - return FFS_FORMATERR; - - num_root_sectors = GET16(p_bpb->num_root_entries) << DENTRY_SIZE_BITS; - num_root_sectors = ((num_root_sectors - 1) >> - p_bd->sector_size_bits) + 1; - - p_fs->sectors_per_clu = p_bpb->sectors_per_clu; - p_fs->sectors_per_clu_bits = ilog2(p_bpb->sectors_per_clu); - p_fs->cluster_size_bits = p_fs->sectors_per_clu_bits + - p_bd->sector_size_bits; - p_fs->cluster_size = 1 << p_fs->cluster_size_bits; - - p_fs->num_FAT_sectors = GET16(p_bpb->num_fat_sectors); - - p_fs->FAT1_start_sector = p_fs->PBR_sector + GET16(p_bpb->num_reserved); - if (p_bpb->num_fats == 1) - p_fs->FAT2_start_sector = p_fs->FAT1_start_sector; - else - p_fs->FAT2_start_sector = p_fs->FAT1_start_sector + - p_fs->num_FAT_sectors; - - p_fs->root_start_sector = p_fs->FAT2_start_sector + - p_fs->num_FAT_sectors; - p_fs->data_start_sector = p_fs->root_start_sector + num_root_sectors; - - p_fs->num_sectors = GET16(p_bpb->num_sectors); - if (p_fs->num_s
[PATCH 0/8] staging: exfat: Code cleanups
Two main goals here - remove the code to mount FAT and VFAT filesystes, and make a lot of functions static to reduce namespace pollution. Valdis Kletnieks (8): staging: exfat: Clean up namespace pollution, part 1 staging: exfat: Remove FAT/VFAT mount support, part 1 staging: exfat: Remove FAT/VFAT mount support, part 2 staging: exfat: Cleanup static entries in exfat.h staging: exfat: Clean up static definitions in exfat_cache.c staging: exfat: More static cleanups for exfat_core.c staging: exfat: Finished code movement for static cleanups in exfat_core.c staging: exfat: Update TODO drivers/staging/exfat/Kconfig |9 - drivers/staging/exfat/TODO | 20 +- drivers/staging/exfat/exfat.h | 122 +- drivers/staging/exfat/exfat_cache.c | 94 +- drivers/staging/exfat/exfat_core.c | 2162 --- drivers/staging/exfat/exfat_super.c |8 +- 6 files changed, 690 insertions(+), 1725 deletions(-) -- 2.23.0
[tip:ras/core] RAS: Build debugfs.o only when enabled in Kconfig
Commit-ID: b6ff24f7b5101101ff897dfdde3f37924e676bc2 Gitweb: https://git.kernel.org/tip/b6ff24f7b5101101ff897dfdde3f37924e676bc2 Author: Valdis Kletnieks AuthorDate: Thu, 8 Aug 2019 16:32:27 +0200 Committer: Borislav Petkov CommitDate: Thu, 8 Aug 2019 17:44:02 +0200 RAS: Build debugfs.o only when enabled in Kconfig In addition, the 0day bot reported this build error: >> drivers/ras/debugfs.c:10:5: error: redefinition of 'ras_userspace_consumers' int ras_userspace_consumers(void) ^~~ In file included from drivers/ras/debugfs.c:3:0: include/linux/ras.h:14:19: note: previous definition of 'ras_userspace_consumers' was here static inline int ras_userspace_consumers(void) { return 0; } ^~~ for a riscv-specific .config where CONFIG_DEBUG_FS is not set. Fix all that by making debugfs.o depend on that define. [ bp: Rewrite commit message. ] Reported-by: kbuild test robot Signed-off-by: Valdis Kletnieks Signed-off-by: Borislav Petkov Cc: Tony Luck Cc: linux-e...@vger.kernel.org Cc: x...@kernel.org Link: http://lkml.kernel.org/r/7053.1565218556@turing-police --- drivers/ras/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ras/Makefile b/drivers/ras/Makefile index ef6777e14d3d..6f0404f50107 100644 --- a/drivers/ras/Makefile +++ b/drivers/ras/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_RAS) += ras.o debugfs.o +obj-$(CONFIG_RAS) += ras.o +obj-$(CONFIG_DEBUG_FS) += debugfs.o obj-$(CONFIG_RAS_CEC) += cec.o
[tip:perf/core] perf/core: Make perf_swevent_init_cpu() static
Commit-ID: d18bf4229b1772e91c0c36772737c01cf9726720 Gitweb: https://git.kernel.org/tip/d18bf4229b1772e91c0c36772737c01cf9726720 Author: Valdis Kletnieks AuthorDate: Tue, 12 Mar 2019 04:06:37 -0400 Committer: Ingo Molnar CommitDate: Wed, 3 Apr 2019 09:52:34 +0200 perf/core: Make perf_swevent_init_cpu() static 'make W=1' causes GCC to complain: kernel/events/core.c:11877:6: warning: no previous prototype for 'perf_swevent_init_cpu' [-Wmissing-prototypes] It's not referenced anywhere else, make it static. Signed-off-by: Valdis Kletnieks Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: https://lkml.kernel.org/r/28974.1552377997@turing-police Signed-off-by: Ingo Molnar --- kernel/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 72d06e302e99..dfc4bab0b02b 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -11878,7 +11878,7 @@ static void __init perf_event_init_all_cpus(void) } } -void perf_swevent_init_cpu(unsigned int cpu) +static void perf_swevent_init_cpu(unsigned int cpu) { struct swevent_htable *swhash = _cpu(swevent_htable, cpu);
[tip:x86/urgent] x86/mm/pti: Make local symbols static
Commit-ID: 4fe64a62e04cfb2dc1daab0d8f05d212aa014161 Gitweb: https://git.kernel.org/tip/4fe64a62e04cfb2dc1daab0d8f05d212aa014161 Author: Valdis Kletnieks AuthorDate: Tue, 12 Mar 2019 03:47:53 -0400 Committer: Thomas Gleixner CommitDate: Fri, 22 Mar 2019 13:31:28 +0100 x86/mm/pti: Make local symbols static With 'make C=2 W=1', sparse and gcc both complain: CHECK arch/x86/mm/pti.c arch/x86/mm/pti.c:84:3: warning: symbol 'pti_mode' was not declared. Should it be static? arch/x86/mm/pti.c:605:6: warning: symbol 'pti_set_kernel_image_nonglobal' was not declared. Should it be static? CC arch/x86/mm/pti.o arch/x86/mm/pti.c:605:6: warning: no previous prototype for 'pti_set_kernel_image_nonglobal' [-Wmissing-prototypes] 605 | void pti_set_kernel_image_nonglobal(void) | ^~ pti_set_kernel_image_nonglobal() is only used locally. 'pti_mode' exists in drivers/hwtracing/intel_th/pti.c as well, but it's a completely unrelated local (static) symbol. Make both static. Signed-off-by: Valdis Kletnieks Signed-off-by: Thomas Gleixner Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Link: https://lkml.kernel.org/r/27680.1552376873@turing-police --- arch/x86/mm/pti.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index 4fee5c3003ed..139b28a01ce4 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -77,7 +77,7 @@ static void __init pti_print_if_secure(const char *reason) pr_info("%s\n", reason); } -enum pti_mode { +static enum pti_mode { PTI_AUTO = 0, PTI_FORCE_OFF, PTI_FORCE_ON @@ -602,7 +602,7 @@ static void pti_clone_kernel_text(void) set_memory_global(start, (end_global - start) >> PAGE_SHIFT); } -void pti_set_kernel_image_nonglobal(void) +static void pti_set_kernel_image_nonglobal(void) { /* * The identity map is created with PMDs, regardless of the
[tip:core/urgent] watchdog/core: Make variables static
Commit-ID: 48084abf212052ca1d39fae064c581b1ce5b1fdf Gitweb: https://git.kernel.org/tip/48084abf212052ca1d39fae064c581b1ce5b1fdf Author: Valdis Kletnieks AuthorDate: Tue, 12 Mar 2019 05:33:48 -0400 Committer: Thomas Gleixner CommitDate: Fri, 22 Mar 2019 13:40:17 +0100 watchdog/core: Make variables static sparse complains: CHECK kernel/watchdog.c kernel/watchdog.c:45:19: warning: symbol 'nmi_watchdog_available' was not declared. Should it be static? kernel/watchdog.c:47:16: warning: symbol 'watchdog_allowed_mask' was not declared. Should it be static? They're not referenced by name from anyplace else, make them static. Signed-off-by: Valdis Kletnieks Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/7855.1552383228@turing-police --- kernel/watchdog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 8fbfda94a67b..403c9bd90413 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -42,9 +42,9 @@ int __read_mostly watchdog_user_enabled = 1; int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT; int __read_mostly soft_watchdog_user_enabled = 1; int __read_mostly watchdog_thresh = 10; -int __read_mostly nmi_watchdog_available; +static int __read_mostly nmi_watchdog_available; -struct cpumask watchdog_allowed_mask __read_mostly; +static struct cpumask watchdog_allowed_mask __read_mostly; struct cpumask watchdog_cpumask __read_mostly; unsigned long *watchdog_cpumask_bits = cpumask_bits(_cpumask);
[tip:timers/urgent] time/jiffies: Make refined_jiffies static
Commit-ID: e8750053d64a3317cbc15f8341f0f11ca751bfeb Gitweb: https://git.kernel.org/tip/e8750053d64a3317cbc15f8341f0f11ca751bfeb Author: Valdis Kletnieks AuthorDate: Tue, 12 Mar 2019 04:38:35 -0400 Committer: Thomas Gleixner CommitDate: Fri, 22 Mar 2019 13:38:26 +0100 time/jiffies: Make refined_jiffies static sparse complains: CHECK kernel/time/jiffies.c kernel/time/jiffies.c:92:20: warning: symbol 'refined_jiffies' was not declared. Should it be static? Its only used in file scope. Make it static. Signed-off-by: Valdis Kletnieks Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/32342.1552379915@turing-police --- kernel/time/jiffies.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c index dc1b6f1929f9..ac9c03dd6c7d 100644 --- a/kernel/time/jiffies.c +++ b/kernel/time/jiffies.c @@ -89,7 +89,7 @@ struct clocksource * __init __weak clocksource_default_clock(void) return _jiffies; } -struct clocksource refined_jiffies; +static struct clocksource refined_jiffies; int register_refined_jiffies(long cycles_per_second) {
[tip:irq/urgent] genirq/devres: Remove excess parameter from kernel doc
Commit-ID: bb2e320565f997273fe04035bb6c17f643da6f8a Gitweb: https://git.kernel.org/tip/bb2e320565f997273fe04035bb6c17f643da6f8a Author: Valdis Kletnieks AuthorDate: Tue, 12 Mar 2019 04:17:56 -0400 Committer: Thomas Gleixner CommitDate: Fri, 22 Mar 2019 13:34:12 +0100 genirq/devres: Remove excess parameter from kernel doc Building with 'make W=1' complains: CC kernel/irq/devres.o kernel/irq/devres.c:104: warning: Excess function parameter 'thread_fn' description in 'devm_request_any_context_irq' Remove it. Signed-off-by: Valdis Kletnieks Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/31207.1552378676@turing-police --- kernel/irq/devres.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c index 5d5378ea0afe..f808c6a97dcc 100644 --- a/kernel/irq/devres.c +++ b/kernel/irq/devres.c @@ -84,8 +84,6 @@ EXPORT_SYMBOL(devm_request_threaded_irq); * @dev: device to request interrupt for * @irq: Interrupt line to allocate * @handler: Function to be called when the IRQ occurs - * @thread_fn: function to be called in a threaded interrupt context. NULL - * for devices which handle everything in @handler * @irqflags: Interrupt type flags * @devname: An ascii name for the claiming device, dev_name(dev) if NULL * @dev_id: A cookie passed back to the handler function
Re: [PATCH] drivers/platform/x86/dell-rbtn.c - add missing #include
On Tue, 12 Mar 2019 23:46:11 +0100, Pali Rohar said: > Can you identify in which commit was introduced this problem? If yes, > then Fixes: keyword should be added into commit message. I admit not knowing how long that's been there - I mostly found myself with a large amount of free time, a good supply of caffeine, and I got irritated with how many warnings 'make C=2 W=1' throws, so I decided to start going through and beating things into shape. For those issues where I can easily identify the regression point, I will include a Fixes: as I go..
Re: [bpf] 568f196756: BUG:assuming_atomic_context_at_kernel/seccomp.c
On Sat, 23 Feb 2019 00:15:38 +0100, Jann Horn said: > On Fri, Feb 22, 2019 at 11:42 PM wrote: > > Is there a reason this commit appeared in next-20190221 but did not seem to > > be > > in next-20190222 (confirmed via 'git tag --contains')?y ast@, he wanted to > > fix it in a different way: > https://lore.kernel.org/netdev/20190221192916.2mcd4fmxbdj2j...@ast-mbp.dhcp.thefacebook.com/ Aha. That was cc:ed to netdev, but not to lkml. Explains why I missed that piece of the story
Re: [bpf] 568f196756: BUG:assuming_atomic_context_at_kernel/seccomp.c
On Thu, 21 Feb 2019 14:39:27 +0100, Daniel Borkmann said: > Fyi, false positive and already fixed in bpf-next. > > (https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=435b3ff5b08a99a15647be32735abf8db66cea9a) Is there a reason this commit appeared in next-20190221 but did not seem to be in next-20190222 (confirmed via 'git tag --contains')? [/usr/src/linux-next] git tag -l next-20190222 next-20190222 [/usr/src/linux-next] git tag --contains 435b3ff5b08a99a15647be32735abf8db66cea9a next-20190221 (I went ahead and 'git cherry-pick -n' it on top of 0222)
Re: [regression -next0117] What is kcompactd and why is he eating 100% of my cpu?
On Tue, 29 Jan 2019 20:06:39 -0500, valdis.kletni...@vt.edu said: > On Mon, 28 Jan 2019 10:16:27 +0100, Jan Kara said: > > > So my buffer_migrate_page_norefs() is certainly buggy in its current > > incarnation (as a result block device page cache is not migratable at all). > > I've sent Andrew a patch over week ago but so far it got ignored. The patch > > is attached, can you give it a try whether it changes something for you? > > Thanks! > > Been running with the patch for about 24 hours, haven't seen kcompactd > misbehave. I even fired up a Chrome with a lot of tabs open, a Firefox, and a > kernel build, intentionally drove the system into swapping, and kcompactd > didn't make it into the top 10 on 'top'. > > I'm willing to say put a "tested-by:" on that one, it looks fixed from here. > If there's any remaining bugs, they're ones I can't seem to trigger... Spoke too soon. Sitting here not stressing the laptop at all, plenty of free memory, and ka-blam. Will keep my eyes open and do the data gathering Mel Gorban wanted - I discovered too late that trace-cmd wasn't installed, and things broke free by themselves (probably not coincidence that I launched a terminal window and then it cleared) top - 23:24:03 up 2:19, 1 user, load average: 2.70, 2.00, 1.55 Tasks: 221 total, 3 running, 218 sleeping, 0 stopped, 0 zombie %Cpu(s): 15.6 us, 67.3 sy, 0.0 ni, 9.5 id, 0.0 wa, 5.6 hi, 2.0 si, 0.0 st GiB Mem : 7.6 total, 2.7 free, 3.1 used, 1.8 buff/cache GiB Swap: 8.0 total, 8.0 free, 0.0 used. 4.1 avail Mem PID PPID %MEM PR NI SVIRTRESSHR SWAP UID %CPU TIME+ COMMAND 27 2 0.0 20 0 R0.0m 0.0m 0.0m 0.0m 0 78.5 2:11.91 kcompactd0
Re: [regression -next0117] What is kcompactd and why is he eating 100% of my cpu?
On Mon, 28 Jan 2019 10:16:27 +0100, Jan Kara said: > So my buffer_migrate_page_norefs() is certainly buggy in its current > incarnation (as a result block device page cache is not migratable at all). > I've sent Andrew a patch over week ago but so far it got ignored. The patch > is attached, can you give it a try whether it changes something for you? > Thanks! Been running with the patch for about 24 hours, haven't seen kcompactd misbehave. I even fired up a Chrome with a lot of tabs open, a Firefox, and a kernel build, intentionally drove the system into swapping, and kcompactd didn't make it into the top 10 on 'top'. I'm willing to say put a "tested-by:" on that one, it looks fixed from here. If there's any remaining bugs, they're ones I can't seem to trigger...
[PATCH] init/calibrate.c - provide proper prototype.
Sparse issues a warning: CHECK init/calibrate.c init/calibrate.c:271:28: warning: symbol 'calibration_delay_done' was not declared. Should it be static? The actual issue is that it's a __weak symbol that archs can override (in fact, ARM does so), but no prototype is provided. Let's provide one to prevent surprises. Signed-off-by: Valdis Kletnieks diff --git a/include/linux/delay.h b/include/linux/delay.h index b78bab4395d8..8e6828094c1e 100644 --- a/include/linux/delay.h +++ b/include/linux/delay.h @@ -55,6 +55,7 @@ static inline void ndelay(unsigned long x) extern unsigned long lpj_fine; void calibrate_delay(void); +void __attribute__((weak)) calibration_delay_done(void); void msleep(unsigned int msecs); unsigned long msleep_interruptible(unsigned int msecs); void usleep_range(unsigned long min, unsigned long max);
[PATCH] kernel/bpf/cgroup.c - clean up kerneldoc warnings
Building with W=1 reveals some bitrot CC kernel/bpf/cgroup.o kernel/bpf/cgroup.c:238: warning: Function parameter or member 'flags' not described in '__cgroup_bpf_attach' kernel/bpf/cgroup.c:367: warning: Function parameter or member 'unused_flags' not described in '__cgroup_bpf_detach' Add a kerneldoc line for 'flags'. Fixing the warning for 'unused_flags' is best approached by removing the unused parameter on the function call. Signed-off-by: Valdis Kletnieks diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index 588dd5f0bd85..695b2a880d9a 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h @@ -78,7 +78,7 @@ int cgroup_bpf_inherit(struct cgroup *cgrp); int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, enum bpf_attach_type type, u32 flags); int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, - enum bpf_attach_type type, u32 flags); + enum bpf_attach_type type); int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, union bpf_attr __user *uattr); diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index ab612fe9862f..d78cfec5807d 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -230,6 +230,7 @@ static int update_effective_progs(struct cgroup *cgrp, * @cgrp: The cgroup which descendants to traverse * @prog: A program to attach * @type: Type of attach operation + * @flags: Option flags * * Must be called with cgroup_mutex held. */ @@ -363,7 +364,7 @@ int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, * Must be called with cgroup_mutex held. */ int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, - enum bpf_attach_type type, u32 unused_flags) + enum bpf_attach_type type) { struct list_head *progs = >bpf.progs[type]; enum bpf_cgroup_storage_type stype; diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 6d03a27918f4..9802ab424397 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6059,7 +6059,7 @@ int cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, int ret; mutex_lock(_mutex); - ret = __cgroup_bpf_detach(cgrp, prog, type, flags); + ret = __cgroup_bpf_detach(cgrp, prog, type); mutex_unlock(_mutex); return ret; }
[PATCH] include/linux/bpf.h - fix missing prototype warnings...
Compiling with W=1 generates warnings: CC kernel/bpf/core.o kernel/bpf/core.c:721:12: warning: no previous prototype for ?bpf_jit_alloc_exec_limit? [-Wmissing-prototypes] 721 | u64 __weak bpf_jit_alloc_exec_limit(void) |^~~~ kernel/bpf/core.c:757:14: warning: no previous prototype for ?bpf_jit_alloc_exec? [-Wmissing-prototypes] 757 | void *__weak bpf_jit_alloc_exec(unsigned long size) | ^~ kernel/bpf/core.c:762:13: warning: no previous prototype for ?bpf_jit_free_exec? [-Wmissing-prototypes] 762 | void __weak bpf_jit_free_exec(void *addr) | ^ All three are weak functions that archs can override, although none do so currently. Provide prototypes for when a new arch provides its own. Signed-off-by: Valdis Kletnieks diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 3851529062ec..99e55313123f 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -472,6 +472,10 @@ _out: \ #define BPF_PROG_RUN_ARRAY_CHECK(array, ctx, func) \ __BPF_PROG_RUN_ARRAY(array, ctx, func, true) +u64 __weak bpf_jit_alloc_exec_limit(void); +void *__weak bpf_jit_alloc_exec(unsigned long size); +void __weak bpf_jit_free_exec(void *addr); + #ifdef CONFIG_BPF_SYSCALL DECLARE_PER_CPU(int, bpf_prog_active);
[PATCH] kernel/bpf/core.c - fix bitrotted kerneldoc.
Over the years, the function signature has changed, the kerneldoc block hasn't. Signed-off-by: Valdis Kletnieks diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 2a81b8af3748..2728b6247091 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -1216,8 +1216,9 @@ bool bpf_opcode_in_insntable(u8 code) #ifndef CONFIG_BPF_JIT_ALWAYS_ON /** * __bpf_prog_run - run eBPF program on a given context - * @ctx: is the data we are operating on + * @regs: is the array of MAX_BPF_EXT_REG eBPF pseudo-registers * @insn: is the array of eBPF instructions + * @stack: is the eBPF storage stack * * Decode and execute eBPF instructions. */
Re: [PATCH] bpf/core.c - silence warning messages
On Tue, 29 Jan 2019 00:22:26 +0100, Daniel Borkmann said: > I think moving in separate file would be overkill, imho. However, lets get > the kdoc and prototype warning fixed. I have a bunch of spare time at the moment, so the kdoc and prototype warnings are on my to-do list.
Re: [PATCH] bpf/core.c - silence warning messages
On Mon, 28 Jan 2019 09:18:45 -0800, Song Liu said: > On Sun, Jan 27, 2019 at 8:43 PM wrote: > > The attached patch silences the warnings, because we *know* we're > > overwriting > > the default initializer. That leaves bpf/core.c with only 6 other warnings, > > which become more visible in comparison. > > My concern is that this will also mute the warning for other parts of > bpf/core.c. I checked and there weren't any warnings for other parts of the file. Also, this message doesn't even happen unless you build with W=1, which apparently happens so rarely that nobody else has submitted a patch. Is there a high likelihood that another overwrite of an initializer is going to be included in the source? > Maybe we should move bpf_opcode_in_insntable() to a separate file, and mute > warning for that file? Seems to be overkill - the intent of this patch was mostly to make the *other* warnings issued with W=1 more noticable.
Re: next-20190125 - objtool complains about dumpstack
On Sun, 27 Jan 2019 22:18:25 -0600, Josh Poimboeuf said: > On Sun, Jan 27, 2019 at 10:45:03PM -0500, valdis.kletni...@vt.edu wrote: > > Seen in a build: > > > > CC arch/x86/kernel/dumpstack.o > > arch/x86/kernel/dumpstack.o: warning: objtool: oops_begin()+0x9: undefined > > stack state > > arch/x86/kernel/dumpstack.o: warning: objtool: oops_begin()+0x0: stack > > state mismatch: cfa1=6+16 cfa2=7+8 > > > > Probably a gcc9 code generation that objtool doesn't know about? > > Can you share the .o file? Sure. Attached. ELF > @ @ ) ( èUHåATAÔSHû1ÿè¾ ¿ Çè-uÆ Sè¾ HÇÇèE äu[A\]Ãe© ÿ = DçèD èUHåAVAUATSèA]úè1öHÇÇAÄ Û@Æ1É1Òè Û Øº ð±Ã@ÆHÇÇ1É1Ò@¶öèD¶ó1ɺ DöHÇÇè1ɺ DöHÇÇèÛt8D% Àt Ç ¿ èLè[A\A]A^]ÃD9%t¿E1öº Dðð±@ÆÃHÇÇ1É1Ò@¶öAÆèÛu51ɺ ¾ HÇÇè1ɺ ¾ HÇÇèéUÿÿÿ1É1öº HÇÇè1ö1ɺ HÇÇèDöHÇÇèéÿÿÿfèUHåAUIõATIüSHÓI è I9Är.H @ L9âv"HC¸ Ç HSHÇC[A\A]]Ã[1ÀA\A]]ÃfD èUHåATIüSHóèÇèH H I9Ôr%L9àv HC¸ Ç HSHÇC[A\]Ã[1ÀA\]Ã@ èUHåAUIõATSHûHìHeH%( HEà1ÀH ö L`ÖuH} º@ LæèH À éH»Àïÿÿÿ 1öHÇÇI9Ü@Æ1É1ÒèI9Üë³ èUHåAUIõATIüI$ LîHÇÇA$ èLîLçèA\A]]Ãff. fèUHåSHûHßHÇÆèH HÇÇH H³ è[]ÃèUHåAUIõATIüM ät0M íueH%I9ÄuIíLêLçHÇÁ1öèA\A]]ÃeL$%ëÅff. fèUHåATIüHÇÇè1öLçAö$ @ÆÆèAö$ A\]Ãf èUHåAVIÖAUIýATIôS Û º¨ LæHÇÇèéèUHåAWI×AVIþAUATIôèLúLæL÷IÅèLæLïøÒâ èA\A]A^A_]à Fatal exception in interrupt Fatal exception %sCode: Bad RIP value. %sCode: %42ph <%02x> %21ph %sRIP: %04x:%pS d ? %sCall Trace: %s <%s> %s %s%pB %s PTI NOPTI SMP PREEMPT d%s: %04lx [#%d]%s%s%s%s%s arch/x86/include/asm/atomic.h HÇÇèHÇÇèLîHÇÇèHEàeH3%( u(HÄH[A\A]]öMÊLEËLîHÇÇHU èëÉèèUHåATIôSHû; t.HSHKL9âw!L9ávI$¨ H9ÁrH9Âs 1öLçè[A\]ÃèUHåAWAVIÎAUIõATIüSHÓHì¨ eH%( HEÐ1Àè1À¹ LöH½xÿÿÿHÇ Pÿÿÿó«¹ Ç LÿÿÿH½Xÿÿÿó«HÇÇèH ÛHÙu'M ít I ëeH%I9ÄHétI$X&