Linux-EROFS Archive on lore.kernel.org
 help / color / Atom feed
From: Gao Xiang <gaoxiang25@huawei.com>
To: Pratik Shinde <pratikshinde320@gmail.com>
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH] erofs: using switch-case while checking the inode type.
Date: Fri, 30 Aug 2019 22:22:33 +0800
Message-ID: <20190830142233.GA241393@architecture4> (raw)
In-Reply-To: <20190830115947.GA10981@hsiangkao-HP-ZHAN-66-Pro-G1>

On Fri, Aug 30, 2019 at 07:59:48PM +0800, Gao Xiang wrote:
> Hi Pratik,
> 
> The subject line could be better as '[PATCH v2] xxxxxx'...
> 
> On Fri, Aug 30, 2019 at 03:26:15PM +0530, Pratik Shinde wrote:
> > while filling the linux inode, using switch-case statement to check
> > the type of inode.
> > switch-case statement looks more clean here.
> > 
> > Signed-off-by: Pratik Shinde <pratikshinde320@gmail.com>
> 
> I have no problem of this patch, and I will do a test and reply
> you "Reviewed-by:" in hours (I'm doing another patchset to resolve
> what Christoph suggested again)...

Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>

Thanks,
Gao Xiang

> 
> Thanks,
> Gao Xiang
> 
> > ---
> >  fs/erofs/inode.c | 18 ++++++++++++------
> >  1 file changed, 12 insertions(+), 6 deletions(-)
> > 
> > diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
> > index 80f4fe9..6336cc1 100644
> > --- a/fs/erofs/inode.c
> > +++ b/fs/erofs/inode.c
> > @@ -190,22 +190,28 @@ static int fill_inode(struct inode *inode, int isdir)
> >  	err = read_inode(inode, data + ofs);
> >  	if (!err) {
> >  		/* setup the new inode */
> > -		if (S_ISREG(inode->i_mode)) {
> > +		switch (inode->i_mode & S_IFMT) {
> > +		case S_IFREG:
> >  			inode->i_op = &erofs_generic_iops;
> >  			inode->i_fop = &generic_ro_fops;
> > -		} else if (S_ISDIR(inode->i_mode)) {
> > +			break;
> > +		case S_IFDIR:
> >  			inode->i_op = &erofs_dir_iops;
> >  			inode->i_fop = &erofs_dir_fops;
> > -		} else if (S_ISLNK(inode->i_mode)) {
> > +			break;
> > +		case S_IFLNK:
> >  			/* by default, page_get_link is used for symlink */
> >  			inode->i_op = &erofs_symlink_iops;
> >  			inode_nohighmem(inode);
> > -		} else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
> > -			S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
> > +			break;
> > +		case S_IFCHR:
> > +		case S_IFBLK:
> > +		case S_IFIFO:
> > +		case S_IFSOCK:
> >  			inode->i_op = &erofs_generic_iops;
> >  			init_special_inode(inode, inode->i_mode, inode->i_rdev);
> >  			goto out_unlock;
> > -		} else {
> > +		default:
> >  			err = -EFSCORRUPTED;
> >  			goto out_unlock;
> >  		}
> > -- 
> > 2.9.3
> > 
> > _______________________________________________
> > devel mailing list
> > devel@linuxdriverproject.org
> > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30  9:56 Pratik Shinde
2019-08-30 11:59 ` Gao Xiang via Linux-erofs
2019-08-30 14:22   ` Gao Xiang [this message]
2019-09-04  2:12     ` Gao Xiang
2019-09-04  6:31       ` Greg KH
2019-09-04  7:38         ` Gao Xiang

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190830142233.GA241393@architecture4 \
    --to=gaoxiang25@huawei.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=pratikshinde320@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-EROFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-erofs/0 linux-erofs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-erofs linux-erofs/ https://lore.kernel.org/linux-erofs \
		linux-erofs@lists.ozlabs.org linux-erofs@ozlabs.org
	public-inbox-index linux-erofs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linux-erofs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git