mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Namjae Jeon <linkinjeon@gmail.com>
Cc: akpm@linux-foundation.org, bfields@fieldses.org,
	viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org,
	Namjae Jeon <namjae.jeon@samsung.com>,
	Ravishankar N <ravi.n1@samsung.com>,
	Amit Sahrawat <a.sahrawat@samsung.com>
Subject: Re: [PATCH v3 3/5] fat (exportfs): rebuild inode if ilookup() fails
Date: Sat, 22 Sep 2012 20:41:58 +0900	[thread overview]
Message-ID: <87haqq8et5.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <1347798163-2697-1-git-send-email-linkinjeon@gmail.com> (Namjae Jeon's message of "Sun, 16 Sep 2012 08:22:42 -0400")

Namjae Jeon <linkinjeon@gmail.com> writes:

> +	if (inode == NULL && MSDOS_SB(sb)->options.nfs == FAT_NFS_LIMITED) {
> +		struct buffer_head *bh = NULL;
> +		struct msdos_dir_entry *de ;
> +		loff_t i_pos = (loff_t)ino;
> +		int bits = MSDOS_SB(sb)->dir_per_block_bits;
> +		loff_t blocknr = i_pos >> bits;
> +		bh = sb_bread(sb, blocknr);
> +		if (!bh) {
> +			fat_msg(sb, KERN_ERR,
> +				 "unable to read block(%llu) for building NFS inode",
> +				(llu)blocknr);
> +			return inode;
> +		}
> +		de = (struct msdos_dir_entry *)bh->b_data;
> +		/* If a file is deleted on server and client is not updated
> +		 * yet, we must not build the inode upon a lookup call.
> +		 */
> +		if (de[i_pos&((1<<bits)-1)].name[0] == DELETED_FLAG)

IS_FREE() would be better.

> +
> +			inode = NULL;
> +		else
> +			inode = fat_build_inode(sb, &de[i_pos&((1<<bits)-1)],
> +					i_pos);
> +		brelse(bh);
> +	}
>  
>  	return inode;
>  }

1 << bits == sbi->dir_per_block

It would be better to add helper to decode i_pos to blocknr and offset.
And it should be shared on fat_write_inode and this.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2012-09-22 11:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-16 12:22 Namjae Jeon
2012-09-22 11:41 ` OGAWA Hirofumi [this message]
2012-09-24  4:13   ` Namjae Jeon

Reply instructions:

You may reply publicly 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=87haqq8et5.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=a.sahrawat@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=linkinjeon@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    --cc=ravi.n1@samsung.com \
    --cc=viro@zeniv.linux.org.uk \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®