file.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. /*
  2. * linux/fs/ext4/file.c
  3. *
  4. * Copyright (C) 1992, 1993, 1994, 1995
  5. * Remy Card (card@masi.ibp.fr)
  6. * Laboratoire MASI - Institut Blaise Pascal
  7. * Universite Pierre et Marie Curie (Paris VI)
  8. *
  9. * from
  10. *
  11. * linux/fs/minix/file.c
  12. *
  13. * Copyright (C) 1991, 1992 Linus Torvalds
  14. *
  15. * ext4 fs regular file handling primitives
  16. *
  17. * 64-bit file support on 64-bit platforms by Jakub Jelinek
  18. * (jj@sunsite.ms.mff.cuni.cz)
  19. */
  20. #include <linux/time.h>
  21. #include <linux/fs.h>
  22. #include <linux/mount.h>
  23. #include <linux/path.h>
  24. #include <linux/quotaops.h>
  25. #include <linux/pagevec.h>
  26. #include <linux/uio.h>
  27. #include "ext4.h"
  28. #include "ext4_jbd2.h"
  29. #include "xattr.h"
  30. #include "acl.h"
  31. /*
  32. * Called when an inode is released. Note that this is different
  33. * from ext4_file_open: open gets called at every open, but release
  34. * gets called only when /all/ the files are closed.
  35. */
  36. static int ext4_release_file(struct inode *inode, struct file *filp)
  37. {
  38. if (ext4_test_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE)) {
  39. ext4_alloc_da_blocks(inode);
  40. ext4_clear_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
  41. }
  42. /* if we are the last writer on the inode, drop the block reservation */
  43. if ((filp->f_mode & FMODE_WRITE) &&
  44. (atomic_read(&inode->i_writecount) == 1) &&
  45. !EXT4_I(inode)->i_reserved_data_blocks)
  46. {
  47. down_write(&EXT4_I(inode)->i_data_sem);
  48. ext4_discard_preallocations(inode);
  49. up_write(&EXT4_I(inode)->i_data_sem);
  50. }
  51. if (is_dx(inode) && filp->private_data)
  52. ext4_htree_free_dir_info(filp->private_data);
  53. return 0;
  54. }
  55. static void ext4_unwritten_wait(struct inode *inode)
  56. {
  57. wait_queue_head_t *wq = ext4_ioend_wq(inode);
  58. wait_event(*wq, (atomic_read(&EXT4_I(inode)->i_unwritten) == 0));
  59. }
  60. /*
  61. * This tests whether the IO in question is block-aligned or not.
  62. * Ext4 utilizes unwritten extents when hole-filling during direct IO, and they
  63. * are converted to written only after the IO is complete. Until they are
  64. * mapped, these blocks appear as holes, so dio_zero_block() will assume that
  65. * it needs to zero out portions of the start and/or end block. If 2 AIO
  66. * threads are at work on the same unwritten block, they must be synchronized
  67. * or one thread will zero the other's data, causing corruption.
  68. */
  69. static int
  70. ext4_unaligned_aio(struct inode *inode, struct iov_iter *from, loff_t pos)
  71. {
  72. struct super_block *sb = inode->i_sb;
  73. int blockmask = sb->s_blocksize - 1;
  74. if (pos >= i_size_read(inode))
  75. return 0;
  76. if ((pos | iov_iter_alignment(from)) & blockmask)
  77. return 1;
  78. return 0;
  79. }
  80. static ssize_t
  81. ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
  82. {
  83. struct file *file = iocb->ki_filp;
  84. struct inode *inode = file_inode(iocb->ki_filp);
  85. struct mutex *aio_mutex = NULL;
  86. struct blk_plug plug;
  87. int o_direct = iocb->ki_flags & IOCB_DIRECT;
  88. int overwrite = 0;
  89. ssize_t ret;
  90. /*
  91. * Unaligned direct AIO must be serialized; see comment above
  92. * In the case of O_APPEND, assume that we must always serialize
  93. */
  94. if (o_direct &&
  95. ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS) &&
  96. !is_sync_kiocb(iocb) &&
  97. (iocb->ki_flags & IOCB_APPEND ||
  98. ext4_unaligned_aio(inode, from, iocb->ki_pos))) {
  99. aio_mutex = ext4_aio_mutex(inode);
  100. mutex_lock(aio_mutex);
  101. ext4_unwritten_wait(inode);
  102. }
  103. mutex_lock(&inode->i_mutex);
  104. ret = generic_write_checks(iocb, from);
  105. if (ret <= 0)
  106. goto out;
  107. /*
  108. * If we have encountered a bitmap-format file, the size limit
  109. * is smaller than s_maxbytes, which is for extent-mapped files.
  110. */
  111. if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
  112. struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
  113. if (iocb->ki_pos >= sbi->s_bitmap_maxbytes) {
  114. ret = -EFBIG;
  115. goto out;
  116. }
  117. iov_iter_truncate(from, sbi->s_bitmap_maxbytes - iocb->ki_pos);
  118. }
  119. iocb->private = &overwrite;
  120. if (o_direct) {
  121. size_t length = iov_iter_count(from);
  122. loff_t pos = iocb->ki_pos;
  123. blk_start_plug(&plug);
  124. /* check whether we do a DIO overwrite or not */
  125. if (ext4_should_dioread_nolock(inode) && !aio_mutex &&
  126. !file->f_mapping->nrpages && pos + length <= i_size_read(inode)) {
  127. struct ext4_map_blocks map;
  128. unsigned int blkbits = inode->i_blkbits;
  129. int err, len;
  130. map.m_lblk = pos >> blkbits;
  131. map.m_len = (EXT4_BLOCK_ALIGN(pos + length, blkbits) >> blkbits)
  132. - map.m_lblk;
  133. len = map.m_len;
  134. err = ext4_map_blocks(NULL, inode, &map, 0);
  135. /*
  136. * 'err==len' means that all of blocks has
  137. * been preallocated no matter they are
  138. * initialized or not. For excluding
  139. * unwritten extents, we need to check
  140. * m_flags. There are two conditions that
  141. * indicate for initialized extents. 1) If we
  142. * hit extent cache, EXT4_MAP_MAPPED flag is
  143. * returned; 2) If we do a real lookup,
  144. * non-flags are returned. So we should check
  145. * these two conditions.
  146. */
  147. if (err == len && (map.m_flags & EXT4_MAP_MAPPED))
  148. overwrite = 1;
  149. }
  150. }
  151. ret = __generic_file_write_iter(iocb, from);
  152. mutex_unlock(&inode->i_mutex);
  153. if (ret > 0) {
  154. ssize_t err;
  155. err = generic_write_sync(file, iocb->ki_pos - ret, ret);
  156. if (err < 0)
  157. ret = err;
  158. }
  159. if (o_direct)
  160. blk_finish_plug(&plug);
  161. if (aio_mutex)
  162. mutex_unlock(aio_mutex);
  163. return ret;
  164. out:
  165. mutex_unlock(&inode->i_mutex);
  166. if (aio_mutex)
  167. mutex_unlock(aio_mutex);
  168. return ret;
  169. }
  170. #ifdef CONFIG_FS_DAX
  171. static void ext4_end_io_unwritten(struct buffer_head *bh, int uptodate)
  172. {
  173. struct inode *inode = bh->b_assoc_map->host;
  174. /* XXX: breaks on 32-bit > 16GB. Is that even supported? */
  175. loff_t offset = (loff_t)(uintptr_t)bh->b_private << inode->i_blkbits;
  176. int err;
  177. if (!uptodate)
  178. return;
  179. WARN_ON(!buffer_unwritten(bh));
  180. err = ext4_convert_unwritten_extents(NULL, inode, offset, bh->b_size);
  181. }
  182. static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
  183. {
  184. return dax_fault(vma, vmf, ext4_get_block, ext4_end_io_unwritten);
  185. /* Is this the right get_block? */
  186. }
  187. static int ext4_dax_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
  188. {
  189. return dax_mkwrite(vma, vmf, ext4_get_block, ext4_end_io_unwritten);
  190. }
  191. static const struct vm_operations_struct ext4_dax_vm_ops = {
  192. .fault = ext4_dax_fault,
  193. .page_mkwrite = ext4_dax_mkwrite,
  194. .pfn_mkwrite = dax_pfn_mkwrite,
  195. };
  196. #else
  197. #define ext4_dax_vm_ops ext4_file_vm_ops
  198. #endif
  199. static const struct vm_operations_struct ext4_file_vm_ops = {
  200. .fault = filemap_fault,
  201. .map_pages = filemap_map_pages,
  202. .page_mkwrite = ext4_page_mkwrite,
  203. };
  204. static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
  205. {
  206. struct inode *inode = file->f_mapping->host;
  207. if (ext4_encrypted_inode(inode)) {
  208. int err = ext4_get_encryption_info(inode);
  209. if (err)
  210. return 0;
  211. if (ext4_encryption_info(inode) == NULL)
  212. return -ENOKEY;
  213. }
  214. file_accessed(file);
  215. if (IS_DAX(file_inode(file))) {
  216. vma->vm_ops = &ext4_dax_vm_ops;
  217. vma->vm_flags |= VM_MIXEDMAP;
  218. } else {
  219. vma->vm_ops = &ext4_file_vm_ops;
  220. }
  221. return 0;
  222. }
  223. static int ext4_file_open(struct inode * inode, struct file * filp)
  224. {
  225. struct super_block *sb = inode->i_sb;
  226. struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
  227. struct vfsmount *mnt = filp->f_path.mnt;
  228. struct path path;
  229. char buf[64], *cp;
  230. int ret;
  231. if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) &&
  232. !(sb->s_flags & MS_RDONLY))) {
  233. sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED;
  234. /*
  235. * Sample where the filesystem has been mounted and
  236. * store it in the superblock for sysadmin convenience
  237. * when trying to sort through large numbers of block
  238. * devices or filesystem images.
  239. */
  240. memset(buf, 0, sizeof(buf));
  241. path.mnt = mnt;
  242. path.dentry = mnt->mnt_root;
  243. cp = d_path(&path, buf, sizeof(buf));
  244. if (!IS_ERR(cp)) {
  245. handle_t *handle;
  246. int err;
  247. handle = ext4_journal_start_sb(sb, EXT4_HT_MISC, 1);
  248. if (IS_ERR(handle))
  249. return PTR_ERR(handle);
  250. BUFFER_TRACE(sbi->s_sbh, "get_write_access");
  251. err = ext4_journal_get_write_access(handle, sbi->s_sbh);
  252. if (err) {
  253. ext4_journal_stop(handle);
  254. return err;
  255. }
  256. strlcpy(sbi->s_es->s_last_mounted, cp,
  257. sizeof(sbi->s_es->s_last_mounted));
  258. ext4_handle_dirty_super(handle, sb);
  259. ext4_journal_stop(handle);
  260. }
  261. }
  262. if (ext4_encrypted_inode(inode)) {
  263. ret = ext4_get_encryption_info(inode);
  264. if (ret)
  265. return -EACCES;
  266. if (ext4_encryption_info(inode) == NULL)
  267. return -ENOKEY;
  268. }
  269. /*
  270. * Set up the jbd2_inode if we are opening the inode for
  271. * writing and the journal is present
  272. */
  273. if (filp->f_mode & FMODE_WRITE) {
  274. ret = ext4_inode_attach_jinode(inode);
  275. if (ret < 0)
  276. return ret;
  277. }
  278. return dquot_file_open(inode, filp);
  279. }
  280. /*
  281. * Here we use ext4_map_blocks() to get a block mapping for a extent-based
  282. * file rather than ext4_ext_walk_space() because we can introduce
  283. * SEEK_DATA/SEEK_HOLE for block-mapped and extent-mapped file at the same
  284. * function. When extent status tree has been fully implemented, it will
  285. * track all extent status for a file and we can directly use it to
  286. * retrieve the offset for SEEK_DATA/SEEK_HOLE.
  287. */
  288. /*
  289. * When we retrieve the offset for SEEK_DATA/SEEK_HOLE, we would need to
  290. * lookup page cache to check whether or not there has some data between
  291. * [startoff, endoff] because, if this range contains an unwritten extent,
  292. * we determine this extent as a data or a hole according to whether the
  293. * page cache has data or not.
  294. */
  295. static int ext4_find_unwritten_pgoff(struct inode *inode,
  296. int whence,
  297. struct ext4_map_blocks *map,
  298. loff_t *offset)
  299. {
  300. struct pagevec pvec;
  301. unsigned int blkbits;
  302. pgoff_t index;
  303. pgoff_t end;
  304. loff_t endoff;
  305. loff_t startoff;
  306. loff_t lastoff;
  307. int found = 0;
  308. blkbits = inode->i_sb->s_blocksize_bits;
  309. startoff = *offset;
  310. lastoff = startoff;
  311. endoff = (loff_t)(map->m_lblk + map->m_len) << blkbits;
  312. index = startoff >> PAGE_CACHE_SHIFT;
  313. end = endoff >> PAGE_CACHE_SHIFT;
  314. pagevec_init(&pvec, 0);
  315. do {
  316. int i, num;
  317. unsigned long nr_pages;
  318. num = min_t(pgoff_t, end - index, PAGEVEC_SIZE);
  319. nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,
  320. (pgoff_t)num);
  321. if (nr_pages == 0) {
  322. if (whence == SEEK_DATA)
  323. break;
  324. BUG_ON(whence != SEEK_HOLE);
  325. /*
  326. * If this is the first time to go into the loop and
  327. * offset is not beyond the end offset, it will be a
  328. * hole at this offset
  329. */
  330. if (lastoff == startoff || lastoff < endoff)
  331. found = 1;
  332. break;
  333. }
  334. /*
  335. * If this is the first time to go into the loop and
  336. * offset is smaller than the first page offset, it will be a
  337. * hole at this offset.
  338. */
  339. if (lastoff == startoff && whence == SEEK_HOLE &&
  340. lastoff < page_offset(pvec.pages[0])) {
  341. found = 1;
  342. break;
  343. }
  344. for (i = 0; i < nr_pages; i++) {
  345. struct page *page = pvec.pages[i];
  346. struct buffer_head *bh, *head;
  347. /*
  348. * If the current offset is not beyond the end of given
  349. * range, it will be a hole.
  350. */
  351. if (lastoff < endoff && whence == SEEK_HOLE &&
  352. page->index > end) {
  353. found = 1;
  354. *offset = lastoff;
  355. goto out;
  356. }
  357. lock_page(page);
  358. if (unlikely(page->mapping != inode->i_mapping)) {
  359. unlock_page(page);
  360. continue;
  361. }
  362. if (!page_has_buffers(page)) {
  363. unlock_page(page);
  364. continue;
  365. }
  366. if (page_has_buffers(page)) {
  367. lastoff = page_offset(page);
  368. bh = head = page_buffers(page);
  369. do {
  370. if (buffer_uptodate(bh) ||
  371. buffer_unwritten(bh)) {
  372. if (whence == SEEK_DATA)
  373. found = 1;
  374. } else {
  375. if (whence == SEEK_HOLE)
  376. found = 1;
  377. }
  378. if (found) {
  379. *offset = max_t(loff_t,
  380. startoff, lastoff);
  381. unlock_page(page);
  382. goto out;
  383. }
  384. lastoff += bh->b_size;
  385. bh = bh->b_this_page;
  386. } while (bh != head);
  387. }
  388. lastoff = page_offset(page) + PAGE_SIZE;
  389. unlock_page(page);
  390. }
  391. /*
  392. * The no. of pages is less than our desired, that would be a
  393. * hole in there.
  394. */
  395. if (nr_pages < num && whence == SEEK_HOLE) {
  396. found = 1;
  397. *offset = lastoff;
  398. break;
  399. }
  400. index = pvec.pages[i - 1]->index + 1;
  401. pagevec_release(&pvec);
  402. } while (index <= end);
  403. out:
  404. pagevec_release(&pvec);
  405. return found;
  406. }
  407. /*
  408. * ext4_seek_data() retrieves the offset for SEEK_DATA.
  409. */
  410. static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
  411. {
  412. struct inode *inode = file->f_mapping->host;
  413. struct ext4_map_blocks map;
  414. struct extent_status es;
  415. ext4_lblk_t start, last, end;
  416. loff_t dataoff, isize;
  417. int blkbits;
  418. int ret = 0;
  419. mutex_lock(&inode->i_mutex);
  420. isize = i_size_read(inode);
  421. if (offset >= isize) {
  422. mutex_unlock(&inode->i_mutex);
  423. return -ENXIO;
  424. }
  425. blkbits = inode->i_sb->s_blocksize_bits;
  426. start = offset >> blkbits;
  427. last = start;
  428. end = isize >> blkbits;
  429. dataoff = offset;
  430. do {
  431. map.m_lblk = last;
  432. map.m_len = end - last + 1;
  433. ret = ext4_map_blocks(NULL, inode, &map, 0);
  434. if (ret > 0 && !(map.m_flags & EXT4_MAP_UNWRITTEN)) {
  435. if (last != start)
  436. dataoff = (loff_t)last << blkbits;
  437. break;
  438. }
  439. /*
  440. * If there is a delay extent at this offset,
  441. * it will be as a data.
  442. */
  443. ext4_es_find_delayed_extent_range(inode, last, last, &es);
  444. if (es.es_len != 0 && in_range(last, es.es_lblk, es.es_len)) {
  445. if (last != start)
  446. dataoff = (loff_t)last << blkbits;
  447. break;
  448. }
  449. /*
  450. * If there is a unwritten extent at this offset,
  451. * it will be as a data or a hole according to page
  452. * cache that has data or not.
  453. */
  454. if (map.m_flags & EXT4_MAP_UNWRITTEN) {
  455. int unwritten;
  456. unwritten = ext4_find_unwritten_pgoff(inode, SEEK_DATA,
  457. &map, &dataoff);
  458. if (unwritten)
  459. break;
  460. }
  461. last++;
  462. dataoff = (loff_t)last << blkbits;
  463. } while (last <= end);
  464. mutex_unlock(&inode->i_mutex);
  465. if (dataoff > isize)
  466. return -ENXIO;
  467. return vfs_setpos(file, dataoff, maxsize);
  468. }
  469. /*
  470. * ext4_seek_hole() retrieves the offset for SEEK_HOLE.
  471. */
  472. static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
  473. {
  474. struct inode *inode = file->f_mapping->host;
  475. struct ext4_map_blocks map;
  476. struct extent_status es;
  477. ext4_lblk_t start, last, end;
  478. loff_t holeoff, isize;
  479. int blkbits;
  480. int ret = 0;
  481. mutex_lock(&inode->i_mutex);
  482. isize = i_size_read(inode);
  483. if (offset >= isize) {
  484. mutex_unlock(&inode->i_mutex);
  485. return -ENXIO;
  486. }
  487. blkbits = inode->i_sb->s_blocksize_bits;
  488. start = offset >> blkbits;
  489. last = start;
  490. end = isize >> blkbits;
  491. holeoff = offset;
  492. do {
  493. map.m_lblk = last;
  494. map.m_len = end - last + 1;
  495. ret = ext4_map_blocks(NULL, inode, &map, 0);
  496. if (ret > 0 && !(map.m_flags & EXT4_MAP_UNWRITTEN)) {
  497. last += ret;
  498. holeoff = (loff_t)last << blkbits;
  499. continue;
  500. }
  501. /*
  502. * If there is a delay extent at this offset,
  503. * we will skip this extent.
  504. */
  505. ext4_es_find_delayed_extent_range(inode, last, last, &es);
  506. if (es.es_len != 0 && in_range(last, es.es_lblk, es.es_len)) {
  507. last = es.es_lblk + es.es_len;
  508. holeoff = (loff_t)last << blkbits;
  509. continue;
  510. }
  511. /*
  512. * If there is a unwritten extent at this offset,
  513. * it will be as a data or a hole according to page
  514. * cache that has data or not.
  515. */
  516. if (map.m_flags & EXT4_MAP_UNWRITTEN) {
  517. int unwritten;
  518. unwritten = ext4_find_unwritten_pgoff(inode, SEEK_HOLE,
  519. &map, &holeoff);
  520. if (!unwritten) {
  521. last += ret;
  522. holeoff = (loff_t)last << blkbits;
  523. continue;
  524. }
  525. }
  526. /* find a hole */
  527. break;
  528. } while (last <= end);
  529. mutex_unlock(&inode->i_mutex);
  530. if (holeoff > isize)
  531. holeoff = isize;
  532. return vfs_setpos(file, holeoff, maxsize);
  533. }
  534. /*
  535. * ext4_llseek() handles both block-mapped and extent-mapped maxbytes values
  536. * by calling generic_file_llseek_size() with the appropriate maxbytes
  537. * value for each.
  538. */
  539. loff_t ext4_llseek(struct file *file, loff_t offset, int whence)
  540. {
  541. struct inode *inode = file->f_mapping->host;
  542. loff_t maxbytes;
  543. if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
  544. maxbytes = EXT4_SB(inode->i_sb)->s_bitmap_maxbytes;
  545. else
  546. maxbytes = inode->i_sb->s_maxbytes;
  547. switch (whence) {
  548. case SEEK_SET:
  549. case SEEK_CUR:
  550. case SEEK_END:
  551. return generic_file_llseek_size(file, offset, whence,
  552. maxbytes, i_size_read(inode));
  553. case SEEK_DATA:
  554. return ext4_seek_data(file, offset, maxbytes);
  555. case SEEK_HOLE:
  556. return ext4_seek_hole(file, offset, maxbytes);
  557. }
  558. return -EINVAL;
  559. }
  560. const struct file_operations ext4_file_operations = {
  561. .llseek = ext4_llseek,
  562. .read_iter = generic_file_read_iter,
  563. .write_iter = ext4_file_write_iter,
  564. .unlocked_ioctl = ext4_ioctl,
  565. #ifdef CONFIG_COMPAT
  566. .compat_ioctl = ext4_compat_ioctl,
  567. #endif
  568. .mmap = ext4_file_mmap,
  569. .open = ext4_file_open,
  570. .release = ext4_release_file,
  571. .fsync = ext4_sync_file,
  572. .splice_read = generic_file_splice_read,
  573. .splice_write = iter_file_splice_write,
  574. .fallocate = ext4_fallocate,
  575. };
  576. const struct inode_operations ext4_file_inode_operations = {
  577. .setattr = ext4_setattr,
  578. .getattr = ext4_getattr,
  579. .setxattr = generic_setxattr,
  580. .getxattr = generic_getxattr,
  581. .listxattr = ext4_listxattr,
  582. .removexattr = generic_removexattr,
  583. .get_acl = ext4_get_acl,
  584. .set_acl = ext4_set_acl,
  585. .fiemap = ext4_fiemap,
  586. };