NFS: Remove private spinlock in struct nfs_pgio_header
Now that each struct nfs_pgio_header corresponds to one RPC call, we only have one writer to the struct nfs_pgio_header. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
28d52235ee
commit
1c6c4b740d
|
@ -63,14 +63,14 @@ EXPORT_SYMBOL_GPL(nfs_pgheader_init);
|
|||
|
||||
void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos)
|
||||
{
|
||||
spin_lock(&hdr->lock);
|
||||
if (!test_and_set_bit(NFS_IOHDR_ERROR, &hdr->flags)
|
||||
|| pos < hdr->io_start + hdr->good_bytes) {
|
||||
unsigned int new = pos - hdr->io_start;
|
||||
|
||||
if (hdr->good_bytes > new) {
|
||||
hdr->good_bytes = new;
|
||||
clear_bit(NFS_IOHDR_EOF, &hdr->flags);
|
||||
hdr->good_bytes = pos - hdr->io_start;
|
||||
hdr->error = error;
|
||||
if (!test_and_set_bit(NFS_IOHDR_ERROR, &hdr->flags))
|
||||
hdr->error = error;
|
||||
}
|
||||
spin_unlock(&hdr->lock);
|
||||
}
|
||||
|
||||
static inline struct nfs_page *
|
||||
|
@ -494,7 +494,6 @@ struct nfs_pgio_header *nfs_pgio_header_alloc(const struct nfs_rw_ops *ops)
|
|||
|
||||
if (hdr) {
|
||||
INIT_LIST_HEAD(&hdr->pages);
|
||||
spin_lock_init(&hdr->lock);
|
||||
hdr->rw_ops = ops;
|
||||
}
|
||||
return hdr;
|
||||
|
|
|
@ -276,16 +276,14 @@ static void nfs_readpage_result(struct rpc_task *task,
|
|||
struct nfs_pgio_header *hdr)
|
||||
{
|
||||
if (hdr->res.eof) {
|
||||
loff_t bound;
|
||||
loff_t pos = hdr->args.offset + hdr->res.count;
|
||||
unsigned int new = pos - hdr->io_start;
|
||||
|
||||
bound = hdr->args.offset + hdr->res.count;
|
||||
spin_lock(&hdr->lock);
|
||||
if (bound < hdr->io_start + hdr->good_bytes) {
|
||||
if (hdr->good_bytes > new) {
|
||||
hdr->good_bytes = new;
|
||||
set_bit(NFS_IOHDR_EOF, &hdr->flags);
|
||||
clear_bit(NFS_IOHDR_ERROR, &hdr->flags);
|
||||
hdr->good_bytes = bound - hdr->io_start;
|
||||
}
|
||||
spin_unlock(&hdr->lock);
|
||||
} else if (hdr->res.count < hdr->args.count)
|
||||
nfs_readpage_retry(task, hdr);
|
||||
}
|
||||
|
|
|
@ -1482,11 +1482,10 @@ struct nfs_pgio_header {
|
|||
const struct nfs_rw_ops *rw_ops;
|
||||
struct nfs_io_completion *io_completion;
|
||||
struct nfs_direct_req *dreq;
|
||||
spinlock_t lock;
|
||||
/* fields protected by lock */
|
||||
|
||||
int pnfs_error;
|
||||
int error; /* merge with pnfs_error */
|
||||
unsigned long good_bytes; /* boundary of good data */
|
||||
unsigned int good_bytes; /* boundary of good data */
|
||||
unsigned long flags;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue