Date: Tue, 30 Aug 2022 15:02:08 +0000 From: Rick Macklem <rmacklem@uoguelph.ca> To: Mateusz Guzik <mjguzik@gmail.com>, Alexander Motin <mav@FreeBSD.org> Cc: "src-committers@FreeBSD.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@FreeBSD.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@FreeBSD.org" <dev-commits-src-main@FreeBSD.org> Subject: Re: git: 35b7759c05cb - main - cp: Fix build without VM_AND_BUFFER_CACHE_SYNCHRONIZED. Message-ID: <YQXPR01MB41500177CCDFEECFBE95861EDD799@YQXPR01MB4150.CANPRD01.PROD.OUTLOOK.COM> In-Reply-To: <CAGudoHEphH-4pKGf=ta4AWir2Uj9Mg_tUysU1V5ic6z_XVQG4Q@mail.gmail.com> References: <202208301453.27UEroGr037461@gitrepo.freebsd.org> <CAGudoHEphH-4pKGf=ta4AWir2Uj9Mg_tUysU1V5ic6z_XVQG4Q@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Mateusz Guzik <mjguzik@gmail.com> wrote:=0A= > On 8/30/22, Alexander Motin <mav@freebsd.org> wrote:=0A= > > The branch main has been updated by mav:=0A= > >=0A= > > URL:=0A= > > https://cgit.FreeBSD.org/src/commit/?id=3D35b7759c05cbc65c06d87141da79f= 0f80af0f458=0A= > >=0A= > > commit 35b7759c05cbc65c06d87141da79f0f80af0f458=0A= > > Author: Alexander Motin <mav@FreeBSD.org>=0A= > > AuthorDate: 2022-08-30 14:51:21 +0000=0A= > > Commit: Alexander Motin <mav@FreeBSD.org>=0A= > > CommitDate: 2022-08-30 14:51:21 +0000=0A= > >=0A= > > cp: Fix build without VM_AND_BUFFER_CACHE_SYNCHRONIZED.=0A= > >=0A= > > It allows to not use mmap() for small files, which is not helpful= =0A= > > in case of ZFS. Should be no functional change.=0A= > >=0A= > =0A= > This should be of no use thanks to copy_file_range=0A= cp does not use copy_file_range(2) for small files, if I recall correctly.= =0A= =0A= rick=0A= =0A= > MFC after: 1 week=0A= > ---=0A= > bin/cp/utils.c | 19 +++++++++----------=0A= > 1 file changed, 9 insertions(+), 10 deletions(-)=0A= >=0A= > diff --git a/bin/cp/utils.c b/bin/cp/utils.c=0A= > index e7ae0c9dd733..07de0495ba9e 100644=0A= > --- a/bin/cp/utils.c=0A= > +++ b/bin/cp/utils.c=0A= > @@ -99,13 +99,12 @@ copy_file(const FTSENT *entp, int dne)=0A= > static char *buf =3D NULL;=0A= > static size_t bufsize;=0A= > struct stat *fs;=0A= > - ssize_t rcount, wcount;=0A= > - size_t wresid;=0A= > + ssize_t wcount;=0A= > off_t wtotal;=0A= > int ch, checkch, from_fd, rval, to_fd;=0A= > - char *bufp;=0A= > #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED=0A= > - char *p;=0A= > + size_t wresid;=0A= > + char *bufp, *p;=0A= > #endif=0A= > int use_copy_file_range =3D 1;=0A= >=0A= > @@ -234,18 +233,18 @@ copy_file(const FTSENT *entp, int dne)=0A= > wtotal =3D 0;=0A= > do {=0A= > if (use_copy_file_range) {=0A= > - rcount =3D copy_file_range(from_fd,= NULL,=0A= > + wcount =3D copy_file_range(from_fd,= NULL,=0A= > to_fd, NULL, SSIZE_MAX, 0);=0A= > - if (rcount < 0 && errno =3D=3D EINV= AL) {=0A= > + if (wcount < 0 && errno =3D=3D EINV= AL) {=0A= > /* Prob a non-seekable FD *= /=0A= > use_copy_file_range =3D 0;= =0A= > }=0A= > }=0A= > if (!use_copy_file_range) {=0A= > - rcount =3D copy_fallback(from_fd, t= o_fd,=0A= > + wcount =3D copy_fallback(from_fd, t= o_fd,=0A= > buf, bufsize);=0A= > }=0A= > - wtotal +=3D rcount;=0A= > + wtotal +=3D wcount;=0A= > if (info) {=0A= > info =3D 0;=0A= > (void)fprintf(stderr,=0A= > @@ -253,8 +252,8 @@ copy_file(const FTSENT *entp, int dne)=0A= > entp->fts_path, to.p_path,=0A= > cp_pct(wtotal, fs->st_size));= =0A= > }=0A= > - } while (rcount > 0);=0A= > - if (rcount < 0) {=0A= > + } while (wcount > 0);=0A= > + if (wcount < 0) {=0A= > warn("%s", entp->fts_path);=0A= > rval =3D 1;=0A= > }=0A= >=0A= >=0A= =0A= =0A= --=0A= Mateusz Guzik <mjguzik gmail.com>=0A=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YQXPR01MB41500177CCDFEECFBE95861EDD799>