ops_file.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. /*
  2. * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  3. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
  4. *
  5. * This copyrighted material is made available to anyone wishing to use,
  6. * modify, copy, or redistribute it subject to the terms and conditions
  7. * of the GNU General Public License version 2.
  8. */
  9. #include <linux/sched.h>
  10. #include <linux/slab.h>
  11. #include <linux/spinlock.h>
  12. #include <linux/completion.h>
  13. #include <linux/buffer_head.h>
  14. #include <linux/pagemap.h>
  15. #include <linux/uio.h>
  16. #include <linux/blkdev.h>
  17. #include <linux/mm.h>
  18. #include <linux/smp_lock.h>
  19. #include <linux/fs.h>
  20. #include <linux/gfs2_ondisk.h>
  21. #include <linux/ext2_fs.h>
  22. #include <linux/crc32.h>
  23. #include <linux/iflags.h>
  24. #include <linux/lm_interface.h>
  25. #include <asm/uaccess.h>
  26. #include "gfs2.h"
  27. #include "incore.h"
  28. #include "bmap.h"
  29. #include "dir.h"
  30. #include "glock.h"
  31. #include "glops.h"
  32. #include "inode.h"
  33. #include "lm.h"
  34. #include "log.h"
  35. #include "meta_io.h"
  36. #include "ops_file.h"
  37. #include "ops_vm.h"
  38. #include "quota.h"
  39. #include "rgrp.h"
  40. #include "trans.h"
  41. #include "util.h"
  42. #include "eaops.h"
  43. /* For regular, non-NFS */
  44. struct filldir_reg {
  45. struct gfs2_sbd *fdr_sbd;
  46. int fdr_prefetch;
  47. filldir_t fdr_filldir;
  48. void *fdr_opaque;
  49. };
  50. /*
  51. * Most fields left uninitialised to catch anybody who tries to
  52. * use them. f_flags set to prevent file_accessed() from touching
  53. * any other part of this. Its use is purely as a flag so that we
  54. * know (in readpage()) whether or not do to locking.
  55. */
  56. struct file gfs2_internal_file_sentinel = {
  57. .f_flags = O_NOATIME|O_RDONLY,
  58. };
  59. static int gfs2_read_actor(read_descriptor_t *desc, struct page *page,
  60. unsigned long offset, unsigned long size)
  61. {
  62. char *kaddr;
  63. unsigned long count = desc->count;
  64. if (size > count)
  65. size = count;
  66. kaddr = kmap(page);
  67. memcpy(desc->arg.buf, kaddr + offset, size);
  68. kunmap(page);
  69. desc->count = count - size;
  70. desc->written += size;
  71. desc->arg.buf += size;
  72. return size;
  73. }
  74. int gfs2_internal_read(struct gfs2_inode *ip, struct file_ra_state *ra_state,
  75. char *buf, loff_t *pos, unsigned size)
  76. {
  77. struct inode *inode = &ip->i_inode;
  78. read_descriptor_t desc;
  79. desc.written = 0;
  80. desc.arg.buf = buf;
  81. desc.count = size;
  82. desc.error = 0;
  83. do_generic_mapping_read(inode->i_mapping, ra_state,
  84. &gfs2_internal_file_sentinel, pos, &desc,
  85. gfs2_read_actor);
  86. return desc.written ? desc.written : desc.error;
  87. }
  88. /**
  89. * gfs2_llseek - seek to a location in a file
  90. * @file: the file
  91. * @offset: the offset
  92. * @origin: Where to seek from (SEEK_SET, SEEK_CUR, or SEEK_END)
  93. *
  94. * SEEK_END requires the glock for the file because it references the
  95. * file's size.
  96. *
  97. * Returns: The new offset, or errno
  98. */
  99. static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin)
  100. {
  101. struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
  102. struct gfs2_holder i_gh;
  103. loff_t error;
  104. if (origin == 2) {
  105. error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
  106. &i_gh);
  107. if (!error) {
  108. error = remote_llseek(file, offset, origin);
  109. gfs2_glock_dq_uninit(&i_gh);
  110. }
  111. } else
  112. error = remote_llseek(file, offset, origin);
  113. return error;
  114. }
  115. /**
  116. * filldir_func - Report a directory entry to the caller of gfs2_dir_read()
  117. * @opaque: opaque data used by the function
  118. * @name: the name of the directory entry
  119. * @length: the length of the name
  120. * @offset: the entry's offset in the directory
  121. * @inum: the inode number the entry points to
  122. * @type: the type of inode the entry points to
  123. *
  124. * Returns: 0 on success, 1 if buffer full
  125. */
  126. static int filldir_func(void *opaque, const char *name, unsigned int length,
  127. u64 offset, struct gfs2_inum *inum,
  128. unsigned int type)
  129. {
  130. struct filldir_reg *fdr = (struct filldir_reg *)opaque;
  131. struct gfs2_sbd *sdp = fdr->fdr_sbd;
  132. int error;
  133. error = fdr->fdr_filldir(fdr->fdr_opaque, name, length, offset,
  134. inum->no_addr, type);
  135. if (error)
  136. return 1;
  137. if (fdr->fdr_prefetch && !(length == 1 && *name == '.')) {
  138. gfs2_glock_prefetch_num(sdp, inum->no_addr, &gfs2_inode_glops,
  139. LM_ST_SHARED, LM_FLAG_TRY | LM_FLAG_ANY);
  140. gfs2_glock_prefetch_num(sdp, inum->no_addr, &gfs2_iopen_glops,
  141. LM_ST_SHARED, LM_FLAG_TRY);
  142. }
  143. return 0;
  144. }
  145. /**
  146. * gfs2_readdir - Read directory entries from a directory
  147. * @file: The directory to read from
  148. * @dirent: Buffer for dirents
  149. * @filldir: Function used to do the copying
  150. *
  151. * Returns: errno
  152. */
  153. static int gfs2_readdir(struct file *file, void *dirent, filldir_t filldir)
  154. {
  155. struct inode *dir = file->f_mapping->host;
  156. struct gfs2_inode *dip = GFS2_I(dir);
  157. struct filldir_reg fdr;
  158. struct gfs2_holder d_gh;
  159. u64 offset = file->f_pos;
  160. int error;
  161. fdr.fdr_sbd = GFS2_SB(dir);
  162. fdr.fdr_prefetch = 1;
  163. fdr.fdr_filldir = filldir;
  164. fdr.fdr_opaque = dirent;
  165. gfs2_holder_init(dip->i_gl, LM_ST_SHARED, GL_ATIME, &d_gh);
  166. error = gfs2_glock_nq_atime(&d_gh);
  167. if (error) {
  168. gfs2_holder_uninit(&d_gh);
  169. return error;
  170. }
  171. error = gfs2_dir_read(dir, &offset, &fdr, filldir_func);
  172. gfs2_glock_dq_uninit(&d_gh);
  173. file->f_pos = offset;
  174. return error;
  175. }
  176. static const u32 iflags_to_gfs2[32] = {
  177. [iflag_Sync] = GFS2_DIF_SYNC,
  178. [iflag_Immutable] = GFS2_DIF_IMMUTABLE,
  179. [iflag_Append] = GFS2_DIF_APPENDONLY,
  180. [iflag_NoAtime] = GFS2_DIF_NOATIME,
  181. [iflag_Index] = GFS2_DIF_EXHASH,
  182. [iflag_JournalData] = GFS2_DIF_JDATA,
  183. [iflag_DirectIO] = GFS2_DIF_DIRECTIO,
  184. };
  185. static const u32 gfs2_to_iflags[32] = {
  186. [gfs2fl_Sync] = IFLAG_SYNC,
  187. [gfs2fl_Immutable] = IFLAG_IMMUTABLE,
  188. [gfs2fl_AppendOnly] = IFLAG_APPEND,
  189. [gfs2fl_NoAtime] = IFLAG_NOATIME,
  190. [gfs2fl_ExHash] = IFLAG_INDEX,
  191. [gfs2fl_Jdata] = IFLAG_JOURNAL_DATA,
  192. [gfs2fl_Directio] = IFLAG_DIRECTIO,
  193. [gfs2fl_InheritDirectio] = IFLAG_DIRECTIO,
  194. [gfs2fl_InheritJdata] = IFLAG_JOURNAL_DATA,
  195. };
  196. static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
  197. {
  198. struct inode *inode = filp->f_dentry->d_inode;
  199. struct gfs2_inode *ip = GFS2_I(inode);
  200. struct gfs2_holder gh;
  201. int error;
  202. u32 iflags;
  203. gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh);
  204. error = gfs2_glock_nq_m_atime(1, &gh);
  205. if (error)
  206. return error;
  207. iflags = iflags_cvt(gfs2_to_iflags, ip->i_di.di_flags);
  208. if (put_user(iflags, ptr))
  209. error = -EFAULT;
  210. gfs2_glock_dq_m(1, &gh);
  211. gfs2_holder_uninit(&gh);
  212. return error;
  213. }
  214. /* Flags that can be set by user space */
  215. #define GFS2_FLAGS_USER_SET (GFS2_DIF_JDATA| \
  216. GFS2_DIF_DIRECTIO| \
  217. GFS2_DIF_IMMUTABLE| \
  218. GFS2_DIF_APPENDONLY| \
  219. GFS2_DIF_NOATIME| \
  220. GFS2_DIF_SYNC| \
  221. GFS2_DIF_SYSTEM| \
  222. GFS2_DIF_INHERIT_DIRECTIO| \
  223. GFS2_DIF_INHERIT_JDATA)
  224. /**
  225. * gfs2_set_flags - set flags on an inode
  226. * @inode: The inode
  227. * @flags: The flags to set
  228. * @mask: Indicates which flags are valid
  229. *
  230. */
  231. static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
  232. {
  233. struct inode *inode = filp->f_dentry->d_inode;
  234. struct gfs2_inode *ip = GFS2_I(inode);
  235. struct gfs2_sbd *sdp = GFS2_SB(inode);
  236. struct buffer_head *bh;
  237. struct gfs2_holder gh;
  238. int error;
  239. u32 new_flags, flags;
  240. error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
  241. if (error)
  242. return error;
  243. flags = ip->i_di.di_flags;
  244. new_flags = (flags & ~mask) | (reqflags & mask);
  245. if ((new_flags ^ flags) == 0)
  246. goto out;
  247. if (S_ISDIR(inode->i_mode)) {
  248. if ((new_flags ^ flags) & GFS2_DIF_JDATA)
  249. new_flags ^= (GFS2_DIF_JDATA|GFS2_DIF_INHERIT_JDATA);
  250. if ((new_flags ^ flags) & GFS2_DIF_DIRECTIO)
  251. new_flags ^= (GFS2_DIF_DIRECTIO|GFS2_DIF_INHERIT_DIRECTIO);
  252. }
  253. error = -EINVAL;
  254. if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET)
  255. goto out;
  256. error = -EPERM;
  257. if (IS_IMMUTABLE(inode) && (new_flags & GFS2_DIF_IMMUTABLE))
  258. goto out;
  259. if (IS_APPEND(inode) && (new_flags & GFS2_DIF_APPENDONLY))
  260. goto out;
  261. if (((new_flags ^ flags) & GFS2_DIF_IMMUTABLE) &&
  262. !capable(CAP_LINUX_IMMUTABLE))
  263. goto out;
  264. if (!IS_IMMUTABLE(inode)) {
  265. error = permission(inode, MAY_WRITE, NULL);
  266. if (error)
  267. goto out;
  268. }
  269. error = gfs2_trans_begin(sdp, RES_DINODE, 0);
  270. if (error)
  271. goto out;
  272. error = gfs2_meta_inode_buffer(ip, &bh);
  273. if (error)
  274. goto out_trans_end;
  275. gfs2_trans_add_bh(ip->i_gl, bh, 1);
  276. ip->i_di.di_flags = new_flags;
  277. gfs2_dinode_out(&ip->i_di, bh->b_data);
  278. brelse(bh);
  279. out_trans_end:
  280. gfs2_trans_end(sdp);
  281. out:
  282. gfs2_glock_dq_uninit(&gh);
  283. return error;
  284. }
  285. static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
  286. {
  287. u32 iflags, gfsflags;
  288. if (get_user(iflags, ptr))
  289. return -EFAULT;
  290. gfsflags = iflags_cvt(iflags_to_gfs2, iflags);
  291. return do_gfs2_set_flags(filp, gfsflags, ~0);
  292. }
  293. static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
  294. {
  295. switch(cmd) {
  296. case IFLAGS_GET_IOC:
  297. return gfs2_get_flags(filp, (u32 __user *)arg);
  298. case IFLAGS_SET_IOC:
  299. return gfs2_set_flags(filp, (u32 __user *)arg);
  300. }
  301. return -ENOTTY;
  302. }
  303. /**
  304. * gfs2_mmap -
  305. * @file: The file to map
  306. * @vma: The VMA which described the mapping
  307. *
  308. * Returns: 0 or error code
  309. */
  310. static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
  311. {
  312. struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
  313. struct gfs2_holder i_gh;
  314. int error;
  315. gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &i_gh);
  316. error = gfs2_glock_nq_atime(&i_gh);
  317. if (error) {
  318. gfs2_holder_uninit(&i_gh);
  319. return error;
  320. }
  321. /* This is VM_MAYWRITE instead of VM_WRITE because a call
  322. to mprotect() can turn on VM_WRITE later. */
  323. if ((vma->vm_flags & (VM_MAYSHARE | VM_MAYWRITE)) ==
  324. (VM_MAYSHARE | VM_MAYWRITE))
  325. vma->vm_ops = &gfs2_vm_ops_sharewrite;
  326. else
  327. vma->vm_ops = &gfs2_vm_ops_private;
  328. gfs2_glock_dq_uninit(&i_gh);
  329. return error;
  330. }
  331. /**
  332. * gfs2_open - open a file
  333. * @inode: the inode to open
  334. * @file: the struct file for this opening
  335. *
  336. * Returns: errno
  337. */
  338. static int gfs2_open(struct inode *inode, struct file *file)
  339. {
  340. struct gfs2_inode *ip = GFS2_I(inode);
  341. struct gfs2_holder i_gh;
  342. struct gfs2_file *fp;
  343. int error;
  344. fp = kzalloc(sizeof(struct gfs2_file), GFP_KERNEL);
  345. if (!fp)
  346. return -ENOMEM;
  347. mutex_init(&fp->f_fl_mutex);
  348. gfs2_assert_warn(GFS2_SB(inode), !file->private_data);
  349. file->private_data = fp;
  350. if (S_ISREG(ip->i_di.di_mode)) {
  351. error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
  352. &i_gh);
  353. if (error)
  354. goto fail;
  355. if (!(file->f_flags & O_LARGEFILE) &&
  356. ip->i_di.di_size > MAX_NON_LFS) {
  357. error = -EFBIG;
  358. goto fail_gunlock;
  359. }
  360. /* Listen to the Direct I/O flag */
  361. if (ip->i_di.di_flags & GFS2_DIF_DIRECTIO)
  362. file->f_flags |= O_DIRECT;
  363. gfs2_glock_dq_uninit(&i_gh);
  364. }
  365. return 0;
  366. fail_gunlock:
  367. gfs2_glock_dq_uninit(&i_gh);
  368. fail:
  369. file->private_data = NULL;
  370. kfree(fp);
  371. return error;
  372. }
  373. /**
  374. * gfs2_close - called to close a struct file
  375. * @inode: the inode the struct file belongs to
  376. * @file: the struct file being closed
  377. *
  378. * Returns: errno
  379. */
  380. static int gfs2_close(struct inode *inode, struct file *file)
  381. {
  382. struct gfs2_sbd *sdp = inode->i_sb->s_fs_info;
  383. struct gfs2_file *fp;
  384. fp = file->private_data;
  385. file->private_data = NULL;
  386. if (gfs2_assert_warn(sdp, fp))
  387. return -EIO;
  388. kfree(fp);
  389. return 0;
  390. }
  391. /**
  392. * gfs2_fsync - sync the dirty data for a file (across the cluster)
  393. * @file: the file that points to the dentry (we ignore this)
  394. * @dentry: the dentry that points to the inode to sync
  395. *
  396. * Returns: errno
  397. */
  398. static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync)
  399. {
  400. struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
  401. gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
  402. return 0;
  403. }
  404. /**
  405. * gfs2_lock - acquire/release a posix lock on a file
  406. * @file: the file pointer
  407. * @cmd: either modify or retrieve lock state, possibly wait
  408. * @fl: type and range of lock
  409. *
  410. * Returns: errno
  411. */
  412. static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
  413. {
  414. struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
  415. struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host);
  416. struct lm_lockname name =
  417. { .ln_number = ip->i_num.no_addr,
  418. .ln_type = LM_TYPE_PLOCK };
  419. if (!(fl->fl_flags & FL_POSIX))
  420. return -ENOLCK;
  421. if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
  422. return -ENOLCK;
  423. if (sdp->sd_args.ar_localflocks) {
  424. if (IS_GETLK(cmd)) {
  425. struct file_lock tmp;
  426. int ret;
  427. ret = posix_test_lock(file, fl, &tmp);
  428. fl->fl_type = F_UNLCK;
  429. if (ret)
  430. memcpy(fl, &tmp, sizeof(struct file_lock));
  431. return 0;
  432. } else {
  433. return posix_lock_file_wait(file, fl);
  434. }
  435. }
  436. if (IS_GETLK(cmd))
  437. return gfs2_lm_plock_get(sdp, &name, file, fl);
  438. else if (fl->fl_type == F_UNLCK)
  439. return gfs2_lm_punlock(sdp, &name, file, fl);
  440. else
  441. return gfs2_lm_plock(sdp, &name, file, cmd, fl);
  442. }
  443. static int do_flock(struct file *file, int cmd, struct file_lock *fl)
  444. {
  445. struct gfs2_file *fp = file->private_data;
  446. struct gfs2_holder *fl_gh = &fp->f_fl_gh;
  447. struct gfs2_inode *ip = GFS2_I(file->f_dentry->d_inode);
  448. struct gfs2_glock *gl;
  449. unsigned int state;
  450. int flags;
  451. int error = 0;
  452. state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
  453. flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY) | GL_EXACT | GL_NOCACHE;
  454. mutex_lock(&fp->f_fl_mutex);
  455. gl = fl_gh->gh_gl;
  456. if (gl) {
  457. if (fl_gh->gh_state == state)
  458. goto out;
  459. gfs2_glock_hold(gl);
  460. flock_lock_file_wait(file,
  461. &(struct file_lock){.fl_type = F_UNLCK});
  462. gfs2_glock_dq_uninit(fl_gh);
  463. } else {
  464. error = gfs2_glock_get(GFS2_SB(&ip->i_inode),
  465. ip->i_num.no_addr, &gfs2_flock_glops,
  466. CREATE, &gl);
  467. if (error)
  468. goto out;
  469. }
  470. gfs2_holder_init(gl, state, flags, fl_gh);
  471. gfs2_glock_put(gl);
  472. error = gfs2_glock_nq(fl_gh);
  473. if (error) {
  474. gfs2_holder_uninit(fl_gh);
  475. if (error == GLR_TRYFAILED)
  476. error = -EAGAIN;
  477. } else {
  478. error = flock_lock_file_wait(file, fl);
  479. gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error);
  480. }
  481. out:
  482. mutex_unlock(&fp->f_fl_mutex);
  483. return error;
  484. }
  485. static void do_unflock(struct file *file, struct file_lock *fl)
  486. {
  487. struct gfs2_file *fp = file->private_data;
  488. struct gfs2_holder *fl_gh = &fp->f_fl_gh;
  489. mutex_lock(&fp->f_fl_mutex);
  490. flock_lock_file_wait(file, fl);
  491. if (fl_gh->gh_gl)
  492. gfs2_glock_dq_uninit(fl_gh);
  493. mutex_unlock(&fp->f_fl_mutex);
  494. }
  495. /**
  496. * gfs2_flock - acquire/release a flock lock on a file
  497. * @file: the file pointer
  498. * @cmd: either modify or retrieve lock state, possibly wait
  499. * @fl: type and range of lock
  500. *
  501. * Returns: errno
  502. */
  503. static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
  504. {
  505. struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
  506. struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host);
  507. if (!(fl->fl_flags & FL_FLOCK))
  508. return -ENOLCK;
  509. if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
  510. return -ENOLCK;
  511. if (sdp->sd_args.ar_localflocks)
  512. return flock_lock_file_wait(file, fl);
  513. if (fl->fl_type == F_UNLCK) {
  514. do_unflock(file, fl);
  515. return 0;
  516. } else
  517. return do_flock(file, cmd, fl);
  518. }
  519. const struct file_operations gfs2_file_fops = {
  520. .llseek = gfs2_llseek,
  521. .read = generic_file_read,
  522. .readv = generic_file_readv,
  523. .aio_read = generic_file_aio_read,
  524. .write = generic_file_write,
  525. .writev = generic_file_writev,
  526. .aio_write = generic_file_aio_write,
  527. .unlocked_ioctl = gfs2_ioctl,
  528. .mmap = gfs2_mmap,
  529. .open = gfs2_open,
  530. .release = gfs2_close,
  531. .fsync = gfs2_fsync,
  532. .lock = gfs2_lock,
  533. .sendfile = generic_file_sendfile,
  534. .flock = gfs2_flock,
  535. .splice_read = generic_file_splice_read,
  536. .splice_write = generic_file_splice_write,
  537. };
  538. const struct file_operations gfs2_dir_fops = {
  539. .readdir = gfs2_readdir,
  540. .unlocked_ioctl = gfs2_ioctl,
  541. .open = gfs2_open,
  542. .release = gfs2_close,
  543. .fsync = gfs2_fsync,
  544. .lock = gfs2_lock,
  545. .flock = gfs2_flock,
  546. };