[PATCH 2/3] fat: add missing blank lines

From: Carlos Palminha
Date: Fri Jul 14 2017 - 19:07:11 EST


add missing blank lines after declarations, based on checkpatch.

Signed-off-by: Carlos Palminha <palminha@xxxxxxxxxxxx>
---
fs/fat/cache.c | 1 +
fs/fat/dir.c | 5 +++++
fs/fat/fatent.c | 8 ++++++++
fs/fat/file.c | 2 ++
fs/fat/inode.c | 12 ++++++++++++
fs/fat/misc.c | 2 ++
fs/fat/namei_msdos.c | 1 +
fs/fat/namei_vfat.c | 4 ++++
fs/fat/nfs.c | 3 +++
9 files changed, 38 insertions(+)

diff --git a/fs/fat/cache.c b/fs/fat/cache.c
index 5d384921524d..470b4831079e 100644
--- a/fs/fat/cache.c
+++ b/fs/fat/cache.c
@@ -166,6 +166,7 @@ static void fat_cache_add(struct inode *inode, struct fat_cache_id *new)
cache = tmp;
} else {
struct list_head *p = MSDOS_I(inode)->cache_lru.prev;
+
cache = list_entry(p, struct fat_cache, cache_list);
}
cache->fcluster = new->fcluster;
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 85269ee2bbd1..9fd16240a0fa 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -182,6 +182,7 @@ static inline int fat_uni_to_x8(struct super_block *sb, const wchar_t *uni,
unsigned char *buf, int size)
{
struct msdos_sb_info *sbi = MSDOS_SB(sb);
+
if (sbi->options.utf8)
return utf16s_to_utf8s(uni, FAT_MAX_UNI_CHARS,
UTF16_HOST_ENDIAN, buf, size);
@@ -430,6 +431,7 @@ static int fat_parse_short(struct super_block *sb,
uni_len = j;
if (isvfat) {
int offset = min(chl, MSDOS_NAME-k);
+
k += offset;
i += offset;
} else {
@@ -668,6 +670,7 @@ static int __fat_readdir(struct inode *inode, struct file *file,
unsigned long inum;
loff_t i_pos = fat_make_i_pos(sb, bh, de);
struct inode *tmp = fat_iget(sb, i_pos);
+
if (tmp) {
inum = tmp->i_ino;
iput(tmp);
@@ -1337,6 +1340,7 @@ int fat_add_entries(struct inode *dir, void *slots, int nr_slots,
/* Fill the long name slots. */
for (i = 0; i < long_bhs; i++) {
int copy = min_t(int, sb->s_blocksize - offset, size);
+
memcpy(bhs[i]->b_data + offset, slots, copy);
mark_buffer_dirty_inode(bhs[i], dir);
offset = 0;
@@ -1348,6 +1352,7 @@ int fat_add_entries(struct inode *dir, void *slots, int nr_slots,
if (!err && i < nr_bhs) {
/* Fill the short name slot. */
int copy = min_t(int, sb->s_blocksize - offset, size);
+
memcpy(bhs[i]->b_data + offset, slots, copy);
mark_buffer_dirty_inode(bhs[i], dir);
if (IS_DIRSYNC(dir))
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index 1d9a8c4e9de0..42868576eb43 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -23,6 +23,7 @@ static void fat12_ent_blocknr(struct super_block *sb, int entry,
{
struct msdos_sb_info *sbi = MSDOS_SB(sb);
int bytes = entry + (entry >> 1);
+
WARN_ON(entry < FAT_START_ENT || sbi->max_cluster <= entry);
*offset = bytes & (sb->s_blocksize - 1);
*blocknr = sbi->fat_start + (bytes >> sb->s_blocksize_bits);
@@ -33,6 +34,7 @@ static void fat_ent_blocknr(struct super_block *sb, int entry,
{
struct msdos_sb_info *sbi = MSDOS_SB(sb);
int bytes = (entry << sbi->fatent_shift);
+
WARN_ON(entry < FAT_START_ENT || sbi->max_cluster <= entry);
*offset = bytes & (sb->s_blocksize - 1);
*blocknr = sbi->fat_start + (bytes >> sb->s_blocksize_bits);
@@ -41,6 +43,7 @@ static void fat_ent_blocknr(struct super_block *sb, int entry,
static void fat12_ent_set_ptr(struct fat_entry *fatent, int offset)
{
struct buffer_head **bhs = fatent->bhs;
+
if (fatent->nr_bhs == 1) {
WARN_ON(offset >= (bhs[0]->b_size - 1));
fatent->u.ent12_p[0] = bhs[0]->b_data + offset;
@@ -135,6 +138,7 @@ static int fat12_ent_get(struct fat_entry *fatent)
static int fat16_ent_get(struct fat_entry *fatent)
{
int next = le16_to_cpu(*fatent->u.ent16_p);
+
WARN_ON((unsigned long)fatent->u.ent16_p & (2 - 1));
if (next >= BAD_FAT16)
next = FAT_ENT_EOF;
@@ -144,6 +148,7 @@ static int fat16_ent_get(struct fat_entry *fatent)
static int fat32_ent_get(struct fat_entry *fatent)
{
int next = le32_to_cpu(*fatent->u.ent32_p) & 0x0fffffff;
+
WARN_ON((unsigned long)fatent->u.ent32_p & (4 - 1));
if (next >= BAD_FAT32)
next = FAT_ENT_EOF;
@@ -225,6 +230,7 @@ static int fat12_ent_next(struct fat_entry *fatent)
static int fat16_ent_next(struct fat_entry *fatent)
{
const struct buffer_head *bh = fatent->bhs[0];
+
fatent->entry++;
if (fatent->u.ent16_p < (__le16 *)(bh->b_data + (bh->b_size - 2))) {
fatent->u.ent16_p++;
@@ -237,6 +243,7 @@ static int fat16_ent_next(struct fat_entry *fatent)
static int fat32_ent_next(struct fat_entry *fatent)
{
const struct buffer_head *bh = fatent->bhs[0];
+
fatent->entry++;
if (fatent->u.ent32_p < (__le32 *)(bh->b_data + (bh->b_size - 4))) {
fatent->u.ent32_p++;
@@ -669,6 +676,7 @@ int fat_count_free_clusters(struct super_block *sb)
/* readahead of fat blocks */
if ((cur_block & reada_mask) == 0) {
unsigned long rest = sbi->fat_length - cur_block;
+
fat_ent_reada(sb, &fatent, min(reada_blocks, rest));
}
cur_block++;
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 4724cc9ad650..f08fa69b8d65 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -118,6 +118,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
static int fat_ioctl_get_volume_id(struct inode *inode, u32 __user *user_attr)
{
struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+
return put_user(sbi->vol_id, user_attr);
}

@@ -369,6 +370,7 @@ int fat_getattr(const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int flags)
{
struct inode *inode = d_inode(path->dentry);
+
generic_fillattr(inode, stat);
stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size;

diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index a2c05f2ada6d..8d65174b7d75 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -233,6 +233,7 @@ static int fat_write_end(struct file *file, struct address_space *mapping,
{
struct inode *inode = mapping->host;
int err;
+
err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata);
if (err < len)
fat_write_failed(mapping, pos + len);
@@ -408,6 +409,7 @@ void fat_attach(struct inode *inode, loff_t i_pos)
*/
if (S_ISDIR(inode->i_mode) && sbi->options.nfs) {
struct hlist_head *d_head = sbi->dir_hashtable;
+
d_head += fat_dir_hash(MSDOS_I(inode)->i_logstart);

spin_lock(&sbi->dir_hash_lock);
@@ -420,6 +422,7 @@ EXPORT_SYMBOL_GPL(fat_attach);
void fat_detach(struct inode *inode)
{
struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
+
spin_lock(&sbi->inode_hash_lock);
MSDOS_I(inode)->i_pos = 0;
hlist_del_init(&MSDOS_I(inode)->i_fat_hash);
@@ -699,6 +702,7 @@ static void fat_set_state(struct super_block *sb,
static void delayed_free(struct rcu_head *p)
{
struct msdos_sb_info *sbi = container_of(p, struct msdos_sb_info, rcu);
+
unload_nls(sbi->nls_disk);
unload_nls(sbi->nls_io);
if (sbi->options.iocharset != fat_default_iocharset)
@@ -723,6 +727,7 @@ static struct kmem_cache *fat_inode_cachep;
static struct inode *fat_alloc_inode(struct super_block *sb)
{
struct msdos_inode_info *ei;
+
ei = kmem_cache_alloc(fat_inode_cachep, GFP_NOFS);
if (!ei)
return NULL;
@@ -734,6 +739,7 @@ static struct inode *fat_alloc_inode(struct super_block *sb)
static void fat_i_callback(struct rcu_head *head)
{
struct inode *inode = container_of(head, struct inode, i_rcu);
+
kmem_cache_free(fat_inode_cachep, MSDOS_I(inode));
}

@@ -805,6 +811,7 @@ static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
/* If the count of free cluster is still unknown, counts it here. */
if (sbi->free_clusters == -1 || !sbi->free_clus_valid) {
int err = fat_count_free_clusters(dentry->d_sb);
+
if (err)
return err;
}
@@ -1142,6 +1149,7 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat,

while ((p = strsep(&options, ",")) != NULL) {
int token;
+
if (!*p)
continue;

@@ -1411,6 +1419,7 @@ static unsigned long calc_fat_clusters(struct super_block *sb)
/* Divide first to avoid overflow */
if (sbi->fat_bits != 12) {
unsigned long ent_per_sec = sb->s_blocksize * 8 / sbi->fat_bits;
+
return ent_per_sec * sbi->fat_length;
}

@@ -1845,6 +1854,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,

if (sbi->options.discard) {
struct request_queue *q = bdev_get_queue(sb->s_bdev);
+
if (!blk_queue_discard(q))
fat_msg(sb, KERN_WARNING,
"mounting with \"discard\" option, but "
@@ -1907,6 +1917,7 @@ static int writeback_inode(struct inode *inode)
int fat_flush_inodes(struct super_block *sb, struct inode *i1, struct inode *i2)
{
int ret = 0;
+
if (!MSDOS_SB(sb)->options.flush)
return 0;
if (i1)
@@ -1915,6 +1926,7 @@ int fat_flush_inodes(struct super_block *sb, struct inode *i1, struct inode *i2)
ret = writeback_inode(i2);
if (!ret) {
struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
+
ret = filemap_flush(mapping);
}
return ret;
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 8a8698119ff7..ee91c1ceb186 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -125,6 +125,7 @@ int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster)
ret = fat_ent_read(inode, &fatent, last);
if (ret >= 0) {
int wait = inode_needs_sync(inode);
+
ret = fat_ent_write(inode, &fatent, new_dclus, wait);
fatent_brelse(&fatent);
}
@@ -228,6 +229,7 @@ void fat_time_unix2fat(struct msdos_sb_info *sbi, struct timespec *ts,
__le16 *time, __le16 *date, u8 *time_cs)
{
struct tm tm;
+
time_to_tm(ts->tv_sec,
(sbi->options.tz_set ? sbi->options.time_offset :
-sys_tz.tz_minuteswest) * SECS_PER_MIN, &tm);
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index 7d6a105d601b..9c3cdbab689d 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -582,6 +582,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
* shouldn't be serious corruption.
*/
int err2 = fat_remove_entries(new_dir, &sinfo);
+
if (corrupt)
corrupt |= err2;
sinfo.bh = NULL;
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 0d7b49dcff12..2c2b40abefc0 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -43,6 +43,7 @@ static inline void vfat_d_version_set(struct dentry *dentry,
static int vfat_revalidate_shortname(struct dentry *dentry)
{
int ret = 1;
+
spin_lock(&dentry->d_lock);
if (vfat_d_version(dentry) != d_inode(dentry->d_parent)->i_version)
ret = 0;
@@ -234,6 +235,7 @@ static int vfat_find_form(struct inode *dir, unsigned char *name)
{
struct fat_slot_info sinfo;
int err = fat_scan(dir, name, &sinfo);
+
if (err)
return -ENOENT;
brelse(sinfo.bh);
@@ -703,6 +705,7 @@ static int vfat_find(struct inode *dir, const struct qstr *qname,
struct fat_slot_info *sinfo)
{
unsigned int len = vfat_striptail_len(qname);
+
if (len == 0)
return -ENOENT;
return fat_search_long(dir, qname->name, len, sinfo);
@@ -1033,6 +1036,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
* shouldn't be serious corruption.
*/
int err2 = fat_remove_entries(new_dir, &sinfo);
+
if (corrupt)
corrupt |= err2;
sinfo.bh = NULL;
diff --git a/fs/fat/nfs.c b/fs/fat/nfs.c
index 30dfc5da29db..9c411cc6ec12 100644
--- a/fs/fat/nfs.c
+++ b/fs/fat/nfs.c
@@ -76,6 +76,7 @@ static struct inode *__fat_nfs_get_inode(struct super_block *sb,
struct msdos_dir_entry *de;
sector_t blocknr;
int offset;
+
fat_get_blknr_offset(MSDOS_SB(sb), i_pos, &blocknr, &offset);
bh = sb_bread(sb, blocknr);
if (!bh) {
@@ -230,6 +231,7 @@ struct inode *fat_rebuild_parent(struct super_block *sb, int parent_logstart)
struct msdos_sb_info *sbi = MSDOS_SB(sb);
sector_t blknr = fat_clus_to_blknr(sbi, parent_logstart);
struct buffer_head *parent_bh = sb_bread(sb, blknr);
+
if (!parent_bh) {
fat_msg(sb, KERN_ERR,
"unable to read cluster of parent directory");
@@ -278,6 +280,7 @@ static struct dentry *fat_get_parent(struct dentry *child_dir)

if (!fat_get_dotdot_entry(d_inode(child_dir), &bh, &de)) {
int parent_logstart = fat_get_start(sbi, de);
+
parent_inode = fat_dget(sb, parent_logstart);
if (!parent_inode && sbi->options.nfs == FAT_NFS_NOSTALE_RO)
parent_inode = fat_rebuild_parent(sb, parent_logstart);
--
2.11.0