Date: Thu, 26 Feb 2009 12:33:17 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r189069 - head/sys/fs/udf Message-ID: <200902261233.n1QCXHOE027779@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Thu Feb 26 12:33:17 2009 New Revision: 189069 URL: http://svn.freebsd.org/changeset/base/189069 Log: udf_map: return proper error code instead of leaking an internal one Incidentally this also allows for small files with data embedded into fentry to be mmap-ed. Approved by: jhb (mentor) Modified: head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Thu Feb 26 12:33:12 2009 (r189068) +++ head/sys/fs/udf/udf_vnops.c Thu Feb 26 12:33:17 2009 (r189069) @@ -1056,8 +1056,19 @@ udf_bmap(struct vop_bmap_args *a) if (a->a_runb) *a->a_runb = 0; - error = udf_bmap_internal(node, a->a_bn * node->udfmp->bsize, &lsector, - &max_size); + /* + * UDF_INVALID_BMAP means data embedded into fentry, this is an internal + * error that should not be propagated to calling code. + * Most obvious mapping for this error is EOPNOTSUPP as we can not truly + * translate block numbers in this case. + * Incidentally, this return code will make vnode pager to use VOP_READ + * to get data for mmap-ed pages and udf_read knows how to do the right + * thing for this kind of files. + */ + error = udf_bmap_internal(node, a->a_bn << node->udfmp->bshift, + &lsector, &max_size); + if (error == UDF_INVALID_BMAP) + return (EOPNOTSUPP); if (error) return (error);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902261233.n1QCXHOE027779>