file.c 17 KB

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