Commit 1d8c4c0009deda22b436b1f0ab9f2885863717fc

Authored by Pavel Shilovsky
Committed by Steve French
1 parent 2ae78ba85c

CIFS: Make flush code use ops struct

Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>

Showing 3 changed files with 26 additions and 4 deletions Side-by-side Diff

... ... @@ -274,6 +274,8 @@
274 274 void (*set_fid)(struct cifsFileInfo *, struct cifs_fid *, __u32);
275 275 /* close a file */
276 276 int (*close)(const unsigned int, struct cifs_tcon *, struct cifs_fid *);
  277 + /* send a flush request to the server */
  278 + int (*flush)(const unsigned int, struct cifs_tcon *, struct cifs_fid *);
277 279 };
278 280  
279 281 struct smb_version_values {
... ... @@ -2062,6 +2062,7 @@
2062 2062 unsigned int xid;
2063 2063 int rc = 0;
2064 2064 struct cifs_tcon *tcon;
  2065 + struct TCP_Server_Info *server;
2065 2066 struct cifsFileInfo *smbfile = file->private_data;
2066 2067 struct inode *inode = file->f_path.dentry->d_inode;
2067 2068 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
... ... @@ -2085,8 +2086,13 @@
2085 2086 }
2086 2087  
2087 2088 tcon = tlink_tcon(smbfile->tlink);
2088   - if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC))
2089   - rc = CIFSSMBFlush(xid, tcon, smbfile->fid.netfid);
  2089 + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) {
  2090 + server = tcon->ses->server;
  2091 + if (server->ops->flush)
  2092 + rc = server->ops->flush(xid, tcon, &smbfile->fid);
  2093 + else
  2094 + rc = -ENOSYS;
  2095 + }
2090 2096  
2091 2097 free_xid(xid);
2092 2098 mutex_unlock(&inode->i_mutex);
... ... @@ -2098,6 +2104,7 @@
2098 2104 unsigned int xid;
2099 2105 int rc = 0;
2100 2106 struct cifs_tcon *tcon;
  2107 + struct TCP_Server_Info *server;
2101 2108 struct cifsFileInfo *smbfile = file->private_data;
2102 2109 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
2103 2110 struct inode *inode = file->f_mapping->host;
... ... @@ -2113,8 +2120,13 @@
2113 2120 file->f_path.dentry->d_name.name, datasync);
2114 2121  
2115 2122 tcon = tlink_tcon(smbfile->tlink);
2116   - if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC))
2117   - rc = CIFSSMBFlush(xid, tcon, smbfile->fid.netfid);
  2123 + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) {
  2124 + server = tcon->ses->server;
  2125 + if (server->ops->flush)
  2126 + rc = server->ops->flush(xid, tcon, &smbfile->fid);
  2127 + else
  2128 + rc = -ENOSYS;
  2129 + }
2118 2130  
2119 2131 free_xid(xid);
2120 2132 mutex_unlock(&inode->i_mutex);
... ... @@ -648,6 +648,13 @@
648 648 return CIFSSMBClose(xid, tcon, fid->netfid);
649 649 }
650 650  
  651 +static int
  652 +cifs_flush_file(const unsigned int xid, struct cifs_tcon *tcon,
  653 + struct cifs_fid *fid)
  654 +{
  655 + return CIFSSMBFlush(xid, tcon, fid->netfid);
  656 +}
  657 +
651 658 struct smb_version_operations smb1_operations = {
652 659 .send_cancel = send_nt_cancel,
653 660 .compare_fids = cifs_compare_fids,
... ... @@ -691,6 +698,7 @@
691 698 .open = cifs_open_file,
692 699 .set_fid = cifs_set_fid,
693 700 .close = cifs_close_file,
  701 + .flush = cifs_flush_file,
694 702 };
695 703  
696 704 struct smb_version_values smb1_values = {