* [PATCH 1/1] qnx6fs: Fix Sparse warning and use unlikely at some points
@ 2012-04-08 11:22 Kai Bankett
0 siblings, 0 replies; only message in thread
From: Kai Bankett @ 2012-04-08 11:22 UTC (permalink / raw)
To: Al Viro; +Cc: linux-fsdevel
- fixed a Sparse warning (patch received from Dan Carpenter)
- make use of unlikely() at some places
Signed-off-by: Kai Bankett<chaosman@ontika.net>
---
fs/qnx6/README | 1 +
fs/qnx6/dir.c | 14 +++++++-------
fs/qnx6/inode.c | 10 +++++-----
fs/qnx6/namei.c | 4 ++--
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/fs/qnx6/README b/fs/qnx6/README
index 116d622..fbd910b 100644
--- a/fs/qnx6/README
+++ b/fs/qnx6/README
@@ -4,5 +4,6 @@
Credits :
+Dan Carpenter <dan.carpenter@oracle.com> (__force to silence a Sparse warning)
Al Viro <viro@ZenIV.linux.org.uk> (endless patience with me& support ;))
Kai Bankett <chaosman@ontika.net> (Maintainer)
diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c
index dc59735..faa0afe 100644
--- a/fs/qnx6/dir.c
+++ b/fs/qnx6/dir.c
@@ -57,7 +57,7 @@ static struct qnx6_long_filename *qnx6_longname(struct super_block *sb,
u32 offs = (s<< sb->s_blocksize_bits)& ~PAGE_CACHE_MASK;
struct address_space *mapping = sbi->longfile->i_mapping;
struct page *page = read_mapping_page(mapping, n, NULL);
- if (IS_ERR(page))
+ if (unlikely(IS_ERR(page)))
return ERR_CAST(page);
kmap(*p = page);
return (struct qnx6_long_filename *)(page_address(page) + offs);
@@ -74,7 +74,7 @@ static int qnx6_dir_longfilename(struct inode *inode,
struct page *page;
int lf_size;
- if (de->de_size != 0xff) {
+ if (unlikely(de->de_size != 0xff)) {
/* error - long filename entries always have size 0xff
in direntry */
printk(KERN_ERR "qnx6: invalid direntry size (%i).\n",
@@ -82,14 +82,14 @@ static int qnx6_dir_longfilename(struct inode *inode,
return 0;
}
lf = qnx6_longname(s, de,&page);
- if (IS_ERR(lf)) {
+ if (unlikely(IS_ERR(lf))) {
printk(KERN_ERR "qnx6:Error reading longname\n");
return 0;
}
lf_size = fs16_to_cpu(sbi, lf->lf_size);
- if (lf_size> QNX6_LONG_NAME_MAX) {
+ if (unlikely(lf_size> QNX6_LONG_NAME_MAX)) {
QNX6DEBUG((KERN_INFO "file %s\n", lf->lf_fname));
printk(KERN_ERR "qnx6:Filename too long (%i)\n", lf_size);
qnx6_put_page(page);
@@ -135,7 +135,7 @@ static int qnx6_readdir(struct file *filp, void *dirent, filldir_t filldir)
struct qnx6_dir_entry *de;
int i = start;
- if (IS_ERR(page)) {
+ if (unlikely(IS_ERR(page))) {
printk(KERN_ERR "qnx6_readdir: read failed\n");
filp->f_pos = (n + 1)<< PAGE_CACHE_SHIFT;
return PTR_ERR(page);
@@ -189,7 +189,7 @@ static unsigned qnx6_long_match(int len, const char *name,
int thislen;
struct qnx6_long_filename *lf = qnx6_longname(s, de,&page);
- if (IS_ERR(lf))
+ if (unlikely(IS_ERR(lf)))
return 0;
thislen = fs16_to_cpu(sbi, lf->lf_size);
@@ -241,7 +241,7 @@ unsigned qnx6_find_entry(int len, struct inode *dir, const char *name,
do {
page = qnx6_get_page(dir, n);
- if (!IS_ERR(page)) {
+ if (likely(!IS_ERR(page))) {
int limit = last_entry(dir, n);
int i;
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index e44012d..56d0810 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -85,7 +85,7 @@ static int qnx6_get_block(struct inode *inode, sector_t iblock,
static int qnx6_check_blockptr(__fs32 ptr)
{
- if (ptr == ~(__fs32)0) {
+ if (ptr == ~(__force __fs32)0) {
printk(KERN_ERR "qnx6: hit unused blockpointer.\n");
return 0;
}
@@ -135,7 +135,7 @@ static unsigned qnx6_block_map(struct inode *inode, unsigned no)
for (i = 0; i< depth; i++) {
bh = sb_bread(s, block);
- if (!bh) {
+ if (unlikely(!bh)) {
printk(KERN_ERR "qnx6:Error reading block (%u)\n",
block);
return 0;
@@ -553,7 +553,7 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino)
inode->i_mode = 0;
- if (ino == 0) {
+ if (unlikely(ino == 0)) {
printk(KERN_ERR "qnx6: bad inode number on dev %s: %u is "
"out of range\n",
sb->s_id, ino);
@@ -564,7 +564,7 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino)
offs = (ino - 1)& (~PAGE_CACHE_MASK>> QNX6_INODE_SIZE_BITS);
mapping = sbi->inodes->i_mapping;
page = read_mapping_page(mapping, n, NULL);
- if (IS_ERR(page)) {
+ if (unlikely(IS_ERR(page))) {
printk(KERN_ERR "qnx6: major problem: unable to read inode from "
"dev %s\n", sb->s_id);
iget_failed(inode);
@@ -614,7 +614,7 @@ static struct inode *qnx6_alloc_inode(struct super_block *sb)
{
struct qnx6_inode_info *ei;
ei = kmem_cache_alloc(qnx6_inode_cachep, GFP_KERNEL);
- if (!ei)
+ if (unlikely(!ei))
return NULL;
return&ei->vfs_inode;
}
diff --git a/fs/qnx6/namei.c b/fs/qnx6/namei.c
index 8a97289..97af200 100644
--- a/fs/qnx6/namei.c
+++ b/fs/qnx6/namei.c
@@ -21,14 +21,14 @@ struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry,
const char *name = dentry->d_name.name;
int len = dentry->d_name.len;
- if (len> QNX6_LONG_NAME_MAX)
+ if (unlikely(len> QNX6_LONG_NAME_MAX))
return ERR_PTR(-ENAMETOOLONG);
ino = qnx6_find_entry(len, dir, name,&page);
if (ino) {
foundinode = qnx6_iget(dir->i_sb, ino);
qnx6_put_page(page);
- if (IS_ERR(foundinode)) {
+ if (unlikely(IS_ERR(foundinode))) {
QNX6DEBUG((KERN_ERR "qnx6: lookup->iget -> "
" error %ld\n", PTR_ERR(foundinode)));
return ERR_CAST(foundinode);
-- 1.7.9.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-04-08 9:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-08 11:22 [PATCH 1/1] qnx6fs: Fix Sparse warning and use unlikely at some points Kai Bankett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).