diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_sfbuf.c | 16 | ||||
-rw-r--r-- | sys/kern/uipc_syscalls.c | 3 | ||||
-rw-r--r-- | sys/sys/sf_buf.h | 6 |
3 files changed, 23 insertions, 2 deletions
diff --git a/sys/kern/subr_sfbuf.c b/sys/kern/subr_sfbuf.c index e4309d1..1950f69 100644 --- a/sys/kern/subr_sfbuf.c +++ b/sys/kern/subr_sfbuf.c @@ -201,6 +201,22 @@ sf_buf_free(struct sf_buf *sf) mtx_unlock(&sf_buf_lock); } +void +sf_buf_ref(struct sf_buf *sf) +{ + +#ifdef SFBUF_OPTIONAL_DIRECT_MAP + if (SFBUF_OPTIONAL_DIRECT_MAP) + return; +#endif + + KASSERT(sf->ref_count > 0, ("%s: sf %p not allocated", __func__, sf)); + + mtx_lock(&sf_buf_lock); + sf->ref_count++; + mtx_unlock(&sf_buf_lock); +} + #ifdef SFBUF_PROCESS_PAGE /* * Run callback function on sf_buf that holds a certain page. diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 4675f19..43dd56b 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1993,8 +1993,7 @@ sf_ext_ref(void *arg1, void *arg2) struct sendfile_sync *sfs = arg2; vm_page_t pg = sf_buf_page(sf); - /* XXXGL: there should be sf_buf_ref() */ - sf_buf_alloc(sf_buf_page(sf), SFB_NOWAIT); + sf_buf_ref(sf); vm_page_lock(pg); vm_page_wire(pg); diff --git a/sys/sys/sf_buf.h b/sys/sys/sf_buf.h index 8a6c56f..7ab9443 100644 --- a/sys/sys/sf_buf.h +++ b/sys/sys/sf_buf.h @@ -106,6 +106,7 @@ struct sf_buf; #ifdef SFBUF struct sf_buf *sf_buf_alloc(struct vm_page *, int); void sf_buf_free(struct sf_buf *); +void sf_buf_ref(struct sf_buf *); static inline vm_offset_t sf_buf_kva(struct sf_buf *sf) @@ -168,6 +169,11 @@ static inline void sf_buf_free(struct sf_buf *sf) { } + +static inline void +sf_buf_ref(struct sf_buf *sf) +{ +} #endif /* SFBUF */ /* |