Commit 73425800 authored by David Howells's avatar David Howells Committed by Christian Brauner

netfs, cifs: Move CIFS_INO_MODIFIED_ATTR to netfs_inode

Move CIFS_INO_MODIFIED_ATTR to netfs_inode as NETFS_ICTX_MODIFIED_ATTR and
then make netfs_perform_write() set it.  This means that cifs doesn't need
to implement the ->post_modify() hook.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.com>
cc: linux-cifs@vger.kernel.org
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20240814203850.2240469-7-dhowells@redhat.com/ # v2
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 8f52de00
...@@ -372,8 +372,14 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter, ...@@ -372,8 +372,14 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,
} while (iov_iter_count(iter)); } while (iov_iter_count(iter));
out: out:
if (likely(written) && ctx->ops->post_modify) if (likely(written)) {
ctx->ops->post_modify(inode); /* Set indication that ctime and mtime got updated in case
* close is deferred.
*/
set_bit(NETFS_ICTX_MODIFIED_ATTR, &ctx->flags);
if (unlikely(ctx->ops->post_modify))
ctx->ops->post_modify(inode);
}
if (unlikely(wreq)) { if (unlikely(wreq)) {
ret2 = netfs_end_writethrough(wreq, &wbc, writethrough); ret2 = netfs_end_writethrough(wreq, &wbc, writethrough);
......
...@@ -1550,7 +1550,6 @@ struct cifsInodeInfo { ...@@ -1550,7 +1550,6 @@ struct cifsInodeInfo {
#define CIFS_INO_DELETE_PENDING (3) /* delete pending on server */ #define CIFS_INO_DELETE_PENDING (3) /* delete pending on server */
#define CIFS_INO_INVALID_MAPPING (4) /* pagecache is invalid */ #define CIFS_INO_INVALID_MAPPING (4) /* pagecache is invalid */
#define CIFS_INO_LOCK (5) /* lock bit for synchronization */ #define CIFS_INO_LOCK (5) /* lock bit for synchronization */
#define CIFS_INO_MODIFIED_ATTR (6) /* Indicate change in mtime/ctime */
#define CIFS_INO_CLOSE_ON_LOCK (7) /* Not to defer the close when lock is set */ #define CIFS_INO_CLOSE_ON_LOCK (7) /* Not to defer the close when lock is set */
unsigned long flags; unsigned long flags;
spinlock_t writers_lock; spinlock_t writers_lock;
......
...@@ -316,12 +316,6 @@ static void cifs_rreq_done(struct netfs_io_request *rreq) ...@@ -316,12 +316,6 @@ static void cifs_rreq_done(struct netfs_io_request *rreq)
inode_set_atime_to_ts(inode, inode_get_mtime(inode)); inode_set_atime_to_ts(inode, inode_get_mtime(inode));
} }
static void cifs_post_modify(struct inode *inode)
{
/* Indication to update ctime and mtime as close is deferred */
set_bit(CIFS_INO_MODIFIED_ATTR, &CIFS_I(inode)->flags);
}
static void cifs_free_request(struct netfs_io_request *rreq) static void cifs_free_request(struct netfs_io_request *rreq)
{ {
struct cifs_io_request *req = container_of(rreq, struct cifs_io_request, rreq); struct cifs_io_request *req = container_of(rreq, struct cifs_io_request, rreq);
...@@ -372,7 +366,6 @@ const struct netfs_request_ops cifs_req_ops = { ...@@ -372,7 +366,6 @@ const struct netfs_request_ops cifs_req_ops = {
.clamp_length = cifs_clamp_length, .clamp_length = cifs_clamp_length,
.issue_read = cifs_req_issue_read, .issue_read = cifs_req_issue_read,
.done = cifs_rreq_done, .done = cifs_rreq_done,
.post_modify = cifs_post_modify,
.begin_writeback = cifs_begin_writeback, .begin_writeback = cifs_begin_writeback,
.prepare_write = cifs_prepare_write, .prepare_write = cifs_prepare_write,
.issue_write = cifs_issue_write, .issue_write = cifs_issue_write,
...@@ -1396,7 +1389,7 @@ int cifs_close(struct inode *inode, struct file *file) ...@@ -1396,7 +1389,7 @@ int cifs_close(struct inode *inode, struct file *file)
dclose = kmalloc(sizeof(struct cifs_deferred_close), GFP_KERNEL); dclose = kmalloc(sizeof(struct cifs_deferred_close), GFP_KERNEL);
if ((cfile->status_file_deleted == false) && if ((cfile->status_file_deleted == false) &&
(smb2_can_defer_close(inode, dclose))) { (smb2_can_defer_close(inode, dclose))) {
if (test_and_clear_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) { if (test_and_clear_bit(NETFS_ICTX_MODIFIED_ATTR, &cinode->netfs.flags)) {
inode_set_mtime_to_ts(inode, inode_set_mtime_to_ts(inode,
inode_set_ctime_current(inode)); inode_set_ctime_current(inode));
} }
......
...@@ -73,6 +73,7 @@ struct netfs_inode { ...@@ -73,6 +73,7 @@ struct netfs_inode {
#define NETFS_ICTX_ODIRECT 0 /* The file has DIO in progress */ #define NETFS_ICTX_ODIRECT 0 /* The file has DIO in progress */
#define NETFS_ICTX_UNBUFFERED 1 /* I/O should not use the pagecache */ #define NETFS_ICTX_UNBUFFERED 1 /* I/O should not use the pagecache */
#define NETFS_ICTX_WRITETHROUGH 2 /* Write-through caching */ #define NETFS_ICTX_WRITETHROUGH 2 /* Write-through caching */
#define NETFS_ICTX_MODIFIED_ATTR 3 /* Indicate change in mtime/ctime */
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment