Skip to content

Commit 6c2c1e0

Browse files
committed
9p: Do a couple of cleanups
Do a couple of cleanups to 9p: (1) Remove a couple of unused variables. (2) Turn a BUG_ON() into a warning, consolidate with another warning and make the warning message include the inode number rather than whatever's in i_private (which will get hashed anyway). Suggested-by: Dominique Martinet <asmadeus@codewreck.org> Link: https://lore.kernel.org/r/ZZULNQAZ0n0WQv7p@codewreck.org/ Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Dominique Martinet <asmadeus@codewreck.org> cc: Eric Van Hensbergen <ericvh@kernel.org> cc: Latchesar Ionkov <lucho@ionkov.net> cc: Christian Schoenebeck <linux_oss@crudebyte.com> cc: v9fs@lists.linux.dev cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org
1 parent 9546ac7 commit 6c2c1e0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

fs/9p/vfs_addr.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828

2929
static void v9fs_upload_to_server(struct netfs_io_subrequest *subreq)
3030
{
31-
struct inode *inode = subreq->rreq->inode;
32-
struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode);
3331
struct p9_fid *fid = subreq->rreq->netfs_priv;
3432
int err;
3533

@@ -98,15 +96,13 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
9896

9997
if (file) {
10098
fid = file->private_data;
101-
BUG_ON(!fid);
99+
if (!fid)
100+
goto no_fid;
102101
p9_fid_get(fid);
103102
} else {
104103
fid = v9fs_fid_find_inode(rreq->inode, writing, INVALID_UID, true);
105-
if (!fid) {
106-
WARN_ONCE(1, "folio expected an open fid inode->i_private=%p\n",
107-
rreq->inode->i_private);
108-
return -EINVAL;
109-
}
104+
if (!fid)
105+
goto no_fid;
110106
}
111107

112108
/* we might need to read from a fid that was opened write-only
@@ -115,6 +111,11 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
115111
WARN_ON(rreq->origin == NETFS_READ_FOR_WRITE && !(fid->mode & P9_ORDWR));
116112
rreq->netfs_priv = fid;
117113
return 0;
114+
115+
no_fid:
116+
WARN_ONCE(1, "folio expected an open fid inode->i_ino=%lx\n",
117+
rreq->inode->i_ino);
118+
return -EINVAL;
118119
}
119120

120121
/**

0 commit comments

Comments
 (0)