summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/storage/file/fd.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 5b8a765760..8759400542 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -443,36 +443,33 @@ pg_flush_data(int fd, off_t offset, off_t nbytes)
* We map the file (mmap()), tell the kernel to sync back the contents
* (msync()), and then remove the mapping again (munmap()).
*/
- p = mmap(NULL, context->nbytes,
+ p = mmap(NULL, nbytes,
PROT_READ | PROT_WRITE, MAP_SHARED,
- context->fd, context->offset);
+ fd, offset);
if (p == MAP_FAILED)
{
ereport(WARNING,
(errcode_for_file_access(),
- errmsg("could not mmap while flushing dirty data in file \"%s\": %m",
- context->filename ? context->filename : "")));
- goto out;
+ errmsg("could not mmap while flushing dirty data: %m")));
+ return;
}
- rc = msync(p, context->nbytes, MS_ASYNC);
+ rc = msync(p, nbytes, MS_ASYNC);
if (rc != 0)
{
ereport(WARNING,
(errcode_for_file_access(),
- errmsg("could not flush dirty data in file \"%s\": %m",
- context->filename ? context->filename : "")));
+ errmsg("could not flush dirty data: %m")));
/* NB: need to fall through to munmap()! */
}
- rc = munmap(p, context->nbytes);
+ rc = munmap(p, nbytes);
if (rc != 0)
{
/* FATAL error because mapping would remain */
ereport(FATAL,
(errcode_for_file_access(),
- errmsg("could not munmap while flushing blocks in file \"%s\": %m",
- context->filename ? context->filename : "")));
+ errmsg("could not munmap while flushing blocks: %m")));
}
}
#elif defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
@@ -487,17 +484,15 @@ pg_flush_data(int fd, off_t offset, off_t nbytes)
* preferrable method.
*/
- rc = posix_fadvise(context->fd, context->offset, context->nbytes,
- POSIX_FADV_DONTNEED);
+ rc = posix_fadvise(fd, offset, nbytes, POSIX_FADV_DONTNEED);
/* don't error out, this is just a performance optimization */
if (rc != 0)
{
ereport(WARNING,
(errcode_for_file_access(),
- errmsg("could not flush dirty data in file \"%s\": %m",
- context->filename ? context->filename : "")));
- goto out;
+ errmsg("could not flush dirty data: %m")));
+ return;
}
}
#else