lkml.org 
[lkml]   [2012]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 3/5] fat (exportfs): rebuild inode if ilookup() fails
From
2012/9/22, OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>:
> 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.
Okay~ I will change.
>
>> +
>> + 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.
Okay, I will change.

Thanks.
> --
> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
>


\
 
 \ /
  Last update: 2012-09-24 07:01    [W:0.051 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site