Lines Matching refs:inode
12 * if inode is successfully read, return its inode page (or sometimes
13 * the inode payload page if it's an extended inode) in order to fill
16 static struct page *erofs_read_inode(struct inode *inode,
19 struct super_block *sb = inode->i_sb;
21 struct erofs_inode *vi = EROFS_I(inode);
34 erofs_dbg("%s, reading inode nid %llu at %u of blkaddr %u",
39 erofs_err(sb, "failed to get inode (nid: %llu) page, err %ld",
48 erofs_err(inode->i_sb, "unsupported i_format %u of nid %llu",
56 erofs_err(inode->i_sb, "unsupported datalayout %u of nid %llu",
65 /* check if the inode acrosses page boundary */
83 erofs_err(sb, "failed to get inode payload page (nid: %llu), err %ld",
94 inode->i_mode = le16_to_cpu(die->i_mode);
95 switch (inode->i_mode & S_IFMT) {
103 inode->i_rdev =
108 inode->i_rdev = 0;
113 i_uid_write(inode, le32_to_cpu(die->i_uid));
114 i_gid_write(inode, le32_to_cpu(die->i_gid));
115 set_nlink(inode, le32_to_cpu(die->i_nlink));
117 /* extended inode has its own timestamp */
118 inode->i_ctime.tv_sec = le64_to_cpu(die->i_ctime);
119 inode->i_ctime.tv_nsec = le32_to_cpu(die->i_ctime_nsec);
121 inode->i_size = le64_to_cpu(die->i_size);
134 inode->i_mode = le16_to_cpu(dic->i_mode);
135 switch (inode->i_mode & S_IFMT) {
143 inode->i_rdev =
148 inode->i_rdev = 0;
153 i_uid_write(inode, le16_to_cpu(dic->i_uid));
154 i_gid_write(inode, le16_to_cpu(dic->i_gid));
155 set_nlink(inode, le16_to_cpu(dic->i_nlink));
158 inode->i_ctime.tv_sec = sbi->build_time;
159 inode->i_ctime.tv_nsec = sbi->build_time_nsec;
161 inode->i_size = le32_to_cpu(dic->i_size);
166 erofs_err(inode->i_sb,
167 "unsupported on-disk inode version %u of nid %llu",
173 inode->i_mtime.tv_sec = inode->i_ctime.tv_sec;
174 inode->i_atime.tv_sec = inode->i_ctime.tv_sec;
175 inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec;
176 inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec;
179 /* measure inode.i_blocks as generic filesystems */
180 inode->i_blocks = roundup(inode->i_size, EROFS_BLKSIZ) >> 9;
182 inode->i_blocks = nblks << LOG_SECTORS_PER_BLOCK;
186 erofs_err(inode->i_sb, "bogus i_mode (%o) @ nid %llu",
187 inode->i_mode, vi->nid);
197 static int erofs_fill_symlink(struct inode *inode, void *data,
200 struct erofs_inode *vi = EROFS_I(inode);
205 inode->i_size >= PAGE_SIZE) {
206 inode->i_op = &erofs_symlink_iops;
210 lnk = kmalloc(inode->i_size + 1, GFP_KERNEL);
216 if (m_pofs + inode->i_size > PAGE_SIZE) {
218 erofs_err(inode->i_sb,
225 memcpy(lnk, data + m_pofs, inode->i_size);
226 lnk[inode->i_size] = '\0';
228 inode->i_link = lnk;
229 inode->i_op = &erofs_fast_symlink_iops;
233 static int erofs_fill_inode(struct inode *inode, int isdir)
235 struct erofs_inode *vi = EROFS_I(inode);
240 trace_erofs_fill_inode(inode, isdir);
242 /* read inode base data from disk */
243 page = erofs_read_inode(inode, &ofs);
247 /* setup the new inode */
248 switch (inode->i_mode & S_IFMT) {
250 inode->i_op = &erofs_generic_iops;
251 inode->i_fop = &generic_ro_fops;
254 inode->i_op = &erofs_dir_iops;
255 inode->i_fop = &erofs_dir_fops;
258 err = erofs_fill_symlink(inode, page_address(page), ofs);
261 inode_nohighmem(inode);
267 inode->i_op = &erofs_generic_iops;
268 init_special_inode(inode, inode->i_mode, inode->i_rdev);
276 err = z_erofs_fill_inode(inode);
279 inode->i_mapping->a_ops = &erofs_raw_access_aops;
289 * we should do more for 32-bit platform to find the right inode.
291 static int erofs_ilookup_test_actor(struct inode *inode, void *opaque)
295 return EROFS_I(inode)->nid == nid;
298 static int erofs_iget_set_actor(struct inode *inode, void *opaque)
302 inode->i_ino = erofs_inode_hash(nid);
306 static inline struct inode *erofs_iget_locked(struct super_block *sb,
315 struct inode *erofs_iget(struct super_block *sb,
319 struct inode *inode = erofs_iget_locked(sb, nid);
321 if (!inode)
324 if (inode->i_state & I_NEW) {
326 struct erofs_inode *vi = EROFS_I(inode);
330 err = erofs_fill_inode(inode, isdir);
332 unlock_new_inode(inode);
334 iget_failed(inode);
335 inode = ERR_PTR(err);
338 return inode;
344 struct inode *const inode = d_inode(path->dentry);
346 if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout))
353 generic_fillattr(inode, stat);