From: Pavel Shilovsky <piastry@etersoft.ru>
To: linux-cifs@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, Pavel Shilovsky <piastryyy@gmail.com>
Subject: [PATCH v2 39/53] CIFS: Add SMB2 support for flush operation
Date: Fri, 28 Oct 2011 23:54:50 +0400 [thread overview]
Message-ID: <1319831704-3572-40-git-send-email-piastry@etersoft.ru> (raw)
In-Reply-To: <1319831704-3572-1-git-send-email-piastry@etersoft.ru>
From: Pavel Shilovsky <piastryyy@gmail.com>
Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com>
---
fs/cifs/cifsglob.h | 1 +
fs/cifs/cifsproto.h | 5 +++++
fs/cifs/file.c | 34 +++++++++++++++++++++++++---------
fs/cifs/smb2file.c | 30 ++++++++++++++++++++++++------
fs/cifs/smb2proto.h | 6 ++++--
5 files changed, 59 insertions(+), 17 deletions(-)
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index d878378..b71c3fc 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -656,6 +656,7 @@ typedef int (iread_callback_t)(int, struct cifsFileInfo *,
typedef int (read_callback_t)(int, struct cifsFileInfo *,
struct cifs_io_parms *, unsigned int *, char **,
int *, unsigned int);
+typedef int (fsync_callback_t)(int, struct cifsFileInfo *);
/*
* Take a reference on the file private data. Must be called with
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 4285c10..c8b1d50 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -220,6 +220,11 @@ extern int is_dir_changed(struct file *file);
extern struct dentry *cifs_readdir_lookup(struct dentry *parent,
struct qstr *name,
struct cifs_fattr *fattr);
+extern int cifs_strict_fsync_generic(struct file *file, loff_t start,
+ loff_t end, int datasync,
+ fsync_callback_t *fsync_cb);
+extern int cifs_fsync_generic(struct file *file, loff_t start, loff_t end,
+ int datasync, fsync_callback_t *fsync_cb);
void cifs_proc_init(void);
void cifs_proc_clean(void);
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 22cf18b..2c9471c 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2044,12 +2044,17 @@ int cifs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
return rc;
}
-int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
- int datasync)
+static int
+cifs_fsync_cb(int xid, struct cifsFileInfo *cfile)
+{
+ return CIFSSMBFlush(xid, tlink_tcon(cfile->tlink), cfile->netfid);
+}
+
+int cifs_strict_fsync_generic(struct file *file, loff_t start, loff_t end,
+ int datasync, fsync_callback_t *fsync_cb)
{
int xid;
int rc = 0;
- struct cifs_tcon *tcon;
struct cifsFileInfo *smbfile = file->private_data;
struct inode *inode = file->f_path.dentry->d_inode;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
@@ -2072,20 +2077,26 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
}
}
- tcon = tlink_tcon(smbfile->tlink);
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC))
- rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
+ rc = fsync_cb(xid, smbfile);
FreeXid(xid);
mutex_unlock(&inode->i_mutex);
return rc;
}
-int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
+int
+cifs_strict_fsync(struct file *file, loff_t start, loff_t end, int datasync)
+{
+ return cifs_strict_fsync_generic(file, datasync, start, end,
+ cifs_fsync_cb);
+}
+
+int cifs_fsync_generic(struct file *file, loff_t start, loff_t end,
+ int datasync, fsync_callback_t *fsync_cb)
{
int xid;
int rc = 0;
- struct cifs_tcon *tcon;
struct cifsFileInfo *smbfile = file->private_data;
struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
struct inode *inode = file->f_mapping->host;
@@ -2100,15 +2111,20 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
cFYI(1, "Sync file - name: %s datasync: 0x%x",
file->f_path.dentry->d_name.name, datasync);
- tcon = tlink_tcon(smbfile->tlink);
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC))
- rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
+ rc = fsync_cb(xid, smbfile);
FreeXid(xid);
mutex_unlock(&inode->i_mutex);
return rc;
}
+int
+cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
+{
+ return cifs_fsync_generic(file, start, end, datasync, cifs_fsync_cb);
+}
+
/*
* As file closes, flush all cached write data for this inode checking
* for write behind errors.
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
index 48e2a36..ae4ea13 100644
--- a/fs/cifs/smb2file.c
+++ b/fs/cifs/smb2file.c
@@ -43,7 +43,7 @@ const struct file_operations smb2_file_ops = {
.open = smb2_open,
.release = cifs_close,
.lock = cifs_lock,
- .fsync = cifs_fsync,
+ .fsync = smb2_fsync,
.flush = cifs_flush,
.mmap = cifs_file_mmap,
.splice_read = generic_file_splice_read,
@@ -62,7 +62,7 @@ const struct file_operations smb2_file_strict_ops = {
.open = smb2_open,
.release = cifs_close,
.lock = cifs_lock,
- .fsync = cifs_strict_fsync,
+ .fsync = smb2_strict_fsync,
.flush = cifs_flush,
.mmap = cifs_file_strict_mmap,
.splice_read = generic_file_splice_read,
@@ -82,7 +82,7 @@ const struct file_operations smb2_file_direct_ops = {
.open = smb2_open,
.release = cifs_close,
.lock = cifs_lock,
- .fsync = cifs_fsync,
+ .fsync = smb2_fsync,
.flush = cifs_flush,
.mmap = cifs_file_mmap,
.splice_read = generic_file_splice_read,
@@ -100,7 +100,7 @@ const struct file_operations smb2_file_nobrl_ops = {
.aio_write = cifs_file_aio_write,
.open = smb2_open,
.release = cifs_close,
- .fsync = cifs_fsync,
+ .fsync = smb2_fsync,
.flush = cifs_flush,
.mmap = cifs_file_mmap,
.splice_read = generic_file_splice_read,
@@ -118,7 +118,7 @@ const struct file_operations smb2_file_strict_nobrl_ops = {
.aio_write = cifs_strict_writev,
.open = smb2_open,
.release = cifs_close,
- .fsync = cifs_strict_fsync,
+ .fsync = smb2_strict_fsync,
.flush = cifs_flush,
.mmap = cifs_file_strict_mmap,
.splice_read = generic_file_splice_read,
@@ -137,7 +137,7 @@ const struct file_operations smb2_file_direct_nobrl_ops = {
.aio_write = smb2_user_writev,
.open = smb2_open,
.release = cifs_close,
- .fsync = cifs_fsync,
+ .fsync = smb2_fsync,
.flush = cifs_flush,
.mmap = cifs_file_mmap,
.splice_read = generic_file_splice_read,
@@ -473,3 +473,21 @@ smb2_readpages(struct file *file, struct address_space *mapping,
return cifs_readpages_generic(file, mapping, page_list, num_pages,
smb2_async_readv);
}
+
+static int
+smb2_fsync_cb(int xid, struct cifsFileInfo *cfile)
+{
+ return SMB2_flush(xid, tlink_tcon(cfile->tlink), cfile->persist_fid,
+ cfile->volatile_fid);
+}
+
+int smb2_fsync(struct file *file, loff_t start, loff_t end, int datasync)
+{
+ return cifs_fsync_generic(file, start, end, datasync, smb2_fsync_cb);
+}
+
+int smb2_strict_fsync(struct file *file, loff_t start, loff_t end, int datasync)
+{
+ return cifs_strict_fsync_generic(file, start, end, datasync,
+ smb2_fsync_cb);
+}
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
index 4e7337c..ea44077 100644
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -124,8 +124,6 @@ extern void smb2_allinfo_to_fattr(struct cifs_fattr *attr,
extern void smb2_create_dfs_attr(struct cifs_fattr *fattr,
struct super_block *sb);
extern void cifs_fattr_to_inode(struct inode *pinode, struct cifs_fattr *attr);
-extern int smb2_fsync(struct file *file, int datasync);
-extern int smb2_flush(struct file *file, fl_owner_t id);
extern struct cifsFileInfo *smb2_new_fileinfo(__u64 persist_fid,
__u64 volatile_fid,
struct file *file,
@@ -142,6 +140,10 @@ extern int smb2_write_cb(int xid, struct cifsFileInfo *cfile,
struct cifs_io_parms *parms, unsigned int *written,
struct kvec *iov, unsigned long nr_segs,
unsigned int remaining_bytes, int timeout);
+extern int smb2_strict_fsync(struct file *file, loff_t start, loff_t end,
+ int datasync);
+extern int smb2_fsync(struct file *file, loff_t start, loff_t end,
+ int datasync);
extern int smb2_open(struct inode *inode, struct file *file);
extern ssize_t smb2_user_readv(struct kiocb *iocb, const struct iovec *iov,
--
1.7.1
next prev parent reply other threads:[~2011-10-28 19:57 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-28 19:54 [PATCH v2 00/53] SMB2 protocol support for CIFS kernel module Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 02/53] CIFS: Allow SMB2 statistics to be tracked Pavel Shilovsky
2011-10-29 4:48 ` Jeff Layton
2011-10-29 5:12 ` Steve French
[not found] ` <CAH2r5mtpckA75LEAynsPLVsPfr7U0wnYAyZ1uKeK2VU9F1CGeQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-29 5:32 ` Jeff Layton
[not found] ` <20111029004814.41340503-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2011-10-29 19:44 ` Pavel Shilovsky
[not found] ` <CAKywueQwBwR-HZtv6gQv32kt4+2qycS7vq5KDLiE3xw3_9=wPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-30 2:12 ` Jeff Layton
[not found] ` <20111029221251.5fba1444-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2011-10-30 2:52 ` Steve French
2011-10-28 19:54 ` [PATCH v2 03/53] CIFS: Check for smb2 vs. cifs in find_tcp_session Pavel Shilovsky
[not found] ` <1319831704-3572-4-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
2011-10-29 4:40 ` Jeff Layton
[not found] ` <20111029004046.2bf8e111-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2011-10-29 19:55 ` Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 05/53] CIFS: wait_for_free_request needs to wait on credits returned by server (for SMB2) Pavel Shilovsky
[not found] ` <1319831704-3572-6-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
2011-10-29 15:35 ` Jeff Layton
2011-10-29 20:00 ` Pavel Shilovsky
[not found] ` <CAKywueSGDSw33L4_a7W6D7gM_PH9uy3xTQ6=8zgAimGhz5=UfA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-30 2:41 ` Jeff Layton
2011-10-28 19:54 ` [PATCH v2 07/53] CIFS: Add structure definitions for SMB2 PDUs Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 09/53] CIFS: Allocating SMB2 mids (multiplex identifier structures) Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 15/53] CIFS: Make demultiplex_thread work with SMB2 code Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 16/53] CIFS: Get mount/umount work with SMB2 protocol Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 18/53] CIFS: Add SMB2 inode/dentry ops structures Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 19/53] CIFS: Add SMB2 support for mkdir operation Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 22/53] CIFS: Add SMB2 support for open/close file operations Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 23/53] CIFS: Add SMB2 support for reopen file operation Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 25/53] CIFS: Add SMB2 support for cifs_iovec_read Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 26/53] CIFS: Add address space ops structures for SMB2 Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 28/53] CIFS: Add write related address space operations " Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 30/53] CIFS: Temporarily disable set inode info " Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 31/53] CIFS: Add writepages support " Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 32/53] CIFS: Add readpages " Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 33/53] CIFS: Add echo request " Pavel Shilovsky
[not found] ` <1319831704-3572-1-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
2011-10-28 19:54 ` [PATCH v2 01/53] CIFS: Update cifs global structures to handle smb2 sessions Pavel Shilovsky
[not found] ` <1319831704-3572-2-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
2011-10-29 4:54 ` Jeff Layton
2011-10-28 19:54 ` [PATCH v2 04/53] CIFS: Do not try to dump cifs mids from " Pavel Shilovsky
[not found] ` <1319831704-3572-5-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
2011-10-29 5:05 ` Jeff Layton
2011-10-28 19:54 ` [PATCH v2 06/53] CIFS: Add missing unicode handling routines needed by smb2 Pavel Shilovsky
[not found] ` <1319831704-3572-7-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
2011-11-01 10:12 ` Jeff Layton
2011-11-01 13:52 ` Shirish Pargaonkar
2011-12-29 15:01 ` Pavel Shilovsky
2011-12-30 12:42 ` Jeff Layton
2012-01-12 10:47 ` Pavel Shilovsky
2012-01-12 17:22 ` Shirish Pargaonkar
[not found] ` <CADT32eJ7FMkQZiy4LjeEG3axvt99N7jFEod7-u2js1MnhVkc7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-12 18:42 ` Jeff Layton
2012-01-12 19:58 ` Shirish Pargaonkar
[not found] ` <CADT32eKc=Xq5G1cE+pye6h1dN6sjry+b7V0ze7CTMJXC8JCtwA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-12 20:48 ` Jeff Layton
2012-01-12 20:41 ` Shirish Pargaonkar
2011-10-28 19:54 ` [PATCH v2 10/53] CIFS: Add routines to free SMB2 mids Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 11/53] CIFS: Add sync_smb2_mid_result Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 13/53] CIFS: Add SMB2 transport routines Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 14/53] CIFS: Expand cifs mid structure to keep SMB2 related fields Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 17/53] CIFS: Simplify SMB2 query info Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 20/53] CIFS: Add SMB2 support for rmdir operation Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 21/53] CIFS: Add SMB2 support for unlink operation Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 24/53] CIFS: Add SMB2 support for cifs_iovec_write Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 27/53] CIFS: Add read related address space operations for SMB2 Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 29/53] CIFS: Respect max buf size for SMB2 read and write Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 34/53] [CIFS] Add SMB2 support for cifs_get_file_info Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 35/53] CIFS: Add SMB2 support for create operation Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 36/53] CIFS: Add readdir support for SMB2 Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 37/53] CIFS: Add SMB2 support for rename operation Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 38/53] CIFS: Add SMB2 support for hardlink operation Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 40/53] CIFS: Add NTLMSSP sec type to defaults Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 41/53] CIFS: Disable SMB2.1 protocol negotiating Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 43/53] CIFS: Process STATUS_PENDING responses for SMB2 Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 44/53] CIFS: Request SMB2.1 leases Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 45/53] CIFS: Process oplock/lease break for SMB2/2.1 Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 47/53] CIFS: Enable signing in SMB2 Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 48/53] CIFS: Process signing for SMB2_logoff Pavel Shilovsky
2011-10-28 19:55 ` [PATCH v2 49/53] CIFS: Introduce SMB2 Kconfig option Pavel Shilovsky
2011-10-28 19:55 ` [PATCH v2 50/53] CIFS: Introduce smb2 mounts as vers=2 Pavel Shilovsky
2011-10-28 19:55 ` [PATCH v2 53/53] CIFS: Disable lock call for SMB2 since we don't support it Pavel Shilovsky
2011-10-28 19:54 ` Pavel Shilovsky [this message]
2011-10-28 19:54 ` [PATCH v2 42/53] CIFS: Process oplocks for SMB2 Pavel Shilovsky
2011-10-28 19:54 ` [PATCH v2 46/53] CIFS: Add strictcache i/o " Pavel Shilovsky
2011-10-28 19:55 ` [PATCH v2 51/53] CIFS: Change Makefile to support CONFIG_CIFS_SMB2 Pavel Shilovsky
2011-10-28 19:55 ` [PATCH v2 52/53] CIFS: Add statfs support for SMB2 Pavel Shilovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319831704-3572-40-git-send-email-piastry@etersoft.ru \
--to=piastry@etersoft.ru \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=piastryyy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).